What are Agents?
Agents let you build AI workflows in which a model selects tools and sequences calls based on a goal. Unlike 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.
How Agents work
During a run, the model uses three kinds of input:
- Goal: The outcome that you want to achieve.
- Tools: The functions that the model can call.
- Context: The instructions and information relevant to the task.
The model can follow this cycle during a run:
- Analyze the goal and context.
- Select one or more available tools.
- Call the selected tools with parameters.
- Use the results to produce a response or continue with another tool call.
Enable Agent Loop to repeat this cycle across turns. The loop stops when the model returns a response or reaches Max Turns.
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 inputs:
- Goal: Research competitor releases from the previous week and summarize key features.
- Tools: Exa for web search, Firecrawl for page extraction, and a custom JavaScript tool for report formatting.
- Context: The competitor’s domain and the keywords that Alex wants to track.
When Alex runs the Agent for Example Organization, the model can follow this path:
- Search Exa for recent articles about Example Organization and its launches.
- Use Firecrawl to extract a matching blog post.
- Use Firecrawl again when the post mentions a documentation page.
- Analyze both sources and identify three features.
- Use the custom tool to format a Markdown report.
- 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 Agents for tasks that need model-selected actions or multiple rounds of tool use. Common examples include:
- Research that spans sources in different locations.
- Open-ended problem solving.
- Tasks in which the next action depends on an earlier result.
- Workflows in which the path changes with the input.
Choose Flows for tasks with:
- Predictable, repeatable steps.
- A fixed set of operations.
- A required execution order.
- Performance requirements that benefit from defined steps.
Start with a Flow when you know the required steps. Choose an Agent when the model must select the next action from the available tools.
Available tools
Agents support several tool types. For an overview, see What are Tools?.
- Built-in tools: Use tools such as GPT Image 2, Exa, Firecrawl, and Semantic Search.
- Custom tools: Run JavaScript, TypeScript, or Python code that you write.
- 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.
Next steps
Continue with these pages:
- Creating and configuring Agents: build and test an Agent.
- Manage Agents as code: version-control Agent definitions and converge them at deploy time.
- Agent tools: configure tool selection and limits.
- Built-in tools: explore tools provided by Runtype.
- Agent and Flow templates: start with an example Agent or Flow.
- Marathon: long-running agent tasks (CLI): run an Agent across multiple CLI sessions.