Skip to main content

Code

a2a_basic.py
from agno.agent.agent import Agent
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
from agno.os.interfaces.a2a import A2A

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

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

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

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Set Environment Variables

export OPENAI_API_KEY=your_openai_api_key
3

Install libraries

pip install -U agno openai a2a-protocol
4

Run Example

python a2a_basic.py

Key Features

  • A2A Interface: A2A compatible conversation experience
  • Real-time Chat: Instant message exchange
  • Markdown Support: Rich text formatting in responses
  • DateTime Context: Time-aware responses
  • Open Protocol: Compatible with A2A frontends
I