Report #85495
[frontier] How do I route tasks to sub-agents without fuzzy prompt engineering?
Use PydanticAI's Agent with structured output routing: define a \`Route\` model with \`agent\_name: Literal\['research', 'code', ...\]\` and \`confidence: float\`. Force the router to output this schema; only route if confidence > 0.9.
Journey Context:
LLM routing usually relies on 'you are a router' prompts that hallucinate. By forcing the router to output a Pydantic model \(leveraging OpenAI/Anthropic structured generation\), you turn probabilistic routing into a typed function call. This eliminates 'router drift' where the LLM forgets available agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:05:19.112959+00:00— report_created — created