What it does
This agent acts as a personal financial coach through a command-line interface. Users can:- Ask questions about their spending in natural language
- Get breakdowns by category, merchant, or time period
- Receive personalized recommendations and savings opportunities
- Have multi-turn conversations with conversation memory
Architecture
The agent uses a 4-node LangGraph workflow:- Enrich query - Adds context about time period, categories, and merchants
- Query Snow Leopard - Converts natural language to SQL and retrieves data
- Analyze and coach - Generates insights, recommendations, and follow-up questions
- Format response - Creates formatted CLI output with Rich
Key components
- LangGraph orchestrates the multi-step workflow
- Snow Leopard handles natural language to SQL conversion
- Coaching analyzer generates personalized financial insights
- Memory manager maintains conversation context across turns
- Rich CLI provides formatted terminal output
Run the example
Prerequisites
- Python 3.10+
- OpenAI API key
- A Snow Leopard Cloud instance and API key
- A PostgreSQL database that Snow Leopard Cloud can reach, such as a free Neon or Supabase database. See the PostgreSQL setup guide for details.
The example includes
data/finance_coach.sql, a sample dataset built from the Kaggle Personal Finance dataset that covers January 2018 through September 2019. You can also use your own transaction data.Setup
Clone the repository:.env file:
Example queries
The sample data covers January 2018 through September 2019, so ask about those months rather than “this month”.- “Show me my spending by category”
- “Which merchants did I spend the most at?”
- “Compare March 2019 vs February 2019”
- “How much did I spend on groceries?”
Next steps
- View the full source code on GitHub
- Learn more about LangGraph
- Explore the LangGraph quickstart