PromptisePromptise
PlatformSoonEnterprise
DocsGitHub
Talk to usGet started
Promptise - AI Framework LogoPromptise

The full-stack framework for agentic systems. Build with the framework. Run it on the platform. Launch it with our engineers.

pip install promptise

[01] Product

  • Framework
  • Platform (coming soon)
  • Enterprise
  • How it works
  • Contact

[02] Framework

  • The Agent
  • The Interface
  • The Harness

[03] Resources

  • Documentation
  • GitHub
  • Why Promptise
  • Use cases
  • Roadmap
  • Guides
  • Learning Paths
  • Questions

[04] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

hello@promptise.com
← Learning paths> Agentic Engineering with Promptise Foundry
Lesson 01 / 100
1%

What Is an AI Agent? Definition, How It Works, Examples

What an AI agent is: a model that calls tools in a loop until a goal is met. How the loop works, a real example, agents vs chatbots and workflows, FAQs.

Beginner7 minAgent LoopTool Calling
All 100 lessons↓
  1. 01What Is an AI Agent? Definition, How It Works, Examples
  2. 02How to Build an AI Agent in Python (2026 Guide)
  3. 03Build a Personal AI Agent: Memory, Reminders, Chat
  4. 04What Is an Agent Harness? Parts and How to Build One
  5. 05System Prompt Best Practices for AI Agents in Python
  6. 06Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. 07AI Agent YAML: Define and Run an Agent From a Config File
  8. 08Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. 09Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. 10Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. 11Gemini AI Agent with MCP: Use Google Models in Promptise
  12. 12Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. 13OpenRouter AI Agent with MCP: Many Models in Promptise
  14. 14Ollama AI Agent with MCP: Run Local Models in Promptise
  15. 15LLM Semantic Cache and Model Fallback in Python
  16. 16What Is MCP (Model Context Protocol)? A Developer's Guide
  17. 17What Is Tool Calling? LLM Function Calling Explained
  18. 18MCP Tools vs Resources vs Prompts (With Python Examples)
  19. 19How to Connect MCP Servers to Your AI Agent in Python
  20. 20Build a Production MCP Server in Python (Step by Step)
  21. 21MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. 22MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. 23OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. 24MCP Authentication in Python: API Keys, JWT and OAuth
  25. 25Build an Authenticated MCP Server for Your AI Agent (Python)
  26. 26MCP Security Best Practices: A Checklist for MCP Servers
  27. 27Testing MCP Servers in Python: pytest Without a Live Server
  28. 28Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. 29Idempotent Tool Calls: Make AI Agent Retries Safe
  30. 30AI Agent Tool Failures: Stop Unsafe Workarounds
  31. 31MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. 32MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. 33MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. 34LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained

Lessons in this path

  1. 01What Is an AI Agent? Definition, How It Works, Examples
  2. 02How to Build an AI Agent in Python (2026 Guide)
  3. 03Build a Personal AI Agent: Memory, Reminders, Chat
  4. 04What Is an Agent Harness? Parts and How to Build One
  5. 05System Prompt Best Practices for AI Agents in Python
  6. 06Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. 07AI Agent YAML: Define and Run an Agent From a Config File
  8. 08Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. 09Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. 10Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. 11Gemini AI Agent with MCP: Use Google Models in Promptise
  12. 12Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. 13OpenRouter AI Agent with MCP: Many Models in Promptise
  14. 14Ollama AI Agent with MCP: Run Local Models in Promptise
  15. 15LLM Semantic Cache and Model Fallback in Python
  16. 16What Is MCP (Model Context Protocol)? A Developer's Guide
  17. 17What Is Tool Calling? LLM Function Calling Explained
  18. 18MCP Tools vs Resources vs Prompts (With Python Examples)
  19. 19How to Connect MCP Servers to Your AI Agent in Python
  20. 20Build a Production MCP Server in Python (Step by Step)
  21. 21MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. 22MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. 23OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. 24MCP Authentication in Python: API Keys, JWT and OAuth
  25. 25Build an Authenticated MCP Server for Your AI Agent (Python)
  26. 26MCP Security Best Practices: A Checklist for MCP Servers
  27. 27Testing MCP Servers in Python: pytest Without a Live Server
  28. 28Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. 29Idempotent Tool Calls: Make AI Agent Retries Safe
  30. 30AI Agent Tool Failures: Stop Unsafe Workarounds
  31. 31MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. 32MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. 33MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. 34LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained
← Path overview

An AI agent is software in which a language model picks its own next step, asks for a tool to carry it out, and repeats until the goal is met. The label also gets stuck on chatbots, workflow tools and fully autonomous systems, depending on who is selling it. This page gives developers a precise definition, shows how the agent loop works, walks through one real run, and compares agents with chatbots, workflows and assistants.

[01]

What is an AI agent?

An AI agent is a program in which a large language model (LLM) decides, step by step, what to do to reach a goal. It calls tools such as APIs, databases or code, reads each result, and picks the next step until it can answer or hits a limit. The model chooses the actions; your code runs them.

Key takeaways:

  • The loop is what makes it an agent. A single model call is a completion. A model that keeps choosing tools until the task is done is an agent.

  • The model never runs anything. It writes a structured request ("call get_order with A-1042"). Your application executes it and sends back the result.

  • Agents trade control for flexibility. A workflow follows a path you wrote. An agent picks its own path, which handles messy tasks better and fails in less predictable ways.

  • Limits are part of the design. Every agent needs a cap on rounds, time or cost, and a human check before risky actions.

Anthropic's Building effective agents draws the same line: workflows run LLMs and tools "through predefined code paths", while agents are systems where LLMs "dynamically direct their own processes and tool usage". Simon Willison's shorter version is that an LLM agent "runs tools in a loop to achieve a goal".


[02]

How does an AI agent work?

Every agent is built from four parts:

  • A model that reads the conversation and decides the next step.

  • Instructions (the system prompt) that set the goal, the rules and the tone.

  • Tools: functions the model may ask for, each described by a name, a description and a JSON schema for its arguments.

  • A loop in your code that sends the model's tool requests to the right function, adds each result to the conversation, and calls the model again.

A user goal goes to the model, which decides the next step and can ask for a tool call such as get_order(A-1042); your code runs the tool and adds the result to the conversation. The loop repeats until the model answers or a limit on rounds, time or cost stops it.
FigureThe agent loop: the model decides the next step and your code runs the tool

Most agents add three more things as they grow. Memory keeps facts across conversations. Retrieval gives the agent a search tool over your documents (see agentic RAG). Guardrails and approvals check inputs, outputs and risky tool calls (see LLM guardrails and human in the loop). The code around the model that handles all of this, from the loop to limits and context management, is often called the agent harness.

The loop pattern is older than today's chat models. The ReAct paper (Yao et al., 2022) showed that interleaving reasoning steps with actions improved results on question answering and interactive tasks. Modern tool calling APIs build that pattern into the model's output format. AI agent reasoning patterns covers ReAct and its successors.


[03]

An AI agent example

Here is a support agent with two tools, built with Promptise Foundry. To answer "When will order A-1042 arrive?" it needs two steps, and only the first result tells it what the second step is.

Pythonagent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import asyncio

from promptise import build_agent, tool

ORDERS = {"A-1042": {"status": "shipped", "carrier": "UPS", "tracking": "1Z999"}}
TRACKING = {"1Z999": "Out for delivery, expected today by 6 pm"}


@tool
def get_order(order_id: str) -> dict:
    """Look up an order by its ID."""
    return ORDERS.get(order_id, {"error": f"No order {order_id}"})


@tool
def track_package(tracking_number: str) -> str:
    """Get the latest carrier update for a tracking number."""
    return TRACKING.get(tracking_number, "Unknown tracking number")


async def main():
    agent = await build_agent(
        model="openai:gpt-5-mini",
        instructions="You are a support agent. Use your tools, then answer in one sentence.",
        extra_tools=[get_order, track_package],
        max_agent_iterations=10,
    )
    try:
        result = await agent.ainvoke(
            {"messages": [{"role": "user", "content": "When will order A-1042 arrive?"}]}
        )
        for msg in result["messages"][1:]:  # skip the user's message
            for call in getattr(msg, "tool_calls", None) or []:
                print(f"model asks for  {call['name']}({call['args']})")
            if msg.type == "tool":
                print(f"tool returns    {msg.content}")
            elif msg.content:
                print(f"final answer    {msg.content}")
    finally:
        await agent.shutdown()


asyncio.run(main())

Real output from one run with gpt-5-mini:

Output
model asks for  get_order({'order_id': 'A-1042'})
tool returns    {"status": "shipped", "carrier": "UPS", "tracking": "1Z999"}
model asks for  track_package({'tracking_number': '1Z999'})
tool returns    Out for delivery, expected today by 6 pm
final answer    Your order A-1042 is out for delivery and is expected to arrive today by 6 PM.

Nobody told the agent to call track_package. The first tool result contained a tracking number, and the model decided that the next step was to look it up. That decision is what separates an agent from a script. The max_agent_iterations=10 argument is the limit from the diagram: if the model kept calling tools, the run would stop.

The tools here are plain functions. Promptise's @tool decorator builds each tool's name, description and argument schema from the function's name, docstring and type hints. In a real system they would often live in an MCP server, so the same tools work across agents and apps; What is MCP explains how. To build a complete agent step by step, follow How to build an AI agent in Python.


[04]

AI agent vs chatbot, workflow and assistant

Term

Who decides the steps

Uses tools

Example

Chatbot

Nobody: one model reply per message

Usually not

A FAQ bot answering from its training data

LLM workflow

You, in code (fixed path)

Yes, at fixed points

Classify a ticket, then route it, then draft a reply

AI assistant

The user, turn by turn

Sometimes

A chat app that searches the web when asked

AI agent

The model, within limits you set

Yes, in a loop

A support agent that looks up an order, tracks it and answers

Multi-agent system

Several agents, one delegating to others

Yes

A coordinator that hands research to one agent and writing to another

The lines blur in products. A chat assistant that calls several tools in a row is running an agent loop inside each turn. A workflow can contain an agent as one of its steps. The useful question is not "is it an agent?" but "who decides the next step, and what stops it?". For several agents working together, see multi-agent systems.


[05]

Common misconceptions about AI agents

"An agent is a smarter model." The model is the same one you use for chat. The agent is the loop, the tools and the limits around it. A better model makes better decisions inside the loop, but it doesn't create the loop.

"Agents work on their own, so you don't need to watch them." Agents get stuck repeating a call, misread a tool result or take an action nobody intended. Production agents need a cap on rounds and cost, traces of every tool call, and a human approval step for actions such as refunds or deletes. AI agent stuck in a loop shows what happens without them.

"More tools make a more capable agent." Each tool's schema is sent to the model on every call. Dozens of similar tools cost tokens and make the model pick the wrong one more often. A few clear tools beat many vague ones.

"Every LLM feature should be an agent." If you can write the steps down in advance, a workflow is cheaper, faster and easier to test. Use an agent when the next step depends on what the previous one found.


[06]

Frequently asked questions

What is an AI agent in simple terms?

An AI agent is a program that uses a language model to decide which actions to take, such as looking up an order or searching documents, and keeps going until the task is done. The model chooses each step, and ordinary code carries it out and reports back what happened.

What is the difference between an AI agent and a chatbot?

A chatbot answers each message with one model reply. An AI agent can take several actions before it answers: it calls tools, reads their results and decides what to do next. A chatbot that can look things up and act on them, in a loop, is an agent.

Do AI agents run the tools themselves?

No. The model only writes a structured request with a tool name and arguments. Your application, or the agent framework you use, runs the function and sends the result back to the model. That is why you can check, approve or block every action before it happens.

What are examples of AI agents?

Common examples are support agents that look up orders and issue refunds, coding agents that read files, run tests and edit code, research agents that search and summarize sources, and operations agents that check monitoring data and open tickets. Each one combines a model, a few tools and a loop.

Do I need a framework to build an AI agent?

No. A minimal agent loop is about 30 lines of code against a model API. An agent framework helps once you need tool servers, retries, limits, approvals, tracing and memory, because you would otherwise write and maintain all of that yourself. Python AI agent frameworks compared helps you choose.

Are AI agents safe to use in production?

They can be, with the right controls: least-privilege tools, a cap on rounds and spending, guardrails on inputs and outputs, traces of every call, and human approval for actions that are expensive or hard to undo. Treat every tool result as untrusted input, because it can contain instructions aimed at the model.


[07]

Next steps

  • Build one: How to build an AI agent in Python.

  • Understand the code around the model: What is an agent harness?

  • Give it tools: What is MCP?

  • Keep a human in charge of risky actions: AI agent human in the loop.

  • All guides on the topic: the AI agents hub.

  • Reference: Building agents in the Promptise docs.

Next lesson →How to Build an AI Agent in Python (2026 Guide)