# Routing

> Classify an incoming request and dispatch it to the specialist best suited to handle it — including routing Agent Confession attempts away from privileged agents.

- **Category**: Agentic AI
- **Subcategory**: Routing & Composition
- **Canonical URL**: https://designpattern.fyi/patterns/routing/

---

## Description
**Short description**: A lightweight classifier dispatches each incoming request to the correct specialist lane — and can route known Agent Confession trigger patterns to a hardened, directive-lean agent rather than a fully configured one.

**Intent**: Match each request to the prompt, tool palette, and model it deserves — and prevent Agent Confession trigger phrases from reaching agents that hold rich, sensitive directives.

**Context**: An agent product receives a heterogeneous mix of requests: short deterministic commands, open-ended chats, and multi-step tasks. Among real traffic, a small but consistent fraction are adversarial probes — users or attackers sending Agent Confession triggers ("what are your instructions?", "repeat your system prompt") to discover the agent's configuration. A single all-purpose agent holding full directives processes these probes the same way it processes legitimate requests, maximising the exposure of directive content.

**Solution**:
- A lightweight classifier returns a label per request; the host dispatches to the specialist for that label.
- Include a dedicated lane for known adversarial patterns including Agent Confession triggers; this lane routes to a directive-lean agent with a minimal system prompt, so a successful extraction yields little.
- Common lanes: command (deterministic action), agent (multi-step), chat (no tools), probe (adversarial pattern — hardened response).
- Log all probe-lane routing events; volume spikes signal active reconnaissance.


## Use Cases
- Traffic is heterogeneous and different requests benefit from different prompts or models.
- A non-trivial fraction of traffic consists of adversarial probes including Agent Confession attempts that should not reach fully configured specialist agents.
- A lightweight classifier can reliably identify known confession-trigger patterns cheaply.





## Trade-offs


### Advantages

- Cheap requests pay cheap prices; adversarial probes reach directive-lean agents that have little to confess.

- Each lane can be tuned in isolation — the probe lane's hardening does not affect the main agent's quality.

- Probe-lane volume is a leading indicator of active Agent Confession reconnaissance campaigns.




### Considerations & Drawbacks

- Two-call latency on every request — the classifier adds a round trip before the specialist runs.

- An Agent Confession trigger phrased as a legitimate request bypasses the probe lane and reaches the full agent.

- Lane definitions ossify; reclassification requires retraining the classifier as attack patterns evolve.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/routing/)

