3 Errand: Breaking complex workflows into units
Agents often become difficult to build and maintain because their work spans many distinct steps, large contexts, and different kinds of inputs. The core idea here is to break those sprawling workflows into smaller intelligent subroutines that can be developed, tested, and improved independently. This makes systems easier to reason about, reduces the chance that one fragile part will destabilize everything, and can also enable parallel execution for better speed and efficiency.
These small units are characterized by a narrow purpose, one-way information flow, discarded intermediates, and no direct side effects on the broader agent state. They are especially useful when a model must extract information, classify or judge something, compress a long history, format outputs into strict structures, or make a targeted edit. In practice, an errand often consists of one or more model calls plus a final deterministic procedure that extracts or shapes the result into the form the rest of the agent needs.
Different errand variants address recurring agent problems. Persona-style errands use instructions to guide flexible task execution, reflection-style errands review prior outputs to catch mistakes or assign confidence, compaction errands shorten long conversations or large inputs before context limits are exceeded, structured extraction errands turn messy content into parseable data, and editing errands refine outputs for clarity, safety, or other constraints. Across these examples, the pattern offers a practical tradeoff: better robustness and modularity at the cost of extra overhead from repeated context and model calls.
The Errand pattern. Information passes from left to right through IE(s) and procedure(s). The procedure punctuating the errand is typical (it's often used to extract the final result) but is not characteristic of the pattern.
The AFD for the speaker stance identification errand example. A (textual) transcript of a conversation and the name of the speaker whose stance is to be identified are passed as inputs to the errand. In the first IE, the passages belonging to the named speaker are extracted. Then the speaker's stance is classified according to whether they agree with the subject of the conversation or with other participants. Finally, the output of the second IE is traversed by a code-based procedure to find the classification label, which is returned as the errand's output. The speaker's passages and the second IE's reasoning about their stance are discarded.
The AFD of the call summarization errand example. A voice call recording is passed as input and transcribed by a speech-to-text model. The transcript is summarized by a language model IE, and the summary is extracted from its output and returned as the errand’s output. The voice call transcript and any language model reasoning around the summarization are discarded.
Summary
- The Errand pattern encapsulates a small, unidirectional intelligent operation (an intelligent subroutine) that performs a defined function within an agent’s workflow.
- Errands emerge naturally from task decomposition, helping manage complexity by isolating self-contained workflows that can be tested, maintained, and parallelized independently.
- They are characterized by unifunctionality, unidirectionality, functional purity, and simplicity, enabling predictable operation and improving agent robustness and reliability at the cost of some computational overhead.
- Several common errand types (Persona, Reflection, Compaction, Structured Extraction, and Editing errands) address recurring challenges in agent design.
- Errands strengthen agents' overall capability and maintainability by turning complex reasoning tasks into modular components that can be reused and extended, much like traditional code functions.
- As a foundational pattern, Errand underlies many specialized behaviors in intelligent systems, serving as a building block for composable, scalable, and reliable agentic architectures.
Agent Design Patterns ebook for free