Overview
The GAIA Routing Agent provides intelligent request analysis and agent selection through conversational disambiguation. When you make a request like “Create a todo backend app,” the routing agent analyzes your query, detects the target programming language and project type, and routes you to the appropriate specialized agent with the correct configuration. Key Features:- Intelligent Language Detection: Automatically identifies TypeScript, Python, and other languages from framework mentions
- Conversational Disambiguation: Asks clarifying questions when the request is ambiguous
- Context-Aware Analysis: Maintains conversation history across disambiguation rounds
- High-Confidence Routing: Only proceeds when confident about the detected configuration
Why We Built the Routing Agent
Before the routing agent, GAIA agents would attempt to detect language and project type internally, often leading to:- Incorrect Language Selection: Generic requests like “Create a REST API” would default to Python, even when the user wanted TypeScript/Express
- Guessing Behavior: Agents would make assumptions based on “commonly used” frameworks rather than asking for clarification
- Poor User Experience: Users had to be very specific with framework names to get the right agent configuration
- Separating routing concerns from agent logic
- Using LLM-powered analysis to detect language/framework from natural language
- Asking users for clarification when uncertain, rather than guessing
- Providing a consistent routing experience across all agents (currently used for
gaia code, with plans to expand)
How It Works
- Analyzes the user’s request using an LLM
- Detects programming language (TypeScript, Python) and project type (frontend, backend, fullstack)
- Checks confidence level (must be ≥0.9 to proceed)
- If uncertain, asks a clarifying question
- Incorporates the user’s response into the conversation history
- Re-analyzes with the enriched context
- Once confident, creates the specialized agent with the correct configuration
Quick Start
The routing agent is automatically used when you run certain GAIA commands:Language Detection Rules
The routing agent uses the following rules for language detection: TypeScript Indicators:- Express, NestJS, Koa, Fastify
- MongoDB, Mongoose (with Express/Node.js context) - routes to Express + SQLite template
- React, Vue, Angular, Svelte, Next.js
- Node.js, Vite, Webpack
- Django, Flask, FastAPI
- Pandas, NumPy, SciPy
- Generic terms without framework: “API”, “backend”, “REST”, “todo”, “CRUD”
- Confidence level below 0.9 (LLM is uncertain)
Project Type Detection
Frontend:- React, Vue, Angular components
- Dashboard, UI, webpage, website
- Express, API, REST endpoints
- Backend, server, database operations
- Both frontend and backend mentioned
- CLI tool, calculator, utility script
Example Interactions
High-Confidence Detection (No Questions)
Conversational Disambiguation
Multiple Disambiguation Rounds
Configuration
The routing agent can be configured via environment variables:.env file for persistent configuration.
Current Usage
The routing agent is currently integrated with:gaia code: Intelligently routes to Python or TypeScript CodeAgent based on framework detection
gaia docker: Route to appropriate containerization strategygaia jira: Route to different Jira workflows based on request type- Other agents as needed
Troubleshooting
Routing to Wrong Language
Issue: The routing agent detects the wrong language/framework. Solution:- Be more specific in your request: “Create an Express API” instead of “Create an API”
- When prompted, provide clear framework names: “Express”, “Django”, “React”
- Check that you’re using recognized framework names (see Language Detection Rules)
Too Many Questions
Issue: The routing agent asks too many clarifying questions. Solution:- Include framework/language in your initial request
- Use specific terms like “Express backend” or “React dashboard”
- Example: “Create a Django REST API” (no questions needed)
Routing Agent Not Working
Issue: Routing agent errors or skips detection. Solution:Low Confidence / Always Asks Questions
Issue: Even with specific frameworks, routing agent asks for clarification. Solution:- Check the routing model is loaded:
AGENT_ROUTING_MODEL=Qwen3-Coder-30B-A3B-Instruct-GGUF - Verify Lemonade server has sufficient context size:
--ctx-size 32768 - Ensure the coding model is available in Lemonade’s model list
Technical Details
For implementation details, see:- Source code:
src/gaia/agents/routing/agent.py - System prompt:
src/gaia/agents/routing/system_prompt.py - CLI integration:
src/gaia/cli.py(search for “RoutingAgent”)
See Also
- Code Agent Documentation - Autonomous Python/TypeScript development
- CLI Guide - Command line interface reference
- API Server Documentation - OpenAI-compatible API with routing
- Development Guide - Setup and contribution guidelines