AI agent
An AI agent is a software system that pursues a goal you define by choosing its own sequence of actions and using tools to affect systems outside the conversation.
The distinguishing property is not intelligence but autonomy over the steps: you specify the outcome, and the agent decides how to reach it. A large language model answering a question is doing inference; the same model deciding to search a codebase, edit a file, run the tests, and try again is acting as an agent.
If the sequence of steps is known in advance and does not change, the right thing to build is a fixed workflow rather than an agent — it is cheaper to run and far easier to debug. Agents earn their complexity only when the path genuinely cannot be determined ahead of time.
How it works
An agent runs a loop. The model reads the goal and the tools it has been given, picks an action, calls a tool, reads the result and decides what to do next, repeating until it judges the goal met or hits a limit. Each tool is described to the model in plain language plus a schema for its inputs, and the surrounding program executes the call and hands back the output.
Everything interesting happens in that surrounding program: which tools exist, what they are allowed to touch, how many steps the loop may take, and which actions pause for a human to approve.
Example
A coding agent asked to fix a failing test searches the repository for the test, reads the code it covers, edits a file, runs the suite, reads the new failure and edits again. Nobody wrote those steps down in advance; the agent chose them from the tools it had: search, read, edit and run.
Common mistakes
- Giving an agent write access to production systems before it has proved itself against a sandbox.
- Building an agent for a process whose steps never change, where a plain script would be cheaper and easier to debug.
- Not logging every tool call with its arguments, so failures cannot be reconstructed afterwards.