Agentic Workflow Construction
also known as four-component agent build
Build an agent out of four named parts before you write any loop. The four parts are the model, the tools, the data stores, and the loop prompt that ties them together. Also pick how much freedom the model gets each turn. That choice is the interaction paradigm: passive, explicit, or autonomous. Keep every part separate so you can swap one without touching the rest. The more freedom you give the model, the more safety checks the loop needs.
Methodology process overview
Intent. Make agent authors name the four parts and the freedom level before they code, so a failure points to one part instead of smearing across a vague agent.
When to apply. Use this when you build a new agent from scratch. It fits a coding agent, a customer-service agent, a browser agent, or an internal-tools agent. Do it on day one, before you write the loop. Don't apply it when you are just wiring up a single model call with no tools or memory. That is a prompt, not an agent.
Inputs
- Task specification — What the agent has to do, written as something a user can ask for.
- Available model(s) — The models the agent can call. Note each one's cost, speed, and what it is good at.
- Tool inventory — The outside services the agent may use: APIs, databases, search, browsers, sandboxes.
- Data store(s) — The places the agent reads and writes: memory stores, vector indexes, caches, scratchpads.
Outputs
- Named four-component agent — An agent whose model, tools, data stores, and loop prompt are each built on their own and easy to swap.
- Declared interaction paradigm — The chosen freedom level. Passive means the model only writes text. Explicit means the model uses tools when told to. Autonomous means the model picks its own tools and keeps going until the job is done.
- Agent loop — The control flow that runs the four parts under the freedom level you picked.
Steps (7)
Pick the interaction paradigm
Pick how much freedom the model gets. Passive: it only writes text and cannot see tools or memory. Explicit: the loop calls tools at set points and the model just decides the content. Autonomous: the model decides what to do at each step. Pick the lowest level that solves the task. More freedom costs more and is risky to turn on too early.
Author the model component
Choose the model, the rough shape of the system prompt, and the output format if you need one. This is where the smarts live. Everything else is plumbing.
Author the tool component
List the tools as typed function signatures with the descriptions the model will see. Each tool returns structured data, not loose prose. Check every tool return against its schema before it goes back into the loop.
usesTool Use
Author the data-store component
Pick the memory shape: scratchpad, key-value store, vector index, or event log. Decide what the model reads at each step. Decide what the loop writes after each step.
Author the agent-loop prompt
Write the loop prompt that ties the model, tools, and data stores together. Say clearly which tools exist, when the loop ends, and what success looks like.
Add guardrails and verifiers
For autonomous agents, add input and output guardrails, tool-call checks, and a stop condition. The more freedom the model has, the more checks the loop needs.
Bind to an orchestration framework only when needed
If the loop needs fan-out, retries, observability, or a state-machine shape, move it into a framework such as LangGraph, CrewAI, AutoGen, or Pydantic AI. Do not reach for one on day one. A hand-rolled loop is fine for the first cycle.
Framework-specific instructions
Pick a framework and generate a framework-targeted rewrite of this methodology's steps.
Choose framework
AI-generated for Agent Development Kit (ADK) (Google) — verify against official docs.
Principles
- Name all four parts. Debugging an unnamed part is debugging fog.
- Pick the lowest freedom level that solves the task.
- Tool returns are structured data, never loose prose.
- Safety checks grow with freedom. Passive needs almost none. Autonomous needs many.
Known failure modes (3)
- ✕Tool Explosion
Adding tools without a typed schema until the model can't reliably pick the right one — failures smear across components.
- ✕Prompt Bloat
Stuffing the loop prompt with every conceivable instruction until the model loses focus.
- ✕Hero Agent
Choosing the autonomous paradigm when explicit would have sufficed, then needing heavy guardrails to compensate.
Related patterns (5)
- ★★Augmented LLM
Build the foundational agent block as an LLM augmented with retrieval, tools, and memory that the model actively chooses to use, rather than a bare-model call.
- ★★Tool Use
Let the LLM produce typed calls against an external toolkit instead of producing free-form text the surrounding system has to parse.
- ★★Scratchpad
Give the agent a writable scratch space for intermediate notes that informs later turns but does not pollute the response.
- ★★Episodic Memory
Record past events as time-stamped first-person experiences the agent can recall later, separately from extracted facts (semantic) and learned how-to (procedural).
- ★★Input/Output Guardrails
Validate inputs before they reach the model and outputs before they reach the user.
Related compositions (2)
- recipe · abstract shapeModern Coding Agent
An agent that reads, writes, and runs code in a sandbox, calling tools and (optionally) sub-agents while a human approves the destructive parts. The shape that powers Cursor, Claude Code, OpenHands, Aider, Codex CLI.
- recipe · abstract shapeProduction LLM Platform
Stand up a production LLM/RAG system whose data pipeline, model pipeline, and inference path scale and deploy independently.
Related methodologies (2)
- Evaluation-Driven Development★★
Judge every prompt change, model swap, search tweak, and new tool against a test you committed to up front, not by feel.
- Crawl-Walk-Run Automation Gating★★
Separate what an agent can do from what it is allowed to do on its own. A system that could plausibly act gets to act only after the data earns it, one action type at a time.
Sources (2)
Designing Large Language Model Applications
Ch 10 'Interfacing LLMs with External Tools' — Components of an Agentic System “Models, Tools, Data Stores, Agent Loop Prompt, Guardrails and Verifiers, Agent Orchestration Software”
AI Agents in Action
Ch 1 'Introduction to agents and their world' (Manning liveBook preview); Ch 4 'Exploring multi-agent systems' “Defining the concept of agents ... Differentiating the components of an agent ... Analyzing the rise of the agent era: Why agents? ... Peeling back the AI interface ... Navigating the agent landscape”
Provenance
- Added to catalog:
- Last updated:
- Verification status: verified