Intent router to specialists
A fast, cheap classifier routes each request to one narrow specialist agent.
Read the pattern →This is the companion to the failure-mode field guide. That guide shows what breaks. This library shows how to build so it does not. Each pattern has trade-offs and signals to measure.
A fast, cheap classifier routes each request to one narrow specialist agent.
Read the pattern →A bounded agent loop runs under an explicit step budget and token ceiling.
Read the pattern →Chunk boundaries follow the document's own structure, such as headings and table rows.
Read the pattern →A cheap first pass pulls 50 to 100 candidate documents.
Read the pattern →The ingest pipeline subscribes to change events from the source system.
Read the pattern →A strict JSON schema defines every tool argument.
Read the pattern →Each tool gets the narrowest permission its task needs.
Read the pattern →A fixed set of human-labelled real cases runs in CI on every prompt or model change.
Read the pattern →One trace ID follows a single request across every hop, from retrieval to each model call and tool call.
Read the pattern →A cheap, fast model tries every request first.
Read the pattern →Put invariant content first in the prompt and per-request content last, so the shared prefix stays byte-identical and the cache hits.
Read the pattern →No patterns match that filter yet.
The questions that come up before a team decides which patterns to adopt and which to skip.
The failure-mode field guide is diagnostic. It starts from a symptom you already have and works backward to a root cause and a fix. This library is prescriptive. It starts from an architectural decision you make before anything breaks. The cross-reference table above links the two. Every failure mode traces to at least one pattern that prevents it.
Link to this answer: How is this different from the failure-mode field guide?No. Most systems need three or four of these patterns. Every entry has an explicit "don't use it when" section for this reason. A pattern your system does not need adds complexity debt. Start from the failure mode you are most exposed to and work from there.
Link to this answer: Do I need all of these?No. Every pattern here is an architectural decision, such as a routing layer or a schema. A caching order or a CI gate qualifies too. These decisions hold up whether the model behind them is a frontier API or a self-hosted open-weight model. See our take on staying model-agnostic by design.
Link to this answer: Are these specific to one model provider?A Ship Audit tells you which of these patterns your system lacks. It ranks them by what is most likely to break first.
Source: https://customlabs.io/patterns/