> ## Documentation Index
> Fetch the complete documentation index at: https://docs.idun-group.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google ADK

> Connect a Google ADK agent to Idun Engine with Gemini-powered workflows, session services, and memory backends.

Google ADK (Agent Development Kit) is Google's framework for building Gemini-powered agents. Idun Engine wraps ADK agents as production services with AG-UI streaming, guardrails, and observability.

<Tip>
  Want to start from working code? The [agent templates](/templates) include ADK examples for tool calling and structured I/O.
</Tip>

## Code

```python agent.py theme={"theme":{"light":"github-light","dark":"github-dark"}}
from google.adk.agents import Agent

root_agent = Agent(
    model="gemini-2.5-flash",
    name="weather_agent",
    description="An agent that answers questions about the weather.",
    instruction="You are a helpful weather assistant. Answer questions about weather conditions.",
)
```

<Note>
  If you use Vertex AI models, authenticate with `gcloud auth application-default login` before running the agent.
</Note>

## Config

```yaml config.yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
server:
  api:
    port: 8000

agent:
  type: ADK
  config:
    name: "my-adk-agent"
    agent: "./agent.py:root_agent"
    app_name: "myagent"
```

## How it works

The ADK adapter wraps your raw `Agent` instance for production serving. Five stages, driven by `agent.config` in `config.yaml`:

1. **Load.** `agent` is parsed as `<file_path>:<variable_name>`. The adapter resolves it via `importlib.util.spec_from_file_location`, so the value must point at a real `.py` file (relative or absolute). Unlike LangGraph, module-dotted notation (`my_pkg.agent:root_agent`) is rejected here.
2. **Wrap.** The loaded agent goes into `google.adk.apps.App(root_agent=agent, name=app_name)`, then into `ADKAGUIAgent` from `ag_ui_adk` for AG-UI event streaming.
3. **Sessions.** A `session_service` is initialized from `config.yaml` (`in_memory` by default, or `database`, or `vertex_ai`) and passed into the runner. Session state, including the AG-UI `thread_id` mapping, is kept in this service.
4. **Memory.** A `memory_service` is initialized in parallel (`in_memory` by default, or `vertex_ai`) for long-term recall.
5. **Observability.** When a Langfuse provider is enabled in `observability:`, the adapter installs `GoogleADKInstrumentor` from `openinference.instrumentation.google_adk` automatically. When LangSmith is enabled, it calls `langsmith.integrations.google_adk.configure_google_adk(name=...)`. No extra wiring needed in your agent code.
6. **Serve.** Chat requests POST to `/agent/run` with the AG-UI streaming protocol, same as LangGraph.

Source: [`libs/idun_agent_engine/src/idun_agent_engine/agent/adk/adk.py`](https://github.com/Idun-Group/idun-agent-platform/blob/main/libs/idun_agent_engine/src/idun_agent_engine/agent/adk/adk.py).

## Adding MCP tools

To wire MCP servers registered in `config.yaml` (or the admin panel) into the agent, pull them in with `get_adk_tools()` and pass them to the `Agent` constructor:

```python agent.py theme={"theme":{"light":"github-light","dark":"github-dark"}}
from google.adk.agents import Agent
from idun_agent_engine.mcp import get_adk_tools

root_agent = Agent(
    model="gemini-2.5-flash",
    name="weather_agent",
    description="An agent that answers questions about the weather.",
    instruction="You are a helpful weather assistant. Answer questions about weather conditions.",
    tools=get_adk_tools(),
)
```

`get_adk_tools()` runs at engine boot, after the MCP registry has connected to every server in `mcp_servers`, so every advertised tool is available to the agent without per-tool wiring. See [MCP Servers](/mcp-servers/overview) for the full transport reference.

## Session and memory services

ADK agents have two persistence layers: session services (conversation state) and memory services (long-term recall). The scaffolded `config.yaml` uses in-memory for both by default. See [Memory and sessions for ADK](/memory/adk) for backend options including Database (PostgreSQL) and Vertex AI.

<Warning>
  ADK does not support folder paths that contain spaces. Make sure your project directory path has no spaces.
</Warning>

## Next steps

<Card title="Memory and session details for ADK" icon="database" horizontal href="/memory/adk">
  Configure session and memory services across backends.
</Card>

<Card title="Guardrails" icon="shield" horizontal href="/guardrails/overview">
  Add safety guards to your agent inputs and outputs.
</Card>

<Card title="Observability" icon="activity" horizontal href="/observability/overview">
  Trace runs, monitor latency, and inspect token usage.
</Card>

<Card title="MCP Servers" icon="plug" horizontal href="/mcp-servers/overview">
  Connect external tools through the Model Context Protocol.
</Card>
