Agent with Tools
Investment analyst agent with financial tools served over the A2A protocol
Code
from agno.agent.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
tools=[
YFinanceTools(enable_stock_price=True, enable_analyst_recommendations=True, enable_company_info=True),
],
description="You are an investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
instructions="Format your response using markdown and use tables to display data where possible.",
)
agent_os = AgentOS(
agents=[agent],
a2a_interface=True,
)
app = agent_os.get_app()
if __name__ == "__main__":
agent_os.serve(app="a2a_agent_with_tools:app", reload=True)Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateSet Environment Variables
export OPENAI_API_KEY=your_openai_api_keyInstall dependencies
uv pip install -U "agno[os,a2a]" openai yfinanceRun Example
python a2a_agent_with_tools.pyKey Features
- Financial Data Tools: Real-time stock prices, analyst recommendations, and company info
- Investment Analysis: Comprehensive company analysis and recommendations
- Data Visualization: Tables and formatted financial information
- A2A Endpoints: Serves the protocol routes
POST /a2a/agents/{id}/v1/message:sendandmessage:stream