Multi-Agent BODMAS Calculation Engine
A production-grade, highly resilient calculation engine using LangChain, LangGraph, and FastMCP with full Langfuse observability.
Overview
This system evaluates raw string mathematical expressions (e.g., 10 รท (3 + 2)) using a state-reduction loop powered by 5 independent agents (Planner, Adder, Subtractor, Multiplier, Divider). It uses a local Ollama endpoint by default, with graceful fallbacks to OpenAI or Anthropic API providers.
System Prerequisites
- Python 3.10+
- Docker & Docker Compose (for PostgreSQL & Langfuse)
- Optional: Local Ollama instance running
Quick Execution Recipe
- Clone the repository.
- Setup virtual environment:
python -m venv venv source venv/bin/activate pip install -r requirements.txt - Configure Environment:
cp .env.example .env # Edit .env with your specific API keys if not using Ollama - Boot Infrastructure (Langfuse & PostgreSQL):
docker-compose up -d - Run the MCP Server:
./scripts/run_mcp.sh
Telemetry Trace Navigation
All executions are traced via Langfuse.
- Open http://localhost:3000
- Login and view the generated traces to see exactly how the multi-agent graph evaluated your mathematical expressions step-by-step.