weather_agent.py
"""
Weather Agent
=============
Demonstrates weather agent.
"""
from textwrap import dedent
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
from agno.tools.openweather import OpenWeatherTools
# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
weather_agent = Agent(
id="weather-reporter-agent",
name="Weather Reporter Agent",
description="An agent that provides up-to-date weather information for any city.",
model=OpenAIChat(id="gpt-5.2"),
tools=[
OpenWeatherTools(
units="standard" # Can be 'standard', 'metric', 'imperial'
)
],
instructions=dedent("""
You are a concise weather reporter.
Use the 'get_current_weather' tool to fetch current conditions.
Respond with the temperature and a brief summary.
"""),
markdown=True,
)
agent_os = AgentOS(
id="weather-agent-os",
description="An AgentOS serving specialized Agent for weather Reporting",
agents=[
weather_agent,
],
a2a_interface=True,
)
app = agent_os.get_app()
# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
"""Run your AgentOS.
You can run the Agent via A2A protocol:
POST http://localhost:7770/agents/{id}/v1/message:send
For streaming responses:
POST http://localhost:7770/agents/{id}/v1/message:stream
Retrieve the agent card at:
GET http://localhost:7770/agents/{id}/.well-known/agent-card.json
"""
agent_os.serve(app="weather_agent:app", port=7770, reload=True)
Run the Example
1
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
2
Install dependencies
uv pip install -U "agno[a2a,os]" openai requests
3
Export your API keys
export OPENAI_API_KEY="your_openai_api_key_here"
export OPENWEATHER_API_KEY="your_openweather_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENWEATHER_API_KEY="your_openweather_api_key_here"
4
Run the example
Save the code above as
weather_agent.py, then run:python weather_agent.py