AI docs · Building with AI
AI agents
Systems where an LLM plans and takes actions through tools in a loop, rather than producing a single response.
What it is
- An agent uses an LLM to decide what to do, call tools (search, code, APIs), observe results, and continue until a goal is met.
- It turns a model from a text generator into something that can act on the world.
How it works
- The model is given a goal, a set of tools, and guardrails.
- It reasons, calls a tool, reads the result, and repeats, maintaining state across steps.
- Good agents constrain the loop with limits, validation, and human checkpoints for risky actions.
Trade-offs
- Can automate multi-step work, but reliability drops as the number of steps grows.
- More autonomy means more risk: errors and tool misuse compound.
When to use it
- Multi-step tasks that need tools and adaptation, where some unreliability is acceptable or checked.
- When a fixed workflow is too rigid but full autonomy is unnecessary.
Common pitfalls
- Giving agents powerful tools without guardrails or human approval.
- Long, open-ended loops that drift, loop, or rack up cost.