finance_agent.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your API keys
4
Run the example
Save the code above as
finance_agent.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Compares built-in chain-of-thought with a deepseek-reasoner reasoning model on gpt-4o YFinance agents writing an NVDA vs TSLA report.
"""
Reasoning Finance Agent
=======================
Demonstrates DeepSeek-backed reasoning with tools for financial reporting.
"""
from agno.agent import Agent
from agno.models.deepseek import DeepSeek
from agno.models.openai import OpenAIResponses
from agno.tools.yfinance import YFinanceTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
model=OpenAIResponses(id="gpt-5.6"),
tools=[YFinanceTools()],
instructions=["Use tables where possible"],
reasoning_model=DeepSeek(id="deepseek-reasoner"),
markdown=True,
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent.print_response(
"Write a report comparing NVDA to TSLA",
stream=True,
show_full_reasoning=True,
)
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno openai yfinance
Export your API keys
export DEEPSEEK_API_KEY="your_deepseek_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:DEEPSEEK_API_KEY="your_deepseek_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run the example
finance_agent.py, then run:python finance_agent.py