WhatsApp agent with advanced reasoning and financial analysis capabilities
from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.models.anthropic.claude import Claude from agno.os.app import AgentOS from agno.os.interfaces.whatsapp import Whatsapp from agno.tools.thinking import ThinkingTools from agno.tools.yfinance import YFinanceTools agent_db = SqliteDb(db_file="tmp/persistent_memory.db") reasoning_finance_agent = Agent( name="Reasoning Finance Agent", model=Claude(id="claude-3-7-sonnet-latest"), db=agent_db, tools=[ ThinkingTools(add_instructions=True), YFinanceTools( stock_price=True, analyst_recommendations=True, company_info=True, company_news=True, ), ], instructions="Use tables to display data. When you use thinking tools, keep the thinking brief.", add_datetime_to_context=True, markdown=True, ) agent_os = AgentOS( agents=[reasoning_finance_agent], interfaces=[Whatsapp(agent=reasoning_finance_agent)], ) app = agent_os.get_app() if __name__ == "__main__": agent_os.serve(app="reasoning_agent:app", reload=True)
Create a virtual environment
Terminal
python3 -m venv .venv source .venv/bin/activate
Set Environment Variables
export WHATSAPP_ACCESS_TOKEN=your_whatsapp_access_token export WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id export WHATSAPP_WEBHOOK_URL=your_webhook_url export WHATSAPP_VERIFY_TOKEN=your_verify_token export ANTHROPIC_API_KEY=your_anthropic_api_key export APP_ENV=development
Install libraries
pip install -U agno yfinance
Run Example
python cookbook/os/interfaces/whatsapp/reasoning_agent.py