> ## Documentation Index
> Fetch the complete documentation index at: https://flokoa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Flokoa with Google ADK agents

> Wrap a Google ADK LlmAgent with Flokoa to serve it via the A2A protocol, inject operator-managed tools, and deploy it on Kubernetes.

The Flokoa Google ADK integration lets you run any `google.adk.agents.LlmAgent` as an A2A-compatible server without modifying your agent code. The `GoogleADKAgentExecutor` manages ADK session lifecycle, tool injection, and response extraction automatically so you can concentrate on building your agent's logic.

## Installation

```bash theme={null}
pip install "flokoa[google-adk]"
```

## Quick example

Define your ADK agent in a standard Python module, then pass it to `flokoa run`. The executor wraps it and starts the A2A server.

```python my_adk_agent.py theme={null}
from google.adk.agents import LlmAgent

agent = LlmAgent(
    name="my-agent",
    model="gemini-2.0-flash-exp",
    instruction="You are a helpful assistant.",
)
```

Then start the server:

```bash theme={null}
flokoa run --module my_adk_agent:agent --framework google-adk --port 8080
```

The server starts on `http://localhost:8080` and accepts A2A requests immediately.

## GoogleADKAgentExecutor

`flokoa.integrations.google_adk.agent_executor.GoogleADKAgentExecutor` wraps a `google.adk.agents.LlmAgent` and implements the A2A `AgentExecutor` interface. `flokoa run` instantiates it for you, but you can also use it directly when building custom server setups.

```python theme={null}
from flokoa.integrations.google_adk.agent_executor import GoogleADKAgentExecutor

executor = GoogleADKAgentExecutor(agent=agent)
```

```python theme={null}
class GoogleADKAgentExecutor(FlokoaAgentExecutor):
    def __init__(
        self,
        agent: "LlmAgent",
        cache: ConfigCache | None = None,
        toolset_factory: ToolsetFactory | None = None,
    ): ...

    async def execute(self, context: RequestContext, event_queue: EventQueue) -> None: ...
```

**What the executor provides:**

* **Automatic session management** — The executor creates a fresh `InMemorySessionService`, `InMemoryArtifactService`, and `InMemoryMemoryService` for each request via the ADK `Runner`, so you never manage session state yourself.
* **Automatic tool injection** — Tools defined as `AgentTool` CRDs are mounted at `/etc/flokoa/tools/` and injected into the ADK agent's `tools` list at runtime, the same way as the pydantic-ai integration.
* **TTL-based caching** — Tool definitions and model configuration are cached (default: 60 seconds). Set `FLOKOA_CACHE_TTL_SECONDS` to adjust the TTL, or set `FLOKOA_CACHE_ENABLED=false` to disable caching entirely.
* **Final-response extraction** — The executor streams all ADK events and extracts the last text part as the final response delivered to the A2A caller.

## Toolsets

When `AgentTool` CRDs are mounted by the operator, the executor builds a `FlokoaToolset` and appends it to the ADK agent's `tools` list before each run. The executor checks whether a `FlokoaToolset` is already present to avoid adding duplicate toolsets across requests.

The Google ADK integration also supports the `openapi` tool type. When an OpenAPI tool definition is mounted, the executor creates an ADK `OpenAPIToolset` from the inline spec and includes its `RestApiTool` instances in the toolset passed to the agent.

```python theme={null}
# This happens automatically inside the executor — shown for illustration
from google.adk.tools.openapi_tool.openapi_spec_parser.openapi_toolset import OpenAPIToolset

toolset = OpenAPIToolset(spec_dict=spec_dict)
tools = toolset.get_tools()
```

<Note>
  The Google ADK integration requires a Google model provider. Configure a Model CR that references a Google Gemini model and attach it to your Agent CR. If the agent's `model` field is not set and no Model CR is referenced, the ADK runner will raise an error at request time.
</Note>

## Running in Kubernetes

Build a container image with your ADK agent and `flokoa[google-adk]` installed, then declare an `Agent` CR with `framework: google-adk`.

```yaml theme={null}
apiVersion: agent.flokoa.ai/v1alpha1
kind: Agent
metadata:
  name: my-adk-agent
spec:
  framework: google-adk
  model:
    name: gemini-model
  runtime:
    type: standard
    spec:
      container:
        name: agent
        image: ghcr.io/myorg/my-adk-agent:v1.0.0
        ports:
          - containerPort: 8080
            name: http
```

The operator mounts the model configuration and any referenced `AgentTool` CRDs into the container automatically. The executor picks them up at runtime without any changes to your agent code.
