market_brief.py
"""
Market Brief with FinanceTools
==============================
The simplest finance agent: one toolkit, no API key.
`FinanceTools()` defaults to the Yahoo Finance provider (via `yfinance`) and
registers the seven "market brief" tools: search_symbols, get_quote,
get_price_history, get_company_profile, get_key_metrics, get_news and
get_analyst_recommendations. Every tool returns the same JSON shape no matter
which provider is behind it, so the agent code never changes when you swap
providers (see 03_swap_provider.py).
Prompts to try:
- "Give me a market brief on NVIDIA"
- "How has AMD traded over the last 3 months?"
- "What do analysts think about Tesla right now?"
Run: pip install yfinance
"""
from agno.agent import Agent
from agno.tools.finance import FinanceTools
# ---------------------------------------------------------------------------
# Create the Agent
# ---------------------------------------------------------------------------
agent = Agent(
name="Finance Agent",
model="openai:gpt-5.6",
tools=[FinanceTools()],
instructions="Lead with the answer, then show the evidence.",
markdown=True,
)
# ---------------------------------------------------------------------------
# Run the Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent.print_response("Give me a market brief on NVIDIA", stream=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 yfinance
3
Export your API keys
export FINANCIAL_DATASETS_API_KEY="your_financial_datasets_api_key_here"
$Env:FINANCIAL_DATASETS_API_KEY="your_financial_datasets_api_key_here"
4
Run the example
Save the code above as
market_brief.py, then run:python market_brief.py