Skip to content

What Is an AI Agent? How Agentic AI Works, With Examples

An AI agent is an AI system that can plan and take actions with tools to reach a goal, not just answer questions. How agents work, the agent loop, tool calling, MCP, real examples, risks and how to build a simple agent.

4 min read

What Is an AI Agent? — cover image from TensorCore.si

Short answer

An AI agent is an AI system, usually built around a large language model, that can plan and take actions to reach a goal instead of only replying with text. It works in a loop: the model decides what to do, calls a tool (such as web search, code execution, a database or an app), reads the result and decides the next step, until the task is done. Coding agents, research agents and agents that operate a browser or computer are common examples. "Agentic AI" is the general term for AI that works this way.

Chatbot vs AI agent

ChatbotAI agent
What it doesAnswers in textTakes actions to complete a task
StepsOne reply per messageMany steps, decided by the model
ToolsNone or fewSearch, code, files, APIs, apps, browsers
MemoryCurrent conversationConversation plus notes, files or databases
Example"Explain tensor cores""Find the cheapest H100 cloud and book 8 GPUs for tomorrow"

How an AI agent works: the agent loop

Every agent, however complex, follows the same basic loop:

  • Goal: the user gives a task.
  • Think: the LLM decides what to do next.
  • Act: it calls a tool by producing a structured request, such as a function name and arguments in JSON.
  • Observe: the program runs the tool and gives the result back to the model.
  • Repeat: the model looks at the result and decides whether to call another tool or give a final answer.

This pattern is often called ReAct (reason and act), after a 2022 research paper. The model never runs code itself; the surrounding program executes the tools and controls what the agent is allowed to do.

Tool calling

Modern LLM APIs support tool calling (or function calling): you describe each tool with a name, a description and a schema for its inputs, and the model replies with a request to use one. Every language volume in our programming library includes a working agent example, for instance the Python, JavaScript and Rust volumes.

MCP: a standard way to connect tools

The Model Context Protocol (MCP), released by Anthropic in November 2024 and since adopted widely across the industry, is an open standard for connecting AI applications to tools and data sources. Instead of writing a custom integration for every app, a tool is exposed once as an MCP server and any MCP-compatible agent can use it.

Examples of AI agents

  • Coding agents: read a codebase, write changes, run tests and fix errors, such as Claude Code, OpenAI Codex and GitHub Copilot's agent mode.
  • Research agents: search the web, read sources and write a cited report.
  • Computer and browser agents: click, type and navigate websites or desktop apps to complete tasks.
  • Customer support agents: look up orders, issue refunds within limits and escalate to humans.
  • Data agents: query databases, run analyses and build charts.

Key parts of an agent

PartRole
ModelReasons and decides the next step
ToolsLet the agent act: search, code, APIs, files
MemoryKeeps context: conversation, notes, retrieved documents (RAG)
InstructionsSystem prompt describing the goal, rules and limits
GuardrailsPermissions, approvals and checks on risky actions

Risks and limitations

  • Compounding errors: a wrong step early on can derail a long task.
  • Prompt injection: instructions hidden in web pages or documents can try to hijack an agent, so agents should treat tool results as data, not commands.
  • Costly or irreversible actions: sending emails, spending money or deleting data should need human approval.
  • Cost and speed: agents use many more tokens than a single chat reply, which is one reason AI inference demand, and GPU prices, have risen.

As agents become more capable and autonomous, making sure they pursue the right goals becomes part of AI alignment.

How to build a simple AI agent

  • Pick a model with tool calling (cloud API or a local model via Ollama).
  • Define one or two tools as functions with clear descriptions.
  • Write the loop: send messages and tools, run any tool calls, append results, repeat until the model answers.
  • Add limits: a maximum number of steps, approved tools only, and human confirmation for risky actions.

Frequently asked questions

Is ChatGPT an AI agent?

ChatGPT on its own is mainly a chatbot, but its agent features, such as web browsing and taking actions on websites, make it behave as an agent for some tasks.

What is the difference between AI agents and agentic AI?

An AI agent is a specific system. Agentic AI is the broader approach of AI that plans and acts autonomously, often with several agents working together.

Do AI agents need special hardware?

They run on the same GPUs as LLMs, but because they make many model calls per task, they need more inference capacity.

Sources and further reading

Think you understand it now? Prove it.

Solve real Tensor Core math in the TensorCore.si Challenge and earn a certificate with your name.

Take the challenge

Leave a Reply

Your email address will not be published. Required fields are marked *