> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# What are Agents?

Agents let you build AI workflows in which a model selects tools and sequences calls based on a goal. Unlike [Flows](/user-guide/flows/what-are-flows), Agents adapt the sequence to the task instead of following a fixed sequence that you define.

## How Agents differ from Flows

The following table summarizes the difference between Agents and Flows.

| Flows                          | Agents                         |
| ------------------------------ | ------------------------------ |
| You define each step.          | The model selects actions.     |
| Fixed sequence.                | Dynamic sequence.              |
| Defined, repeatable workflows. | Open-ended or iterative tasks. |
| Predictable execution.         | Adaptive tool use.             |

## Kinds of Agents

Most Agents are one of two kinds:

* **Build an Agent on Runtype.** Choose a model, write a system prompt, and attach tools. Runtype runs the model and its tool calls.
* **Connect an external Agent.** Register an agent that you already run elsewhere by its endpoint or A2A agent card. Runtype sends messages to it like any other Agent. For setup, see [Bring your own agent](/developer-guides/guides/bring-your-own-agent).

The rest of this page describes Agents that you build on Runtype.

## How Agents work

During a run, the model works from three kinds of input. The following list shows where you set each one:

* **Goal**: The outcome that you want. Describe it in the **System prompt** or in the message that starts the run.
* **Tools**: The functions that the model can call. Attach them to the Agent.
* **Context**: The instructions and information for the task. Put standing instructions in the **System prompt**, and pass task data in the message or in variables.

The model follows this cycle during a turn:

1. Analyze the goal and context.
2. Select one or more available tools.
3. Call the selected tools with parameters.
4. Use the results to produce a response or call another tool.

A single turn can include several tool calls, up to the **Max tool calls** limit. By default, a run ends after one turn. To let a run continue into another turn, for example after a turn reaches **Max tool calls**, open the Agent editor and turn on **Agent loop** in the **Loop** section. The run still ends when the model returns an answer, or when it reaches **Max turns**. For both settings, see [Creating and configuring agents](/user-guide/agents/creating-and-configuring-agents#agent-loop).

The model selects tools on its own, but you can keep a person in control of sensitive actions. Turn on **Tool approval** to pause the run before a selected tool runs. Runs with no one to answer the prompt, such as Schedules, Batches, Evals, and Webhooks, are refused when a tool requires approval. For details, see [Safety](/user-guide/agents/creating-and-configuring-agents#safety).

## See an Agent in action

Alex is a product manager at Example Organization. They compile competitive intelligence reports each Monday. Their stakeholders want summaries of what competitors shipped during the previous week. The information is scattered across blog posts, release notes, and documentation sites.

Alex tried building a Flow, but each competitor publishes updates in a different place. Some use blogs, some use documentation, and some use social posts. A fixed sequence cannot adapt to those differences without additional branching.

Alex builds an Agent with the following configuration:

* **System prompt**: The goal (research competitor releases from the previous week and summarize key features), the competitor domains, and the keywords to track.
* **Tools**: Exa for web search, Firecrawl for page extraction, and a custom JavaScript tool for report formatting.
* **Agent loop**: Turned on, so the run can continue if one turn reaches **Max tool calls**.

When Alex runs the Agent for Example Organization, the model can follow this path:

1. Search Exa for recent articles about each competitor and its launches.
2. Use Firecrawl to extract a matching blog post.
3. Use Firecrawl again when the post mentions a documentation page.
4. Analyze both sources and identify three features.
5. Use the custom tool to format a Markdown report.
6. Return the summary to Alex.

Alex does not script these steps. The model selects them from the task, tool descriptions, and results. If Exa returns no recent results, the model can take a different path, such as searching documentation first.

## When to use Agents

Choose an Agent when the model must select the next action from the available tools, such as research across scattered sources or tasks in which the next action depends on an earlier result. Choose a Flow when you know the required steps and their order.

You can also combine them. An Agent can call a published Flow as a tool, and a Flow can run an Agent with an **Execute Agent** step. For the decision criteria and hybrid designs, see [Choosing between a flow and an agent](/user-guide/flows/choosing-between-a-flow-and-an-agent).

## Available tools

Agents support several tool types. The following list shows the common ones. For an overview of every type, see [What are Tools?](/user-guide/tools/what-are-tools).

* **Built-in tools**: Use tools such as GPT Image 2.5, Exa, Firecrawl, and Semantic Search.
* **Custom tools**: Run JavaScript, TypeScript, or Python code that you write. The available languages depend on the runtime that you select. For details, see [Creating custom tools](/user-guide/tools/creating-custom-tools).
* **External tools**: Call HTTP API endpoints.
* **Flow tools**: Call published Flows as tools.
* **MCP tools**: Connect to Model Context Protocol (MCP) servers.
* **Subagent tools**: Delegate a focused task to a child Agent with a subset of tools and isolated context.
* **Skills**: Load instructions and reference material when the task needs them. For details, see [Agent Skills](/user-guide/agents/agent-skills).

## Where Agents run

You can run an Agent from these places:

* The Agent editor, with **Test agent**, while you build it.
* The API, with `POST /v1/agents/{id}/execute`. It streams Server-Sent Events by default, or returns JSON when you set `streamResponse` to `false`.
* A Product, which makes the Agent reachable through [Surfaces](/user-guide/products-surfaces/what-are-surfaces) such as chat, API, MCP, and messaging channels.
* A Flow, with an **Execute Agent** step.

## Next steps

Continue with these pages:

* [Creating and configuring agents](/user-guide/agents/creating-and-configuring-agents): build, test, and add an Agent to a Product.
* [Agent versioning and publishing](/user-guide/agents/agent-versioning-and-publishing): save snapshots of an Agent configuration and restore them.
* [Manage agents as code](/user-guide/agents/manage-agents-as-code): version-control Agent definitions and converge them at deploy time.
* [Agent tools](/user-guide/agents/agent-tools): configure tool selection and limits.
* [Agent Skills](/user-guide/agents/agent-skills): give an Agent loadable instructions and reference material.
* [Importing conversations](/user-guide/agents/importing-conversations): continue a transcript from another system in Runtype.
* [Choosing between a flow and an agent](/user-guide/flows/choosing-between-a-flow-and-an-agent): decide which to build and how to combine them.
* [Built-in tools](/user-guide/tools/built-in-tools): explore tools provided by Runtype.
* [Agent and flow templates](/user-guide/flows/agent-and-flow-templates): start with an example Agent or Flow.
* [Steer an active agent execution](/developer-guides/guides/live-message-steering): send another message to an Agent while it runs.
* [Improving your agents from production traces](/developer-guides/guides/improving-agents-from-production): turn production runs into Agent improvements.
* [Marathon: long-running agent tasks (CLI)](/user-guide/agents/marathon-long-running-tasks): run an Agent across multiple CLI sessions.