AI Agent
An AI agent pursues a goal by observing its environment, choosing an action, and acting through tools in a loop until the task is done. How agents work.
An AI agent is a system that pursues a goal by repeatedly observing its environment, deciding on a next step, and carrying it out, then using the result to choose what to do next. The classic textbook Artificial Intelligence: A Modern Approach defines an agent as anything that perceives its environment through sensors and acts on it through actuators, a definition that covers thermostats, game-playing programs, and robots. Since 2023 the term has mostly meant agents built on large language models (LLMs): the model reads a goal, calls tools such as web search, code execution, or business APIs, reads what each tool returns, and keeps going until it judges the task complete. Coding assistants that edit and test a whole repository, research assistants that search and cite dozens of sources, and computer-use agents that operate a desktop through screenshots and clicks all work this way.
How an AI Agent Works#
An LLM agent runs inside a loop. The model receives the goal, the conversation so far, and a list of available tools, then either writes a final answer or emits a tool call. The surrounding program, called the agent harness, checks whether the action is allowed, executes it, and appends the result to the model's context as a new observation. The model then decides the next step with that evidence in view. ReAct prompting established the pattern of interleaving written reasoning with actions, and current reasoning models are trained with reinforcement learning to work this way over long chains of tool calls.
Most agents combine the same four building blocks. The model, a general-purpose LLM or vision-language model, decides each step. Tools are functions described by a name, a purpose, and a JSON schema for their arguments, and the Model Context Protocol (MCP) lets one agent connect to tools that other teams publish. Memory spans the context window, which holds the current task, and the files, databases, or vector databases the agent searches for anything older, while agent skills package reusable instructions that load only when a task needs them. Planning breaks the goal into steps, tracks which are done, and revises the plan when a step fails.
AI Agents vs. Models and Workflows#
A widely used definition, from Anthropic's guide to building effective agents, reserves "agent" for systems in which the LLM directs its own process and tool use.
- AI model: A model maps one input to one output, such as an image to a list of detected objects. An agent calls models, often many times, and decides what to do with their outputs.
- Agentic workflows: LLM calls and tools follow code paths that a developer fixed in advance, such as extract, then classify, then summarize. In an agent, the model chooses how many steps a task takes and which tools each step uses.
- Chatbots: A chatbot answers each message in turn. An agent takes actions between messages and can work for minutes or hours without a person in the loop.
- Multi-agent systems: Several agents with separate roles and contexts cooperate on one task under an orchestration layer that assigns the work and merges the results.
Types of AI Agents#
The textbook taxonomy from Russell and Norvig orders agents by how much they reason about the world:
- Simple reflex agents: React to the current input with fixed condition-action rules, such as a thermostat or a motion-triggered light.
- Model-based reflex agents: Keep an internal state that tracks parts of the world they cannot currently observe, such as which people have already been seen.
- Goal-based agents: Search or plan for action sequences that reach a stated goal, such as a route planner.
- Utility-based agents: Choose among outcomes by a utility score, trading off speed, cost, and risk.
- Learning agents: Improve their behavior from experience, typically through rewards.
LLM agents are goal-based agents whose planning happens in text, and agents trained with reinforcement learning on tool-use tasks are also learning agents.
Building a Simple Vision Agent#
A camera-based agent perceives through a detection model and acts through code. In this model-based reflex agent, Ultralytics YOLO26 tracking gives every person a persistent ID across video frames, and the agent stores the IDs it has already acted on, so each person triggers one alert instead of one per frame:
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
video = "https://github.com/ultralytics/assets/releases/download/v0.0.0/decelera_portrait_min.mov"
alerted = set() # The agent's memory of people it has already acted on
for frame, result in enumerate(model.track(video, stream=True, classes=[0])):
# Perceive: IDs of the people tracked in this frame
ids = set(result.boxes.id.int().tolist()) if result.boxes.is_track else set()
# Decide and act: alert once for each person not seen before
for track_id in sorted(ids - alerted):
print(f"Frame {frame}: person {track_id} entered, alert sent")
alerted |= idsThe printed log has one line per new person, which shows the difference that state makes: a model alone would report every person again in every frame.
Real-World Applications#
- Agentic coding: Coding agents read a repository, edit files, run the tests, and iterate on failures until the change passes.
- Research and analysis: Research agents run many searches, read the sources, and write a cited report, often by splitting the question across several subagents.
- Manufacturing: A visual inspection agent combines a defect detector with plant systems, pausing a conveyor, logging the defect, and opening a maintenance ticket when defects cluster.
- Physical AI: Warehouse and household robots perceive with cameras, plan a grasp or a route, and act through motors, closing the loop many times per second.
Reliability and Safety#
Errors compound over long tasks, because one wrong step can derail every step after it, so teams measure agents end to end with agent evaluation benchmarks and traces of real runs. Agents that read web pages, emails, or files can encounter prompt injection, instructions planted in content that try to redirect the agent, so harnesses limit each tool's permissions, run code in sandboxes, and ask a person before irreversible actions such as payments or deletions. Capability is rising quickly: METR found that the length of software tasks frontier agents could complete with 50% reliability doubled about every seven months from 2019 to early 2025.










