AI Agents

AI Agent Architecture: The Parts and How They Fit

Name the seven parts of an agent system and choose between a workflow with an agent step, a single agent and several agents.

Model Prompt Tools Memory Orchestration Guardrails and logging

The short answer

An AI agent system has seven parts: a model, a system prompt, tools, memory, orchestration, guardrails and logging. Orchestration runs the loop and connects the rest. Most builds take one of three shapes: a fixed workflow with one agent step, a single agent, or several agents. Start with the simplest shape that handles the task.

What are the parts of an agent system?

An agent system has seven parts: a model, a system prompt, tools, memory, orchestration, guardrails and logging. The first four shape what the agent can do. The last three decide whether you can trust it in daily use.

  • Model. The large language model, a program trained on text, that reads the situation and chooses the next step.
  • System prompt. Standing instructions the software sends to the model on each call: the agent's role, its rules and its limits.
  • Tools. Functions the model may call to read or change another system. Tool calling explains the mechanism, and the Model Context Protocol is an open standard for connecting tools to models.
  • Memory. Text carried between steps or between conversations. Agent memory covers the kinds.
  • Orchestration. The software that runs the loop. It passes the model's request to a tool, returns the result and decides whether to continue.
  • Guardrails. Checks outside the model that block or pause an action, such as step caps and approval gates.
  • Logging. A record of each model call, tool call and result.

How do the parts fit together?

Orchestration sits in the centre and the other parts plug into it. On each pass it builds one block of text from the system prompt, the memory and the new input, sends that block to the model, and acts on the reply.

If the reply names a tool, orchestration checks the guardrails, runs the tool, logs the call and adds the result to memory. Then it calls the model again. If the reply is a final answer, orchestration logs the answer and stops.

Model text block reply System prompt Memory New input Orchestration runs the loop step cap, approval Guardrails Tools result each call and result Logging
Each part connects to orchestration and to nothing else, which is why you can swap one without rebuilding the rest.

The no-code platform n8n draws this layout on its canvas. Its AI agent node is the orchestrator, and a chat model, a memory component and tools attach beneath it as sub-nodes. My intake agent uses Google Gemini as the model, one memory sub-node and three tools: Google Sheets, Gmail and a lookup. Five business rules sit in the system prompt, and a pause for human approval serves as the guardrail.

You can swap one part without rebuilding the rest. A different model plugs into the same tools. A new tool needs a name and a description, and the loop stays as it was.

Workflows and agents: where is the line?

Anthropic's guide "Building effective agents" separates the two by who directs the path. In a workflow, code written in advance sends models and tools down predefined paths. In an agent, the model directs its own process and chooses its own tools as it goes.

You can see the difference on a canvas. In a workflow you draw each arrow, and a model call fills one box: classify this email, summarise this document. In an agent you attach tools to a model and write rules, and the model decides the order.

Workflow you draw each arrow Trigger Classify Summarise Save model call model call Agent the model decides the order Rules Model Lookup Sheets Gmail
You can read the order of a workflow off the canvas; the agent has tools attached and no order drawn between them.

The same guide names workflow patterns worth knowing. Prompt chaining feeds the output of one model call into the next. Routing uses a first call to sort the input onto a specialised path. Orchestrator-workers has one model split a task and hand the pieces to others. Each pattern keeps more control in your hands than a free-running agent does.

Predefined paths give you repeatable runs and plain debugging. Model-directed paths give you flexibility on input you did not foresee, and you pay for that in cost per run and in errors that compound across steps.

Which shape fits your task?

Three shapes cover most builds: a workflow with an agent step, a single agent, and several agents working together. Pick the first one in the table that handles your task.

ShapeHow it worksFits whenCost and effort
Workflow with an agent stepFixed steps run before and after; one step hands a bounded job to an agentYou know the path, and one step needs judgement over varied inputLowest: a short loop inside a predictable run
Single agentOne model, one system prompt, one set of tools, one loopThe steps depend on what the agent finds, and a handful of tools covers the jobVaries with the number of loop passes
Multi-agentA lead agent splits the task and passes pieces to specialist agents, each with its own prompt and toolsThe task splits into parts that need different instructions, or one context window cannot hold itHighest: more model calls, and hand-offs to debug

My intake agent takes the first shape. A form trigger and a field clean-up step run as fixed steps, the agent handles the part where rules meet free text, and a fixed approval step follows. Multi-agent systems covers the third shape and the hand-off problems it brings.

Workflow with agent step Fixed step Agent step Fixed step Single agent Agent Tool Tool Tool Multi-agent Lead specialists and their tools lowest cost per run varies with loop passes highest cost per run
Model calls multiply from left to right and the cost bar grows with them, so start with the shape on the left.

What do guardrails and logging add?

Guardrails stop a bad action before it lands, and logs let you find the cause after a bad run. Both live in the orchestration layer, outside the model, so they hold on a run where the model ignores an instruction.

Three guardrails earn a place in a small build. A step cap ends a run after a set number of loop passes. An approval gate pauses before an action you cannot reverse. Narrow tool permissions limit the damage of a wrong call: give the agent a tool that appends a row, and keep the tool that deletes the sheet off its list.

A sentence in the system prompt such as "do not email customers without approval" is an instruction, and a model can fail to follow an instruction. An approval gate is a control that the software enforces. Use the prompt for behaviour and the gate for anything that must hold.

Log the full run: the input, each tool call with its inputs, each result and the final answer. Read one failed run in order and you can tell whether the fault sits in the prompt, in a tool description or in the data.

Where should you start?

Start with a workflow that has one agent step, one model and two or three tools. Anthropic's guide gives the same advice: find the simplest solution that works, and add complexity once a simpler build falls short.

Write the system prompt as rules a new colleague could follow. Add a step cap and one approval gate before the first live run. Test on real inputs, read the logs, and change one part at a time so you know which change helped.

Move to a single free-running agent if the fixed steps keep blocking valid cases. Move to several agents after one agent's prompt has grown too long to keep consistent, and not before.

Common questions

What is the difference between a workflow and an agent?

In a workflow, code written in advance fixes the path and a model fills individual steps. In an agent, the model chooses its own steps and tools. Anthropic draws this distinction in its guide "Building effective agents".

Do I need a multi-agent system?

Most first builds do not. Use several agents once a task splits into parts that need different instructions or tools, or once one agent cannot hold the whole task in its context window.

Where do guardrails sit in an agent system?

They sit in the orchestration software, outside the model. A step cap or an approval gate holds even if the model ignores a rule in its system prompt.

Sources and references

  1. Anthropic, Building effective agents
  2. n8n, Advanced AI documentation
  3. Model Context Protocol, Model Context Protocol
  4. OpenAI, Function calling guide

Concepts covered: AI agent architecture, system prompt, orchestration, guardrails, workflow, multi-agent system, Model Context Protocol, logging.

Weekly newsletter

The AI Brief by Clarence Cheang

A weekly exploration of the developments, technologies and ideas shaping artificial intelligence.

One email a week. Unsubscribe in one click. What is in each issue