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

# Serve an Agno Agent through the A2A REST interface

> This server is the first-party A2A peer used by RemoteAgent.

This server is the first-party A2A peer used by RemoteAgent. AgentOS retains its normal health and config routes while exposing the Agent under `/a2a`.

```python a2a_server.py theme={null}
"""
Serve an Agno Agent through the A2A REST interface
==================================================

This server is the first-party A2A peer used by RemoteAgent. AgentOS retains
its normal health and config routes while exposing the Agent under `/a2a`.

Prerequisites: OPENAI_API_KEY and the `agno[a2a]` extra
Run: .venvs/demo/bin/python cookbook/05_agent_os/20_remote/servers/a2a_server.py
Try: fetch GET http://127.0.0.1:7781/a2a/agents/a2a-assistant/.well-known/agent-card.json
"""

from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.tools.calculator import CalculatorTools

# ---------------------------------------------------------------------------
# Create Database
# ---------------------------------------------------------------------------

db = SqliteDb(
    id="remote-a2a-db",
    db_file="tmp/remote_a2a.db",
)

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

a2a_assistant = Agent(
    id="a2a-assistant",
    name="A2A Assistant",
    description="An Agno Agent served through the standard A2A REST surface.",
    model=OpenAIResponses(id="gpt-5.5"),
    instructions=[
        "Answer requests received over A2A.",
        "Use the calculator for arithmetic.",
        "Keep responses concise.",
    ],
    tools=[CalculatorTools()],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Create AgentOS
# ---------------------------------------------------------------------------

agent_os = AgentOS(
    id="remote-a2a-os",
    name="Remote A2A Server",
    description="Agno A2A backend for RemoteAgent examples.",
    db=db,
    agents=[a2a_assistant],
    a2a_interface=True,
)
app = agent_os.get_app()

# ---------------------------------------------------------------------------
# Run AgentOS
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    agent_os.serve(app=app, host="127.0.0.1", port=7781)
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "agno[a2a,os]" openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

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

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

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

Full source: [cookbook/05\_agent\_os/20\_remote/servers/a2a\_server.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/05_agent_os/20_remote/servers/a2a_server.py)
