AI developers · Part 04
Agents
The agent loop: think, call a tool, observe, repeat until the goal is met.
Last updated
- AgentAn LLM running in a loop with tools. It decides which tool to call, looks at the result, and decides again until the goal is done.
- The agent loopCall the model with tools. If it asks for tools, run them, append the results and call again. If it answers in text, stop.
- Stop conditionsThe loop ends in one of two ways: the model answers without asking for a tool, or you hit a maximum number of steps.
- Agent vs workflowA workflow runs steps you fixed in advance. An agent lets the model choose the next step at runtime.
- Use the simplest thing that worksIf you can draw the steps as a fixed flowchart, build a workflow. Reach for an agent only when the steps depend on what it finds.
- The model plans the stepsAsk "which PRs are blocked?" and the agent lists open PRs, notices two are old, and fetches their reviews. You never wrote that sequence.
- ReActReason + Act: think, call a tool, observe the result, repeat. The basic agent loop is ReAct.
- RouterA first step classifies the request and sends it to the right specialist prompt or agent.
- Plan-and-executeThe model writes a plan first, then works through each step of it.
- Multi-agentSeveral specialist agents (code agent, tickets agent) coordinated by a supervisor.
- Human-in-the-loopThe agent pauses before a risky action and waits for a person to approve it.