An AI-powered expense management application built with Python, LangGraph, LangChain, FastAPI, Streamlit, SQLite, Docker, GitHub Actions, and Render.
The project demonstrates how to take an LLM-based tool-calling application from local development to a containerized, CI/CD-enabled deployment.
- Add expenses using natural language
- Retrieve a specific expense by ID
- List all expenses for the current user
- Generate expense summaries by category
- Delete expenses with a human confirmation step
- Persistent conversation state using LangGraph checkpoints
- User-scoped expense data
- LLM tool calling with LangGraph
- FastAPI backend
- Streamlit frontend
- SQLite database for the learning/project implementation
- Docker containerization
- GitHub Actions CI/CD
- Render deployment configuration
- Environment-variable based API configuration
โโโโโโโโโโโโโโโโโโโโโโโโ
โ User โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Streamlit Frontend โ
โ streamlit.py โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ HTTP POST /chat
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Backend โ
โ allinone.py โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ LangGraph โ
โ Agent Workflow โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโผโโโโโโโโโโโโ
โ LLM โ
โ Tool Calling โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
Add Expense Get Expense List Expenses
โ โ โ
โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโ
โ SQLite โ
โ expenses โ
โโโโโโโโโโโโโ
Delete Flow
โ
โผ
Human Approval
โ
โโโโโโโดโโโโโโ
Yes No
โ โ
โผ โผ
Delete Cancel
- Python
- FastAPI
- LangGraph
- LangChain
- Pydantic
- SQLite
- aiosqlite
- LLM API through LangChain
- Tool calling
- Structured tool execution
- Human-in-the-loop workflow for deletion
- Streamlit
- Python
requests
- Docker
- Docker Hub
- GitHub Actions
- Render
- CI/CD
.
โโโ allinone.py
โโโ streamlit.py
โโโ Dockerfile
โโโ Dockerfile.backend
โโโ render.yaml
โโโ requirements.txt
โโโ .gitignore
โโโ .github/
โ โโโ workflows/
โ โโโ ci.yml
โโโ LanggraphExpenseAgent.ipynb
allinone.py
Contains the FastAPI backend, LangGraph agent, tools, database functions, checkpointing, and API endpoint.
streamlit.py
Provides the chat-based frontend and sends requests to the FastAPI backend.
Dockerfile
Defines the container image used for deployment.
render.yaml
Contains the Render deployment configuration.
.github/workflows/ci.yml
Defines the GitHub Actions CI/CD workflow.
requirements.txt
Contains the Python dependencies required by the application.
The agent currently exposes five tools:
add_expense_toolget_expense_toolget_summary_tooldelete_expense_toollist_all_expenses_tool
The system prompt instructs the LLM to select the appropriate tool based on the user's request.
For example:
User: Show me all my expenses
โ
list_all_expenses_tool
โ
SQLite query
โ
Expense records
โ
LLM response
While:
User: Show me my food spending
โ
get_summary_tool
โ
SQLite aggregation
โ
Summary
The project currently uses SQLite:
expenses.db
The expense table contains:
expense_id
user_id
amount
category
description
date
SQLite was intentionally used as a lightweight database for this project and learning environment.
For a larger production system, the database layer can later be migrated to a server-based relational database such as PostgreSQL without changing the overall agent architecture.
The application uses a graph-based workflow:
START
โ
โผ
LLM
โ
โโโ No tool call โโโโโโโโโโโโโโโโบ END
โ
โโโ Tool call
โ
โผ
Tools
โ
โผ
LLM
Deletion has an additional human-approval flow:
User requests deletion
โ
โผ
delete_expense_tool
โ
โผ
Confirm with user
โ
โโโโดโโโ
Yes No
โ โ
โผ โผ
Delete Cancel
LangGraph checkpointing is used to maintain conversation/workflow state.
git clone <your-repository-url>
cd Expense-Tracker-AI-Agent-using-Langgraph-Tool-CallingWindows:
python -m venv .venv
.venv\Scripts\activateLinux/macOS:
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtuvicorn allinone:app --reloadThe backend runs on:
http://127.0.0.1:8000
In another terminal:
streamlit run streamlit.pyThe frontend will normally be available at:
http://localhost:8501
The Streamlit application reads the backend URL from:
API_URLThe application is containerized with Docker.
Build the image:
docker build -t mahady13/expense_tracker_ai_agent .Run it:
docker run -p 8502:8502 mahady13/expense_tracker_ai_agentThe image is published to Docker Hub under:
mahady13/expense_tracker_ai_agent
This project uses GitHub Actions + Docker Hub + Render to automate deployment.
High-level pipeline:
Developer
โ
โผ
Git push
โ
โผ
GitHub Repository
โ
โผ
GitHub Actions
โ
โโโ Install dependencies
โโโ Run CI checks
โโโ Build Docker image
โโโ Push image to Docker Hub
โ
โผ
Docker Hub
โ
โผ
Render
โ
โผ
Deployed App
The workflow configuration is located at:
.github/workflows/ci.yml
Render deployment configuration is located at:
render.yaml
This means changes can be pushed to GitHub and processed automatically instead of manually rebuilding and deploying every change.
The application is designed to use:
- GitHub for source control
- GitHub Actions for automation
- Docker Hub for container images
- Render for cloud deployment
Secrets such as API keys should be configured through the deployment platform's environment-variable/secrets settings rather than committed to the repository.
User:
Show me all my expenses
Assistant:
ID Date Category Description Amount
1 2025-08-14 Food Burger 200.00
2 2026-08-08 Food Tea 30.00
3 2026-08-08 Food Coffee 25.00
...
Other supported requests include:
Add 50 BDT for lunch today
Show me expense ID 3
Show my food expense summary
Delete expense ID 2
Deletion requires confirmation before the record is removed.
This project was built as a practical learning implementation of production-oriented AI engineering concepts:
- LLM application architecture
- Agentic workflows
- LangGraph state management
- Tool calling
- RAG/AI-system development foundations
- REST API development
- Database interaction
- Human-in-the-loop controls
- Containerization
- Environment-based configuration
- CI/CD automation
- Cloud deployment
- Debugging local-vs-cloud deployment issues
The implementation intentionally starts with simple infrastructure so the core engineering concepts can be understood before introducing more complex infrastructure.
Possible next steps include:
- Replace SQLite with PostgreSQL
- Add authentication and proper user management
- Add automated unit/integration tests
- Add API validation and structured error handling
- Add production logging and observability
- Add database migrations
- Add Redis or another production-grade state/cache layer where appropriate
- Add stronger security controls
- Add automated deployment approvals
- Add monitoring and health checks
- Improve agent evaluation and tool-call reliability
Mohiuddin Mahady
Built as a hands-on AI engineering and DevOps project focused on learning how to move an LLM-powered application from local development toward production-style deployment.