Multi-Step Agentic Prompt Patterns
An agentic workflow is one where Claude makes decisions and takes actions across multiple steps to accomplish a goal — without you directing each step individually. Instead of responding to a single prompt, Claude plans, acts, checks results, and adapts until the task is complete.
This capability is powerful and requires careful prompting. The same properties that make agentic workflows efficient — autonomy, persistence, real-world actions — also make errors consequential and potentially difficult to reverse.
What Agentic Workflows Are
In a standard interaction, you provide input and Claude provides output. You are in control of every step.
In an agentic workflow, Claude is in control of the intermediate steps. You define the goal and the constraints; Claude determines how to get there. It might read files, call APIs, run code, write output, check whether the output meets a criterion, and loop back if it doesn't — all without asking for your input between steps.
The defining characteristic is autonomous decision-making over a sequence of actions with real-world effects. Each action may change state in your system: files are modified, API calls are made, records are updated. Claude must reason about what to do next based on what it observes, not just what you told it.
Task Decomposition
Before Claude can execute a complex goal autonomously, the goal needs to be decomposed into a sequence of concrete, actionable steps. You can either do this decomposition yourself (providing a plan in your prompt) or ask Claude to do it as the first step of execution.
Explicit decomposition — You specify the steps in your prompt. This gives you maximum control over the execution path but requires you to anticipate the right approach upfront.
Delegated decomposition — You give Claude the goal and ask it to plan first before acting. Claude produces a plan, you review it, and execution begins only after you approve.
Delegated decomposition is generally safer for complex tasks. Seeing Claude's plan before it starts executing reveals misunderstandings early, when they're easy to correct.
Before taking any actions, produce a numbered execution plan for this task.
List every file you intend to modify and every external API you intend to call.
Wait for my approval before beginning execution.
Guardrails and Constraints
Guardrails are the most important element of a well-designed agentic prompt. They define the boundaries within which Claude can act autonomously.
Scope constraints — Limit what Claude can touch:
Only modify files within the src/components/ directory.
Do not create new database tables or modify existing table schemas.
Do not make any API calls to production endpoints — use the staging environment only.
Reversibility constraints — Require safe operations:
Before modifying any file, output the original content and the proposed change.
Use git commits to checkpoint your work after each major step.
Never delete files — move them to a /tmp/archive/ directory instead.
Escalation conditions — Tell Claude when to stop and ask:
If you encounter an error you cannot resolve within 2 attempts, stop and report it.
If the task requires accessing credentials or secrets beyond what is already available, stop and ask.
If your plan changes significantly from the one I approved, pause and explain why before continuing.
Validation requirements — Require Claude to check its work:
After each code change, run the test suite. Do not proceed to the next step if tests fail.
After writing each document section, verify it is consistent with what was written in previous sections.
The Plan-Execute-Verify Loop
The most reliable agentic pattern structures execution as a repeating loop:
- Plan — Determine what to do next based on the current state and the goal
- Execute — Take the action
- Verify — Check that the action had the intended effect
- Loop — Return to Plan with updated state, or terminate if the goal is met
Building this loop into your prompt makes Claude's behavior more robust. A Claude that executes without verifying will compound errors across steps. A Claude that verifies after each step catches problems while they're still isolated and recoverable.
For each step in your plan:
1. State what you are about to do and why
2. Do it
3. Verify the result matches what you expected
4. If verification fails, diagnose the problem before moving to the next step
Multi-Agent Patterns
For complex workstreams, a single Claude agent may not be the right architecture. Multi-agent patterns assign different responsibilities to different Claude instances:
Orchestrator + Specialists — An orchestrator agent receives the high-level goal and delegates subtasks to specialist agents (one for research, one for code, one for writing). The orchestrator integrates results and manages the overall workflow.
Pipeline agents — Agents arranged in sequence, each passing its output to the next. Agent 1 gathers data, Agent 2 analyzes it, Agent 3 generates a report. Each agent sees only its specific input and produces a specific output.
Review agents — A dedicated agent whose only job is to evaluate the output of another agent. Before results are finalized, the reviewer checks them against a rubric or validates them against source material.
Multi-agent patterns increase reliability by separating concerns and adding independent verification — but they also add complexity. Start with a single well-constrained agent; move to multi-agent only when a single agent consistently fails at a subtask that could be isolated.
Common Pitfalls
Over-autonomy — Giving Claude too much latitude leads to unexpected behavior. If Claude can access any system and take any action, the blast radius of an error is enormous. Constrain scope aggressively.
Insufficient constraints — The absence of a rule is not permission to do anything — but Claude may treat it that way. Think about what Claude should not do and state it explicitly.
Missing verification — An agent that acts without checking results will not know when it has gone off-track. Every consequential action should have a verification step.
Ambiguous termination — Without a clear completion criterion, Claude may loop indefinitely, terminate too early, or produce output it is not confident in. Define what "done" means.
No escalation path — Agents encounter unexpected situations. Without instructions for what to do when stuck, Claude will guess. Define when it should stop and report rather than continue.
Exercise: Design an Agentic Workflow With Guardrails
Discussion
Sign in to join the discussion.

