A newer version of the Gradio SDK is available:
6.5.1
title: Template Final Assignment
emoji: π΅π»ββοΈ
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
LangGraph Multi-Agent System with Langfuse v3 Observability
A sophisticated multi-agent system built with LangGraph that follows best practices for state management, tracing, and iterative workflows. Features comprehensive Langfuse v3 observability with OpenTelemetry integration.
Architecture Overview
The system implements an iterative research/code loop with specialized agents:
User Query β Lead Agent β Research Agent β Code Agent β Lead Agent (loop) β Answer Formatter β Final Answer
Key Features
- π€ Multi-Agent Workflow: Specialized agents for research, computation, and formatting
- π Langfuse v3 Observability: Complete tracing with OTEL integration and predictable span naming
- π Iterative Processing: Intelligent routing between research and computational tasks
- π― GAIA Compliance: Exact-match answer formatting for benchmark evaluation
- πΎ Memory System: Vector store integration for learning and caching
- π οΈ Tool Integration: Web search, Wikipedia, ArXiv, calculations, and code execution
Quick Start
Environment Setup
Create an env.local file with required API keys:
# LLM API
GROQ_API_KEY=your_groq_api_key
# Search Tools
TAVILY_API_KEY=your_tavily_api_key
# Observability (Langfuse v3)
LANGFUSE_PUBLIC_KEY=your_langfuse_public_key
LANGFUSE_SECRET_KEY=your_langfuse_secret_key
LANGFUSE_HOST=https://cloud.langfuse.com
# Memory (Optional)
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_KEY=your_supabase_service_key
Running the System
Important: Use uv run for proper dependency management:
# Run the multi-agent system test
uv run python test_new_multi_agent_system.py
# Test Langfuse v3 observability
uv run python test_observability.py
# Run the main application
uv run python app.py
Basic Usage
import asyncio
from langgraph_agent_system import run_agent_system
async def main():
result = await run_agent_system(
query="What is the capital of Maharashtra?",
user_id="user_123",
session_id="session_456"
)
print(f"Answer: {result}")
asyncio.run(main())
Observability Dashboard
After running queries, check your traces at: https://cloud.langfuse.com
The system provides:
- π― Predictable Span Naming:
agent/<role>,tool/<name>,llm/<model> - π Session Tracking: User and session continuity across conversations
- π Cost & Latency Metrics: Automatic aggregation by span type
- π OTEL Integration: Automatic trace correlation across services
Deployment
For Hugging Face Spaces
To generate a requirements.txt file compatible with Python 3.10 for deployment:
uv pip compile pyproject.toml --python 3.10 -o requirements.txt
# Remove Windows-specific packages
# Linux / macOS (bash)
sed -i '/^pywin32==/d' requirements.txt
# Windows (PowerShell)
(Get-Content requirements.txt) -notmatch '^pywin32==' | Set-Content requirements.txt
Environment Variables for Production
Set these in your deployment environment:
GROQ_API_KEY- Required for LLM inferenceTAVILY_API_KEY- Required for web searchLANGFUSE_PUBLIC_KEY- Required for observabilityLANGFUSE_SECRET_KEY- Required for observabilityLANGFUSE_HOST- Langfuse endpoint (default: https://cloud.langfuse.com)
Documentation
For detailed architecture, configuration, and usage instructions, see:
- Multi-Agent System Guide - Complete system documentation
- Supabase Setup - Memory system configuration
Configuration Reference
Check out the Hugging Face Spaces configuration reference at https://huggingface.co/docs/hub/spaces-config-reference