Agent

Definition. A system in which a language model is placed in a loop with tools, memory and a goal, so that it decides the next action based on the result of the previous one rather than following a fixed script. An agent has four parts: a planner that decomposes the goal, a tool layer that acts, a memory that carries state across steps, and a stopping condition. The defining property is that control flow is chosen at runtime by the model.

How it works. Define the goal, the available tools, the maximum number of steps, and the success criteria. Implement a loop: observe state, ask the model for the next action, validate and execute, append the result to state, check the stopping condition. Add a step budget, a cost budget and a wall-clock timeout. Log every step. For anything consequential, insert a human approval gate before irreversible actions.

Example. A procurement agent is asked to find three quotes for 500 laptop stands. It searches an approved supplier catalogue, filters by lead time under ten days, drafts a comparison table, and stops. It is capped at eight steps and $0.40 of model spend. When a supplier API returns a 500 error, the agent retries once, then reports the failure rather than inventing a price, because the system prompt forbids fabricating data and the tool result is the only permitted source.

Use case. Agents are appropriate for tasks whose steps cannot be enumerated in advance: research, multi-source data gathering, debugging, complex customer requests, and workflows that branch on intermediate findings. They are inappropriate for deterministic processes that a workflow engine can express exactly.

Warnings. Agents compound errors: a wrong step two poisons every later step. They can loop, overspend, or take destructive actions. Never give an agent write access to production without a confirmation gate, a rate limit and an audit trail. Never let an agent's own claim of success be the success check.

Limitations. Agents are slow, expensive and non-deterministic, which makes them hard to test. Reliability degrades sharply with step count, roughly multiplicatively. They are also difficult to debug because the failure is often a plausible-looking but wrong intermediate decision rather than an exception.

Pros and cons
ProsCons
Can choose actions when the sequence is unknown at the outset.Long action sequences add cost and are difficult to test and reproduce.
← Browse all glossary terms