How Routing Works
The Router uses a specialized LLM-powered “routing agent” that evaluates incoming alerts against each agent’s description. This process happens automatically when:- An alert arrives at the webhook endpoint (when running
unpage agent serve
) - You manually test routing with
unpage agent route
The Routing Process
When an alert is received, the Router follows these steps:- Extract alert information: Parse the incoming payload to understand what the alert is about
- Gather agent descriptions: Collect the descriptions from all available agents
- LLM-based evaluation: Use an LLM to analyze the alert against each agent’s description criteria
- Select best match: Choose the agent whose description best matches the alert context
- Execute selected agent: Pass the alert to the chosen agent for analysis and response
- When an alert clearly matches a single agent’s description, the Router directs it to that agent.
- When multiple agents might handle an alert, the Router selects the one with the most specific matching criteria.
- When no agent description clearly matches, the Router selects the default agent (if configured) or the most general-purpose agent.
The Agent Description
The key to effective routing is well-written agent descriptions. Each agent’s YAML configuration includes adescription
field that defines when that agent should be used:
Writing Effective Descriptions
To ensure accurate routing, follow these best practices for agent descriptions:- Be specific about the types of alerts the agent should handle
- Include distinguishing characteristics that differentiate this alert type
- Mention source systems like “AWS CloudWatch” or “Datadog”
- Reference affected resources such as “EC2 instances” or “RDS databases”
- List alert patterns using bullet points for clarity
Testing the Router
You can test how the Router would handle specific alerts using theroute
command:
--debug
flag provides additional insight into why the Router selected a particular agent.
Default Agent
If no agent’s description sufficiently matches the incoming alert, the Router falls back to a default agent. The default agent has the following description:Best Practices
To get the most out of the Router:- Create specialized agents rather than general-purpose ones
- Write clear, specific descriptions for each agent
- Test routing with sample payloads to verify correct agent selection
- Refine descriptions based on routing results
- Include a default agent to handle unexpected alerts