Basic

Create a basic AI agent with A2A interface

Code

a2a_basic.py
from agno.agent.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS

chat_agent = Agent(
    name="Assistant",
    model=OpenAIResponses(id="gpt-5.2"),
    instructions="You are a helpful AI assistant.",
    add_datetime_to_context=True,
    markdown=True,
)

agent_os = AgentOS(
    agents=[chat_agent],
    a2a_interface=True,
)
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="a2a_basic:app", reload=True)

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Set Environment Variables

export OPENAI_API_KEY=your_openai_api_key

Install dependencies

uv pip install -U "agno[os,a2a]" openai

Run Example

python a2a_basic.py

Key Features

  • A2A Endpoints: Serves the protocol routes POST /a2a/agents/{id}/v1/message:send and message:stream
  • Markdown Support: Rich text formatting in responses
  • DateTime Context: Time-aware responses
  • Open Protocol: Compatible with A2A frontends

This example runs without authorization. With authorization=True on the AgentOS, A2A requests need a supported bearer credential, such as a JWT or enabled service-account PAT, with the applicable agents:run or per-agent run scope. See A2A authorization.