Building AI Agents

A Practical Guide with Gemini CLI, Kiro CLI & Goose

Matthew Khouzam

Ericsson

Agenda

  1. What is an Agent?
  2. Anatomy of an Agent
  3. MCP — The Glue
  4. Building an Agent with Gemini CLI
  5. Building an Agent with Kiro CLI
  6. Building an Agent with Goose
  7. Comparison & When to Use Which
  8. Live Demo

What is an Agent?

  • An LLM that can take actions, not just generate text
  • It has a loop: observe → think → act → observe…
  • It uses tools to interact with the real world
  • It decides which tools to call and when

Agent vs Chatbot

ChatbotAgent
OutputTextText + Actions
ToolsNoneFile I/O, shell, APIs, MCP…
LoopSingle turnMulti-step reasoning
AutonomyAnswers questionsSolves problems

Anatomy of an Agent

System Prompt (personality, rules, constraints)
LLM (reasoning engine)
Tools (file read/write, shell, MCP servers…)
Environment (your filesystem, APIs, databases)

Example: MONCEF Agent

MONCEF: Monitoring OWASP Non-Compliance & Exploit Flaws

{
  "name": "moncef",
  "description": "Security guard — OWASP Top 10",
  "prompt": "You are a security-focused code reviewer
    specializing in OWASP Top 10 vulnerabilities...",
  "mcpServers": {},
  "tools": ["*"],
  "allowedTools": [
    "execute_bash", "fs_read", "grep", "code"
  ],
  "includeMcpJson": true
}

No MCP needed — uses only built-in tools.
This same config works with Gemini CLI, Kiro CLI & Goose.

MCP — The Tool Layer

  • Model Context Protocol — open standard by Anthropic
  • Lets agents call external tools via JSON-RPC
  • Write a tool once → use it from any MCP-compatible agent
  • Gemini CLI, Kiro CLI & Goose all support MCP
Agent
MCP Server
Your Tool / API

Writing an MCP Server (Python)

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("my-tools")

@mcp.tool()
def greet(name: str) -> str:
    """Say hello to someone."""
    return f"Hello, {name}!"

@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

if __name__ == "__main__":
    mcp.run()

Install: pip install mcp

Wrapping a CLI Tool as MCP

import subprocess
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("git-tools")

@mcp.tool()
def git_log(n: int = 5) -> str:
    """Show recent git commits."""
    return subprocess.run(
        ["git", "log", f"-{n}", "--oneline"],
        capture_output=True, text=True
    ).stdout

if __name__ == "__main__":
    mcp.run()

Any CLI program → MCP tool in 5 lines.

Part 1: Gemini CLI

Google's open-source AI agent in your terminal

Gemini CLI: Setup

# Install
npm install -g @google/gemini-cli
# or
npx @google/gemini-cli

# Authenticate (uses Google account)
gemini
  • Open source (Apache 2.0)
  • Uses Gemini 2.5 Pro by default
  • 1 million token context window

Gemini CLI: Creating an Agent

Create GEMINI.md in your project root:

# Agent Instructions

You are a code review assistant.

## Rules
- Always check for security issues first
- Suggest fixes, don't just point out problems
- Be concise

## Tools Available
- You can read and write files
- You can run shell commands
- You can use git

GEMINI.md = the system prompt for your agent

Gemini CLI: Enabling MONCEF

Add the prompt to GEMINI.md and configure in .gemini/settings.json:

{
  "customAgents": [{
    "name": "moncef",
    "configPath": "moncef.json"
  }]
}

Then invoke it:

gemini --agent moncef

Gemini CLI: Adding MCP Tools

Create .gemini/settings.json:

{
  "mcpServers": {
    "my-tools": {
      "command": "python3",
      "args": ["mcp_server.py"]
    }
  }
}

Now the agent can call greet and add from our MCP server.

Gemini CLI: Built-in Extensions

  • Automatic file read/write and shell execution
  • Google Search integration
  • Customizable safety thresholds
  • Sandbox mode for untrusted operations
# Run with sandbox
gemini --sandbox

# Use a specific model
gemini --model gemini-2.5-flash

Part 2: Kiro CLI

Amazon's AI agent for the terminal

Kiro CLI: Setup

# Install
npm install -g kiro-cli

# Start
kiro-cli chat
  • Uses Claude (Anthropic) as the LLM
  • Built-in code intelligence (LSP integration)
  • Subagent delegation for parallel tasks

Kiro CLI: Creating an Agent

Create .kiro/settings/agent.md:

# Agent Instructions

You are a code review assistant.

## Rules
- Always check for security issues first
- Suggest fixes, don't just point out problems
- Be concise

Same idea as GEMINI.md — a markdown file defines the agent's behavior.

Kiro CLI: Enabling MONCEF

Drop the config into .kiro/agents/:

cp moncef.json .kiro/agents/moncef.json

Then invoke it:

kiro-cli chat --agent moncef

allowedTools restricts which built-in tools the agent can access.

Kiro CLI: Adding MCP Tools

Create .kiro/settings/mcp.json:

{
  "mcpServers": {
    "my-tools": {
      "command": "python3",
      "args": ["mcp_server.py"]
    }
  }
}

Same MCP server, different config location. That's the beauty of MCP.

Kiro CLI: Unique Features

  • Code Intelligence — LSP-powered symbol search, go-to-definition, find references
  • Subagents — delegate tasks to parallel workers
  • Planner ModeShift+Tab to switch to read-only planning
  • AWS Integration — native AWS CLI tool access

Part 3: Goose

Block's open-source AI agent — MCP-native

Goose: Setup

# Install
brew install block/goose/goose
# or
curl -fsSL https://github.com/block/goose/releases/latest/download/install.sh | sh

# Start
goose session
  • Open source (Apache 2.0)
  • Supports multiple LLMs (OpenAI, Anthropic, Google…)
  • Everything is an MCP extension

Goose: Enabling MONCEF

Drop the config into .goose/recipes/:

cp moncef.json .goose/recipes/moncef.json

Then invoke it:

goose session --recipe .goose/recipes/moncef.json

Same JSON format as Kiro and Gemini — just a different path.

Goose: Adding MCP Tools

Create .goose/recipes/mcp.json:

{
  "mcpServers": {
    "my-tools": {
      "command": "python3",
      "args": ["mcp_server.py"]
    }
  }
}

Same MCP server, same JSON format — Goose treats it as just another extension.

CLI Comparison

Gemini CLIKiro CLIGoose
LLMGemini 2.5ClaudeAny (pluggable)
Agent configAGENTS.md, GEMINI.mdAGENTS.md, .kiro/agents/AGENTS.md, .goose/recipes/
MCP config.gemini/settings.json.kiro/settings/mcp.json.goose/recipes/mcp.json
Code intelBasicLSP-poweredVia extensions
ParallelismSubagentsSubagents
CloudGoogle CloudAWSAgnostic
LicenseApache 2.0ProprietaryApache 2.0

The Pattern: Building Any Agent

  1. Define behavior — write a system prompt (markdown file)
  2. Add tools — write MCP servers for domain-specific capabilities
  3. Configure — point the CLI at your MCP servers
  4. Iterate — refine the prompt based on agent behavior

This pattern works for any MCP-compatible agent.

Real Example: Trace Analysis Agent

System Prompt: "You are a trace analysis expert"
Gemini CLI / Kiro CLI / Goose
↓ MCP
TMLL MCP Server (12 tools)
↓ HTTP
Trace Compass Server

Real Example: User Interaction

User says:

"Load /tmp/kernel-trace and find CPU anomalies"

Agent does:

  1. ensure_server → starts Trace Compass
  2. create_experiment → loads the trace
  3. detect_anomalies → runs isolation forest
  4. Summarizes: "3 CPU spikes found at t=1.2s, 3.9s, 7.1s"

Tips for Good Agents

  • Tool docstrings matter — the AI reads them to decide what to call
  • Keep tools focused — one tool = one action
  • Return structured text — helps the AI parse results
  • System prompt = guardrails — be explicit about what the agent should and shouldn't do
  • Test with edge cases — agents are creative in unexpected ways

Live Demo

Let's build an agent together.

Thank You!

Gemini CLI · Kiro CLI · Goose · MCP Spec