Anatomy of Agentic Workflows
Workflow patterns, critic loops, routing, and execution.

Orchestrating multiple AI agents, tools, and humans to ship real outcomes โ reliably.
TL;DRโ
- An agentic workflow chains plans, tools, sub-agents, and humans to complete a goal.
- Core building blocks: Planner โ Executor โ Critic โ Memory โ Tools โ Human Gate.
- Patterns: sequential, parallel fan-out, router, reflect-and-retry, plan-and-act.
- Add observability and kill-switches before scaling.
Why this mattersโ
A single LLM call is a calculator. An agentic workflow is an assembly line โ predictable, observable, and tunable. It's how AI moves from "demo" to "production".
Bottom line: The workflow, not the model, is the real product.
The Big Pictureโ
Bottom line: Plan โ act โ check โ (loop) โ ship.
Core Rolesโ
| Role | Purpose |
|---|---|
| Planner | Decomposes the goal into steps |
| Executor | Runs steps; calls tools |
| Critic / Validator | Checks each step's output |
| Memory | Short-term + long-term context |
| Tools / MCP | External capabilities |
| Subagents | Specialists for sub-tasks |
| Human Gate | Approval before risky actions |
Workflow Patternsโ
1. Sequential pipelineโ
goal โ step1 โ step2 โ step3 โ done
2. Parallel fan-outโ
โโ analyze
goal โ plan โผโ test
โโ document
3. Router (pick the right agent)โ
goal โ router โ @code-reviewer | @security-auditor | @docs-writer
4. Reflect-and-retryโ
attempt โ critic โ (fail) โ reflect โ retry โ critic โ done
5. Plan-and-act (ReAct)โ
Loop of Thought โ Action โ Observation until done.
Step-by-Step Setupโ
1. Define the goal in plain Englishโ
"Ship a tested, reviewed fix for issue #1234."
2. Decompose into a plan (plan.yml)โ
goal: "Fix issue #1234"
steps:
- id: triage
agent: bug-triage
output: triage_report
- id: tests
agent: test-writer
depends_on: [triage]
- id: implement
agent: claude-code
depends_on: [tests]
- id: review
agent: code-reviewer
depends_on: [implement]
- id: human_gate
type: approval
depends_on: [review]
- id: ship
type: merge_pr
depends_on: [human_gate]
3. Wire memoryโ
"memory": {
"short_term": { "type": "in_session" },
"long_term": { "type": "vector_store", "index": "project-memory" }
}
4. Add critics / validatorsโ
critics:
- name: tests_pass
rule: "exit_code == 0"
- name: coverage
rule: "coverage >= 0.8"
- name: no_secrets
rule: "secret_scan == clean"
5. Run & observeโ
claude workflow run plan.yml --observe
Variants for Different Team Settingsโ
๐ค Soloโ
Sequential, no human gate. Critic = your own eyes.
๐ฅ Small teamโ
Add a @code-reviewer critic + Slack notification on completion.
๐ข Enterpriseโ
- Human gates on every risky step.
- Full audit trail to SIEM.
- Kill-switch env var (
CLAUDE_WORKFLOW_STOP=1). - Rate limits + budget caps.
limits:
max_tokens_per_run: 200000
max_cost_usd: 5.00
max_runtime_minutes: 30
๐ Open-sourceโ
- Publish workflows as templates in a community repo.
- Document expected inputs/outputs.
Bottom line: Same skeleton, escalating governance.
Anatomy of a Single Stepโ
- id: review
agent: code-reviewer
input: { branch: feature/fix-1234 }
tools: [Read, Bash, Grep]
timeout: 120s
retries: 2
critics: [no_high_severity_issues]
on_fail: rollback
on_success: notify_slack
Common Patterns & Recipesโ
Pattern 1 โ Self-check loopโ
- id: write_code
agent: claude-code
- id: critique
agent: code-reviewer
on_fail: { goto: write_code, max: 3 }
Pattern 2 โ Parallel subagentsโ
- parallel:
- { agent: security-auditor }
- { agent: docs-writer }
- { agent: test-writer }
Pattern 3 โ Human-in-the-loopโ
- type: approval
message: "Approve deploy to prod?"
approvers: ["@milind", "@vamsi"]
Pattern 4 โ Budget guardrailโ
limits: { max_cost_usd: 2.00 }
on_exceed: pause
Pattern 5 โ Observabilityโ
"observability": {
"trace": true,
"metrics_endpoint": "https://otel.corp/v1/traces",
"log_level": "info"
}
Best Practices โ โ
- Decompose big goals into โค 7 steps.
- Add a critic to every risky step.
- Persist memory for multi-session work.
- Set budgets (tokens, $, time).
- Human gates before destructive actions.
- Observe everything (traces, metrics, logs).
- Idempotent steps โ safe to retry.
Anti-Patterns โโ
- One giant prompt that "does everything".
- No critics โ blind trust in LLM output.
- No budget caps โ runaway costs.
- Skipping human gates on prod actions.
- Tightly coupled steps โ hard to debug.
- No retries / error handling.
Troubleshootingโ
| Symptom | Cause | Fix |
|---|---|---|
| Workflow loops forever | No retry cap | Set max: on goto |
| Steps run out of order | Missing depends_on | Add explicit deps |
| Critic always passes | Rule too lax | Tighten rule + test |
| Costs spike | No budget | Add limits block |
| Hard to debug | No tracing | Enable OpenTelemetry |
| Race conditions | Shared mutable memory | Use scoped memory per step |
Starter Templateโ
goal: "<one line>"
limits: { max_cost_usd: 2.00, max_runtime_minutes: 15 }
memory: { short_term: in_session }
steps:
- { id: plan, agent: planner }
- { id: act, agent: claude-code, depends_on: [plan] }
- { id: review, agent: code-reviewer, depends_on: [act] }
- { id: gate, type: approval, depends_on: [review] }
- { id: ship, type: merge_pr, depends_on: [gate] }
๐ก Tip: Start with a 3-step linear workflow. Add parallelism only when you measure a bottleneck.
Glossaryโ
- Agentic workflow โ A multi-step process orchestrating agents, tools, and humans.
- Planner / Executor / Critic โ The three core roles.
- ReAct โ Reason + Act loop pattern.
- Human gate โ Manual approval step.
- Memory โ Short-term (session) and long-term (vector store) context.
- Kill-switch โ A flag that halts all running workflows.
Further Readingโ
- Search: "agentic workflows patterns 2026"
- Search: "ReAct paper Yao et al."
- Search: "LLM orchestration LangGraph CrewAI AutoGen"
- Search: "AI workflow observability OpenTelemetry"