What are AI agents?
AI agents let a model plan and use tools to complete multi-step tasks. Here's how they work and where they're risky.
Overview
An AI agent is a system where an LLM decides which actions to take to reach a goal, executes them via tools, observes the results, and repeats until it’s done. The distinguishing feature versus a plain chatbot is the loop: plan → act → observe → revise.
A minimal agent loop
- Give the model a goal and a set of tools (functions it may call, e.g. “search”, “create ticket”).
- The model returns either a final answer or a tool call with arguments.
- Your code runs the tool and returns the result to the model.
- Repeat until the model produces a final answer or a stop condition is met.
When an agent is worth it
- The task genuinely requires multiple steps or external actions.
- Steps depend on intermediate results you can’t script in advance.
- A human can review high-impact actions.
For fixed, known sequences, a plain script or workflow is more reliable and cheaper than an agent. See agent vs chatbot thinking and when to automate.
Failure modes to design for
- Looping: agents can get stuck repeating steps. Cap iterations and cost.
- Wrong tool / bad arguments: validate tool inputs; never trust them blindly.
- Compounding errors: a mistake early poisons later steps.
- Cost blow-ups: each step is an inference call.
Security considerations
Agents dramatically expand the attack surface:
- Prompt injection: malicious content in retrieved data can hijack the agent’s instructions. Treat all tool output as untrusted.
- Least privilege: give tools the minimum permissions needed. An agent that can email or spend money needs guardrails and approvals.
- No secrets in prompts: keep credentials in your code/tooling layer, never in the model’s context.
Practical advice
Start with the smallest set of tools, hard limits on iterations and spend, human approval for irreversible actions, and logging of every step. Add capability only when evaluation shows it’s reliable.
Related
Last verified: August 2026. Technology and pricing change — always confirm current details with the vendor.