Skip to content

Routing

Read · 1 of 2

Specialists beat generalists

One agent with fifty tools and a giant prompt gets confused. Several small specialists (billing, tech support, sales), each with a few tools and a focused prompt, each do their job better.

A router sits in front and decides who handles each request. Routers are often a cheap model or plain code, and they need a sensible fallback when nothing matches.

Read this lesson as text

Send each request to the specialist that fits it best.

Specialists beat generalists

One agent with fifty tools and a giant prompt gets confused. Several small specialists (billing, tech support, sales), each with a few tools and a focused prompt, each do their job better.

A router sits in front and decides who handles each request. Routers are often a cheap model or plain code, and they need a sensible fallback when nothing matches.

Exercise: A router

Input: m, then m specialists name: keyword keyword …, then n, then n messages.

Score each specialist by how many of its keywords appear as words in the (lower-cased) message, ignoring .,?!. Route to the highest score; on a tie or a score of 0, route to general.

Print the route for each message.