> For the complete documentation index, see [llms.txt](/llms.txt).
> A full single-fetch corpus is available at [llms-full.txt](/llms-full.txt).
---
title: Google ADK
description: Run agents built with Google's Agent Development Kit inside an AGNT5 worker, with traces captured automatically.
last_verified: 2026-08-26
---



You don't rewrite a Google ADK agent to run it on AGNT5 — wrap it in a plain `@function` (Python) or `fn()` (TypeScript) that drives ADK's own runner, and return plain data. AGNT5 auto-attaches capture to `google-adk` when it's installed, so agent, LM, and tool spans show up in Studio traces with no manual instrumentation.

---

## Wrapping pattern

A customer-service ADK agent, wrapped as a single AGNT5 function:



**Python:**

```python
from agnt5 import FunctionContext, Worker, function
from google.adk.runners import InMemoryRunner

from customer_service.agent import root_agent

DEFAULT_QUERY = "Hello, can you show me the items in customer 123's cart?"


@function(name="customer_service_agent")
async def customer_service_agent(
    ctx: FunctionContext, query: str = DEFAULT_QUERY
) -> dict[str, object]:
    runner = InMemoryRunner(agent=root_agent, app_name="customer_service_app")
    events = await runner.run_debug(query, user_id="agnt5-user", quiet=True)

    reply = ""
    for event in events:
        if event.is_final_response() and event.content and event.content.parts:
            reply = "".join(part.text for part in event.content.parts if part.text)

    ctx.logger.info("Customer service run completed")
    return {"query": query, "reply": reply}
```

For multi-turn or streaming runs, use `runner.run_async(...)` with an explicit session instead of `run_debug`, iterating events and picking out `event.is_final_response()`.





**TypeScript:**

```typescript
import { fn, Worker } from '@agnt5/sdk';
import type { Context } from '@agnt5/sdk';
import { InMemoryRunner, isFinalResponse, stringifyContent } from '@google/adk';
import { rootAgent } from './customer_service/agent.js';

const DEFAULT_QUERY = "Hello, can you show me the items in customer 123's cart?";

export const customerServiceAgentFunction = fn('customer_service_agent').run(
  async (_ctx: Context, input: { query?: string }) => {
    const query = input.query?.trim() || DEFAULT_QUERY;
    const runner = new InMemoryRunner({ agent: rootAgent });

    let reply = '';
    for await (const event of runner.runEphemeral({
      userId: 'agnt5-user',
      newMessage: { parts: [{ text: query }] },
    })) {
      if (isFinalResponse(event)) {
        reply = stringifyContent(event);
      }
    }

    return { query, reply };
  },
);
```



Register the function on a `Worker` the same way as any other AGNT5 function — see [Functions](/docs/build/functions.md) and [Local development](/docs/cli/dev.md).

---

## What gets captured

AGNT5 attaches a `BasePlugin` to every `Runner`, translating agent, LM, and function spans into canonical journal events: `agent.*`, `lm.*`, `tool_call.*`. Capture is observational only — every hook returns `None` so ADK proceeds normally, and a capture failure never fails your agent's run.

ADK can skip callbacks (for example, another plugin short-circuits an agent), so an occasional unpaired `.started` event with no matching `.completed`/`.failed` is expected, not a capture bug.

---

## Requirements

Capture activates the moment `google-adk` is importable — no separate AGNT5 flag or install extra is required. (`agnt5[google-adk]` just pins the version band below for your own dependency resolution.)

```bash
pip install google-adk
```

```bash
npm install @google/adk
```

| Library | Minimum | Max major (exclusive) |
|---|---|---|
| `google-adk` | 1.7.0 | 3 |

An installed version outside this band is left unpatched rather than risking a broken instrumentation hook.

---

## Disable it

| Environment variable | Effect |
|---|---|
| `AGNT5_CAPTURE=off` | Master kill switch — disables capture for every library |
| `AGNT5_CAPTURE_GOOGLE_ADK=0` | Disables Google ADK capture only |

---

## Related

- [OpenAI SDK](/docs/integrations/third-party/openai-sdk.md): the same wrapping pattern and capture behavior for the OpenAI SDK and OpenAI Agents SDK.
- [AI providers](/docs/integrations/ai-providers.md): configure the `GOOGLE_API_KEY` credential your agents and prompts call.
- [Functions](/docs/build/functions.md): how `@function` / `fn()` works.
- [Integrations overview](/docs/integrations/overview.md)
