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

# Google ADK A2A Server for Cookbook Examples

> Uses Google's ADK to create an A2A-compatible agent.

Uses Google's ADK to create an A2A-compatible agent. Requires GOOGLE\_API\_KEY environment variable.

```python adk_server.py theme={null}
"""
Google ADK A2A Server for Cookbook Examples.

Uses Google's ADK to create an A2A-compatible agent.
Requires GOOGLE_API_KEY environment variable.

This server exposes a facts-agent that provides interesting facts,
using pure JSON-RPC at root "/" endpoint (Google ADK style).

Start this server before running 05_remote_adk_agent.py
"""

import os

from a2a.types import AgentCapabilities, AgentCard
from google.adk import Agent
from google.adk.a2a.utils.agent_to_a2a import to_a2a
from google.adk.tools import google_search

# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------

port = int(os.getenv("PORT", "7780"))

agent = Agent(
    name="facts_agent",
    model="gemini-2.5-flash-lite",
    description="Agent that provides interesting facts.",
    instruction="You are a helpful agent who provides interesting facts.",
    tools=[google_search],
)

# Define A2A agent card
agent_card = AgentCard(
    name="facts_agent",
    description="Agent that provides interesting facts.",
    url=f"http://localhost:{port}",
    version="1.0.0",
    capabilities=AgentCapabilities(
        streaming=True, push_notifications=False, state_transition_history=False
    ),
    skills=[],
    default_input_modes=["text/plain"],
    default_output_modes=["text/plain"],
)

app = to_a2a(agent, port=port, agent_card=agent_card)

# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=port)
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U a2a-sdk google-adk uvicorn
    ```
  </Step>

  <Step title="Export your API keys">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export GOOGLE_API_KEY="your_google_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:GOOGLE_API_KEY="your_google_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `adk_server.py`, then run:

    ```bash theme={null}
    python adk_server.py
    ```
  </Step>
</Steps>

Full source: [cookbook/05\_agent\_os/20\_remote/servers/adk\_server.py](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/20_remote/servers/adk_server.py)
