🎯 System Architecture
�� Supervisor Agent
Orchestrates the workflow, makes routing decisions, and coordinates between specialized agents
🔍 Query Expander Agent
Expands abbreviations, clarifies ambiguous queries, and provides contextual recommendations
💾 SQL Agent
Generates optimized SQL queries, executes them safely, and provides intelligent summaries
🔌 API Endpoints
POST /query
Main endpoint for processing legal billing queries
{
"question": "Show me timekeepers with utilization above 80%",
"firm_id": "your_firm_id",
"user_name": "optional_user_name",
"timekeeper_id": "optional_timekeeper_id"
}
Streaming: Add ?stream=true to enable real-time streaming
GET /health
System health check and status information
GET /agents/status
Detailed status of all agents in the system
POST /convert-filter
Convert natural language queries to structured database filters
{
"query": "List my matters with realization > 70%",
"stub": {
"listing": "matters",
"user": "vivek-admin",
"timekeeperId": "e48a008f-a68d-5eac-b1c5-d3680bc33785",
"firmId": "7f09f939-8bae-4d4a-9e45-6096d93dae00"
}
}
�� Example Queries
- "Show me my utilization for this quarter"
- "Pepsi matters with realization under 70%"
- "Billing attorneys with the highest rates"
- "Partners with low utilization rates"
- "Exception rates by practice group"
🔍 Example Filter Queries
- "List my matters with realization > 70%"
- "Show clients with exceptions"
- "Active users in New York office"
- "Rate sets for client ABC Corp"
- "Matters handled by Robert Bailey"
🔧 Features
- ✅ Intelligent query expansion and clarification
- ✅ Safe SQL generation with custom training data
- ✅ Multi-agent workflow orchestration with LangGraph
- ✅ Real-time database connection pooling
- ✅ AI-powered result summarization
- ✅ Context-aware recommendations
- ✅ Comprehensive error handling and fallbacks
- ✅ Automatic session management (internal)
- ✅ Real-time streaming with workflow progress