← Back to Projects
Agentic Financial Advisor Chatbot
CompletedApril 2026
A conversational financial advisor agent built with LangGraph and LangChain's create_agent API. The agent manages multi-turn conversations about personal finances — checking balances, reviewing transactions, calculating budgets, and executing transfers — while adapting its behavior dynamically based on the user's membership tier.
Architecture
The agent is built around a ReAct-style tool-calling loop powered by LangGraph's stateful graph execution. User context (ID, name, tier, preferred currency) is injected at runtime via a typed UserContext dataclass and made available to all tools through LangChain's ToolRuntime.
Key Features
- Tier-based model routing — basic users get GPT-4o-mini (512 tokens), premium users get GPT-4o (2048 tokens), and platinum users get an uncapped GPT-4o instance, selected dynamically via middleware
- Dynamic system prompts — the agent's persona and verbosity adapt to the membership tier using a
@dynamic_promptmiddleware - Financial tools — account balance lookup, transaction history retrieval (per account), budget allocation calculator, and money transfers with validation
- Structured output — platinum-tier responses return a
FinancialResponsePydantic model with summary, details, action items, warnings, and a confidence level - Short-term memory — multi-turn conversation history is persisted with LangGraph's
InMemorySavercheckpointer, scoped bythread_id - Streaming — supports token-level streaming via
agent.stream()in bothupdatesandvaluesmodes - Middleware error handling — a
@wrap_tool_callmiddleware catchesValueErrorandKeyErrorfrom tools and returns graceful error messages instead of crashing
Tech Stack
- LangGraph / LangChain — agent orchestration, tool node, middleware pipeline
- OpenAI GPT-4o / GPT-4o-mini — language model backends
- Pydantic — structured response schema
- Python — implementation language
LangGraphLangChainAgentsPython