# Google Adk LLM Agent

> Create Google ADK LlmAgent (also aliased as Agent). Use when building a single AI agent with model, instruction, tools, and configuration. Covers all LlmAgent parameters, instruction providers, output schemas, and include_contents options.

- Skill: `eagleisbatman/google-adk-llm-agent` (Agent Skill)
- Install (CLI): `npx skillmds@latest add eagleisbatman/google-adk-llm-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/eagleisbatman/google-adk-llm-agent/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: eagleisbatman (https://skillmd.com/u/eagleisbatman)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/eagleisbatman/google-adk-llm-agent

---


# Google ADK — LlmAgent Reference

## Import

```python
from google.adk.agents import Agent  # Alias for LlmAgent
from google.adk.agents import LlmAgent  # Full name
```

## Basic Agent

```python
root_agent = Agent(
    name="my_agent",
    model="gemini-2.5-flash",
    description="What this agent does (used by parent for delegation).",
    instruction="You are a helpful assistant that answers questions.",
    tools=[my_tool_function],
)
```

## All LlmAgent Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `name` | str | Unique agent identifier (required) |
| `model` | str | Model ID like `"gemini-2.5-flash"` (required) |
| `instruction` | str \| Callable | System prompt or dynamic instruction provider |
| `description` | str | Used by parent agent for delegation decisions |
| `tools` | list | List of tool functions, BaseTool instances, or toolsets |
| `sub_agents` | list | Child agents for multi-agent systems |
| `output_key` | str | State key to store agent's final output |
| `output_schema` | type | Pydantic model or dict for structured output |
| `include_contents` | str | `"default"` or `"none"` — controls conversation history visibility |
| `before_agent_callback` | Callable | Called before agent runs |
| `after_agent_callback` | Callable | Called after agent completes |
| `before_tool_callback` | Callable | `(tool, args, tool_context) -> Optional[dict]` — called before tool |
| `after_tool_callback` | Callable | `(tool, args, tool_context, response) -> Optional[dict]` — called after tool |
| `generate_content_config` | GenerateContentConfig | Advanced model configuration |
| `code_executor` | CodeExecutor | Built-in code execution capability |
| `planner` | BasePlanner | Enable planning/thinking (e.g. `BuiltInPlanner`) |
| `context_cache_config` | ContextCacheConfig | Cache context for efficiency |

## Dynamic Instruction Provider

```python
from google.adk.agents.readonly_context import ReadonlyContext

def my_instruction(readonly_context: ReadonlyContext) -> str:
    user_name = readonly_context.state.get("user_name", "user")
    return f"You are a helpful assistant for {user_name}. Be concise."

root_agent = Agent(
    name="personalized_agent",
    model="gemini-2.5-flash",
    instruction=my_instruction,
    tools=[],
)
```

## Structured Output (output_schema)

```python
from pydantic import BaseModel

class AnalysisResult(BaseModel):
    summary: str
    sentiment: str
    confidence: float

agent = Agent(
    name="analyzer",
    model="gemini-2.5-flash",
    instruction="Analyze the given text and return structured results.",
    output_schema=AnalysisResult,
)
```

## include_contents Options

| Value | Behavior |
|-------|----------|
| `"default"` | Agent sees relevant conversation history (default) |
| `"none"` | Agent sees NO prior conversation — only instruction + current input |

```python
summary_agent = Agent(
    name="summarizer",
    model="gemini-2.5-flash",
    instruction="Summarize the provided text.",
    include_contents="none",  # Fresh context each time
)
```

## output_key — Storing Results in State

```python
research_agent = Agent(
    name="researcher",
    model="gemini-2.5-flash",
    instruction="Research the given topic.",
    output_key="research_output",  # Stored in state["research_output"]
)
```

## Generate Content Config

```python
from google.genai import types

agent = Agent(
    name="creative_agent",
    model="gemini-2.5-flash",
    instruction="Write creative stories.",
    generate_content_config=types.GenerateContentConfig(
        temperature=0.9,
        top_p=0.95,
        max_output_tokens=2048,
    ),
)
```

## Code Executor

```python
from google.adk.code_executors import BuiltInCodeExecutor

agent = Agent(
    name="coder",
    model="gemini-2.5-flash",
    instruction="Write and execute Python code to solve problems.",
    code_executor=BuiltInCodeExecutor(),
)
```

## Key Conventions

- `name` must be a valid Python identifier (letters, digits, underscores)
- `description` is critical for multi-agent delegation — be specific
- `instruction` can be a string or a callable that returns a string
- Tools are plain Python functions with docstrings (auto-converted to FunctionTool)
- The module-level variable MUST be named `root_agent` for CLI discovery

## Related Skills

- `google-adk-function-tool` — Creating custom tools for agents
- `google-adk-callbacks` — Lifecycle hooks (before/after agent and tool)
- `google-adk-multi-agent` — LLM-routed multi-agent systems
- `google-adk-workflow-agents` — Deterministic orchestration (Sequential, Parallel, Loop)

