An AI agent is a system that uses a large language model (LLM) to decide, step by step, which actions to take to accomplish a goal. Unlike a single prompt-and-response, an agent runs in a loop: it observes state, chooses a tool, executes it, reads the result, and repeats until it either finishes or gives up.
The canonical loop
- Plan — the model reads the goal and current context.
- Act — it calls a tool (search, code execution, HTTP request, DB query).
- Observe — the tool result is fed back into the context window.
- Repeat until a stop condition (goal reached, budget hit, error).
Recommended reading
- Anthropic — Building effective agents
- OpenAI — A practical guide to building agents
- Google — Agents whitepaper
- Lilian Weng — LLM Powered Autonomous Agents
When to use one
Agents shine when the problem is open-ended and the steps can't be enumerated ahead of time (research, debugging, multi-hop customer support). If you can write the flow as a static DAG, a workflow is cheaper, faster, and easier to debug.