AI-powered multi-agent calculation service. A full-stack application where LLM agents collaborate through a LangGraph StateGraph to execute arithmetic operations on user-created number pairs, with real-time telemetry visualization.
This project serves as a foundational framework designed to be extended with additional capabilities such as new agent types, hybrid RAG pipelines, expanded tooling, and richer UI features. The modular architecture — separable frontend/backend, pluggable LangGraph nodes, and per-directory deployment — makes it straightforward to layer on new functionality without reworking the core.
Frontend (Next.js 16) Backend (FastAPI + LangGraph) Storage (DynamoDB)
┌──────────────────┐ ┌───────────────────────────┐ ┌──────────────┐
│ Auth Views │ HTTP/JWT │ /api/v1/auth/* │ │ Users Table │
│ Dashboard │ ────────► │ /api/v1/pairs/* │ ───────► │ Pairs Table │
│ Pair Operations │ │ │ │ Logs Table │
│ Agent Timeline │ │ Agent Graph: │ └──────────────┘
└──────────────────┘ │ orchestrator → execution │
│ → verification → response│
└───────────────────────────┘
Each operation runs through a 4-node LangGraph StateGraph:
- Orchestrator — Plans the operation and determines execution strategy
- Execution — Runs the math operation via tool calls (add, subtract, multiply, divide)
- Verification — Validates the result matches expected output
- Response — Formats the final result for display
Per-node timing is captured and stored as telemetry, viewable in the frontend timeline.
DeepThought/
├── backend/
│ ├── src/deepthought/
│ │ ├── agents/ # LangGraph graph, nodes, edges, prompts
│ │ ├── api/ # FastAPI app factory, routes, auth, dependencies
│ │ ├── config/ # Pydantic Settings (.env support)
│ │ ├── db/ # Async DynamoDB client (aioboto3)
│ │ ├── llm/ # LLM provider factory (Google Gemini)
│ │ ├── models/ # Pydantic v2 models
│ │ └── tools/ # LangChain @tool functions (math, verification, formatting)
│ ├── tests/
│ │ ├── unit/ # Unit tests (209 tests)
│ │ └── integration/ # API flow tests (25 tests)
│ ├── scripts/ # DynamoDB and Pinecone setup scripts
│ ├── documentation/ # Design docs
│ ├── Dockerfile
│ └── pyproject.toml
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js App Router pages
│ │ ├── components/ # UI, layout, auth, pairs, telemetry components
│ │ ├── contexts/ # Auth context (JWT + localStorage)
│ │ ├── hooks/ # useAuth, usePairs, useOperations (React Query)
│ │ └── lib/ # Axios API client, TypeScript types
│ ├── Dockerfile
│ └── package.json
├── docker-compose.yml
├── Makefile
└── CLAUDE.md
- Python 3.11+
- Node.js 20+
- Docker & Docker Compose
make install # Install both backend and frontend dependencies
make install-backend # Backend only (pip install into .venv)
make install-frontend # Frontend only (npm install)cp backend/.env.example backend/.env # Fill in required values
cp frontend/.env.example frontend/.env # Set NEXT_PUBLIC_API_URLmake up # Build and start all services (frontend, backend, DynamoDB, setup-dynamo)
make down # Stop all servicesmake dev # Start DynamoDB + setup-dynamo + backend + frontend dev servers
make dev-backend # Backend only (with DynamoDB + setup-dynamo)
make dev-frontend # Frontend onlymake database # Start DynamoDB Local (port 8000) + Admin GUI (port 8001)
make setup-dynamo # Create DynamoDB tables (starts DynamoDB if needed)When running with make up or make dev, the following services are available:
| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3000 | Next.js application |
| Backend API | http://localhost:8080 | FastAPI server |
| API Docs (Swagger) | http://localhost:8080/docs | Interactive API documentation |
| DynamoDB Local | http://localhost:8000 | Local DynamoDB instance |
| DynamoDB Admin | http://localhost:8001 | DynamoDB table browser GUI |
make test # Run all tests (backend + frontend)
make test-backend # Backend pytest (unit + integration)
make test-frontend # Frontend build checkcd backend
.venv/bin/pytest tests/unit/ # Unit tests only
.venv/bin/pytest tests/integration/ # Integration tests only
.venv/bin/pytest --cov=src/deepthought # With coveragemake lint # ruff check + ruff format + mypy| Variable | Description |
|---|---|
LLM_MODEL |
Google Gemini model name (e.g. gemini-2.0-flash) |
GOOGLE_API_KEY |
Google API key |
AWS_REGION |
AWS region |
AWS_ACCESS_KEY_ID |
AWS access key |
AWS_SECRET_ACCESS_KEY |
AWS secret key |
DYNAMODB_ENDPOINT_URL |
DynamoDB endpoint (e.g. http://localhost:8000) |
DYNAMODB_USERS_TABLE |
Users table name |
DYNAMODB_PAIRS_TABLE |
Pairs table name |
DYNAMODB_LOGS_TABLE |
Logs table name |
JWT_SECRET_KEY |
Secret key for JWT signing |
CORS_ORIGINS |
Comma-separated allowed origins |
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_URL |
Backend API base URL (e.g. http://localhost:8080/api/v1) |
Backend: Python 3.11, FastAPI, LangGraph, LangChain, Google Gemini, DynamoDB (aioboto3), Pydantic v2, bcrypt + python-jose (JWT)
Frontend: Next.js 16, TypeScript, Tailwind CSS 4, React Query, Axios, Lucide Icons, next-themes
Infrastructure: Docker Compose, DynamoDB Local, Makefile