An LLM with tools that can decide, act and observe in a loop until a task is complete.
How an agent decides, acts and observes in a loop
1 / 4Decide
Step 1 of 4
Decide
The model reads the task and everything seen so far, then either picks a tool with arguments, such as search_orders(id=1042), or decides it can answer.
Step 2 of 4
Call tool
The tool layer checks the arguments against the tool's schema and runs it. A hallucinated argument should fail here, before it reaches a real system.
Step 3 of 4
External API
The tool calls the real API or database and gets a raw result back. This is the only point where the agent touches the outside world.
Step 4 of 4
Observe
The result is appended to the agent's context as an observation. Treat it as untrusted text: a tool output can carry injected instructions. Then the loop starts again, capped by a maximum iteration count.
The loop ends only when the model answers instead of calling another tool.
User
Agent
Tools
APIs
Response
clientservicemodeldatabaseagentexternal
Explanation
The agent receives a task, reasons about which tool to call, executes the tool, observes the result, and loops until it can produce a final answer. This is the ReAct pattern.
Components
LLM with function callingTool definitions (schemas)Tool execution layerAgent loop / orchestratorMemory / state
When to use
Multi-step research tasks
Tasks requiring external data or actions
Workflows where the steps depend on intermediate results
When NOT to use
When the steps are fixed (use a deterministic workflow)