Inside an AI agent, stage by stage

An AI agent is more than a chatbot. It is triggered by real events, looks things up, uses a fixed set of tools, checks its own work and asks a person when it matters. Pick an example and step through the seven stages.

How an AI agent worksExample
  1. 1Trigger Something starts the agent
  2. 2Gather context It looks up what it needs
  3. 3Reason and plan A model decides the next step
  4. 4Use tools It acts through approved actions
  5. 5Check its work Guardrails before anything goes out
  6. 6Human step A person approves what matters
  7. 7Act and log It finishes the job and records it

6 · Human step, in this case

The reship costs money, so a support lead sees the draft and the reship suggestion and approves both with one click.

Example: the "Support ticket" case, fictional data.

The seven stages of an agent run

Trigger

An agent does not sit waiting for someone to chat with it. It starts when something happens: an email arrives, a form is submitted, a ticket is opened, a file lands in a folder, or a schedule fires.

In this example

A customer emails: "My order #48213 still hasn't arrived and I need it by Friday."

What we build
Webhooks, mailbox and queue listeners, schedulers, or a button inside a tool your team already uses.
How it stays safe
Duplicate events are ignored, and each run gets an ID so every later step can be traced.

The cases use fictional data. Watch full runs in Try an AI agent, see the permission and approval rules we use in human approval and agent permissions, or browse the agent catalog.

How this tool works

What this explainer is for

This tool walks through one agent run in seven stages: trigger, gather context, reason and plan, use tools, check its work, human step, and act and log. You can switch between three fictional cases, a support ticket, a supplier invoice and a website lead, step through by hand or press "Play the run" to advance automatically. It is meant for business owners and managers who hear "AI agent" often and want to know what actually happens inside one, and for engineering leads who need a shared picture to plan with.

How to use it well

Go through one case from start to finish first, reading the "In this example" line at each stage. Then switch case and stay on a single stage, such as "Human step", to compare how the same stage plays out for a support reply, an invoice and a lead. The differences are the useful part: the trigger, the tools and the approval rule change with the process, while the shape of the run stays the same.

Each stage card answers three questions: what happens, what we build for it, and how it stays safe. The third line is the one to read twice, because it is where most real projects succeed or fail.

Mapping your own process onto the stages

The seven stages work as a worksheet. Pick one process, for example handling purchase requests that arrive on WhatsApp, and write one line per stage:

StageQuestion to answer for your process
TriggerWhat event starts the work, and where does it arrive today?
Gather contextWhich records, documents or policies does a person check before acting?
Reason and planWhat decisions are made, and which are judgment calls?
Use toolsWhich systems are read or updated: Tally, Zoho, a CRM, a helpdesk, email?
Check its workWhat mistakes would be costly, and how would you spot them?
Human stepWhich actions must a named person approve?
Act and logWhat is the finished output, and who needs to see the record?

If you cannot fill a row, that is the first thing to find out. Gaps in "gather context" usually mean the knowledge lives in someone's head, and gaps in "human step" mean the approval rules have never been written down.

What the simplified picture leaves out

  • Loops. The tool shows a straight line. A real agent often goes back and forth between planning and tools several times, for example looking something up, finding it incomplete and looking again.
  • Failure paths. Systems time out, data is missing and customers reply mid-run. Production agents need retries, timeouts and a clear route to a person when something breaks.
  • Many runs at once. One run is easy to follow. Hundreds a day need queues, rate limits, cost controls and monitoring.
  • Change over time. Policies, prices and products change. The context the agent gathers has to stay current, and the evaluation set has to grow with it.

Questions to ask any agent vendor, stage by stage

  • How are duplicate triggers handled, and can every run be traced by an ID?
  • Does the agent have read-only access by default? Which fields can it see?
  • How is prompt injection handled when instructions arrive inside an email or document?
  • Which tools can it call, with what permissions, and which risky actions are simply not available to it?
  • What checks run before output leaves the agent, and what happens on low confidence?
  • Who approves what, where do they approve it, and can the rules be tightened later?
  • Can a past run be replayed and explained from the log?

We expect to answer each of these on every agent we build, and you should expect the same from anyone.

Going further with Gepton

To watch complete runs with tool calls and handovers, open Try an AI agent. To decide how much each agent should do alone, use agent autonomy levels, and read how approvals and permissions are set on agent oversight. Browse examples by department in the agent catalog, see how we build and run agents on AI agents, and how we keep them measured after launch through AgentOps and managed agents. If you have a process in mind, a Discovery Sprint maps it stage by stage with your team.

Jump to

↑↓ to move↵ to open