Overview

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.

FAQ

What is an errand in the context of agent design patterns?An errand is a small intelligent subroutine that handles one narrow part of a larger agent workflow. It typically has unidirectional information flow, discards intermediate results, and returns only its final output without directly changing the broader agent state.
Why should complex agent workflows be broken into errands?Breaking workflows into errands makes agents easier to test, maintain, and modify. It also helps localize changes, reduces model confusion, and can enable parallel execution for faster and more cost-efficient processing.
What are the main characteristics of an errand?Errands are typically unifunctional, unidirectional, simple, and functionally pure. They process inputs in a sequential or parallel-then-sequential way, and they do not directly produce side effects on the agent’s broader state.
How do errands help with context-length limitations?Errands keep each task small enough to fit within a model’s perceptive window. Instead of passing a huge workflow history to one model call, the agent decomposes the task into smaller operations and only passes along the final relevant output.
What tradeoff do errands introduce?Errands improve capability, robustness, and reliability, but they add overhead. Each errand may require repeated shared context across multiple model calls, which can increase cost and sometimes latency.
What is a persona errand?A persona errand uses a preset system instruction that defines the errand’s behavior, goals, or style. The user’s request is then treated as payload, and the model produces output according to that persona, often with formatted result markers such as tags.
What is a reflection errand used for?A reflection errand asks a model to review the result or transcript of an earlier operation rather than perform the operation itself. It is used to judge correctness, produce pass/fail output, or generate feedback or confidence information that can improve reliability.
What is a compaction errand?A compaction errand compresses a large amount of information into a smaller summary or distilled form. It is used when the workflow is nearing a model’s context limit, such as summarizing a long conversation or filtering relevant frames in a video task.
What is a structured extraction errand?A structured extraction errand converts unstructured input, such as free-form text, into structured output like JSON, YAML, CSV, or XML. It often relies on controlled generation or formatting constraints so the result can be parsed reliably by code.
What is an editing errand, and when is it useful?An editing errand revises an existing output to improve clarity, safety, accuracy, or another specific property. It is useful when drafting and editing should be separated for better control, and it can also be chained with other editing errands for layered refinement.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Agent Design Patterns ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Agent Design Patterns ebook for free