AI Agent
An LLM with tools, memory and a loop that decides, acts and observes until a task is complete.
Simple explanation
An agent is an LLM that can call tools (functions you define) in a loop. It reasons about what to do, calls a tool, observes the result, and repeats until it can answer. This turns a chatbot into a system that acts.
Engineering explanation
An agent loop: LLM receives task + tool definitions → returns a tool call (name + args) → your code executes the tool → result fed back as observation → LLM reasons again → repeats until final answer or max iterations. The ReAct pattern (Reason + Act) is canonical. Production agents need: max_iter, cost budget, per-tool timeout, tool-call dedup, tracing, and human-in-the-loop for destructive actions.
Example
Task: 'What's the weather in Tokyo?' → LLM calls get_weather('Tokyo') → observes {temp: 18, conditions: 'clear'} → LLM answers 'Tokyo is 18°C and clear.'
When to use it
Multi-step tasks, tasks requiring external data/actions, workflows where steps depend on intermediate results.
Common misconception
Agents are NOT 'smarter LLMs'. They are LLMs with a loop and tools. Without guardrails (max_iter, cost budget), agents loop forever and burn budget.