An AI agent is a large language model put in a loop with tools. Instead of answering once, the model decides what to do next (read a file, search the web, run a test), looks at the result, and decides again, until the task is finished or it hits a stopping condition.
Not to be confused with Agent in reinforcement learning: the learner that acts in an environment to earn reward. The ideas are cousins, but an AI agent’s decisions come from a language model prompted with the task and its history, not from a policy trained on rewards.
Agent or workflow?
Anthropic draws a useful line. In a workflow, code fixes the sequence of steps and the model fills each one in. In an agent, the model directs its own process and chooses which tools to use and when. Agents trade predictability for flexibility, which pays off on open-ended tasks where the steps can’t be known in advance.
What makes an agent work
- Tools (tool use): the actions the model can take, each described well enough that it knows when to call them.
- Ground truth at every step: tool results, errors and test output tell the agent whether it’s on track. Without that feedback, mistakes compound and hallucinations go unchecked.
- Context management: every result lands in the context window, which fills up. Long tasks need summarizing, or delegating to subagents with fresh context; The Duel shows why that matters for cost.
- Stopping conditions and checkpoints: a maximum number of steps, and pauses for a human to review before anything risky.
The 2022 ReAct paper showed an early version of the pattern: interleaving the model’s reasoning with actions, so each thought could react to real observations.
Coding agents such as Claude Code and opencode are AI agents specialized for software. The Agentic Coding Harnesses course takes apart how several of them are built.