10 Composing patterns: From map to terrain
This chapter covers
- Diagnosing a task failure and comparing a small set of pattern candidates
- Following task, state, authority, and evidence across pattern seams
- Reusing pattern interfaces while supplying domain-specific adapters
- Testing a general-agent baseline before adding patterns
- Recording a composition as a testable, removable architecture decision
"The map is not the territory."
— Alfred Korzybski, Science and Sanity [1]
In an enterprise SaaS system, a salary-configuration task required the agent to find a template and pass its identifier to a later import call. Bo Liang, an architect and ADPS co-founder, found that the model could choose the right tools in the right order and still regenerate the long identifier incorrectly from the conversation. The call passed its format checks but carried the wrong value [2].
A language model generates a likely token sequence; it does not guarantee that a regenerated identifier equals the tool's original value. Liang's team moved that responsibility to program logic, passing the original value and its source directly from the upstream tool receipt to the downstream consumer [2]. Figure 10.1 contrasts the two paths. The composition problem is to preserve that continuity as control moves between model calls, tools, approvals, and external systems.