AI Agent
Gives an AI model a task and a set of tools, and lets it decide which tools to call, in which order, until it
has an answer. Tools are the steps you connect to the agent's Tools port, plus a built-in http_request
tool.
For a single prompt with no tools, AI Text is faster and cheaper.
How it works
- The model receives the system prompt, the task (and any memory or files).
- It either answers, or calls one or more tools.
- Tool results go back to the model, and it decides again.
- This repeats until it answers or reaches Max Iterations. At the limit, the model is asked once more —
without tools — for its best answer, and
stoppedAtMaxIterationsistrue.
The agent then continues from its Output port.
Properties
The provider settings are the same as for AI Text: Provider (OpenAI, Anthropic, OpenRouter, Azure OpenAI, Google Gemini, Mistral, OpenAI-compatible), AI Provider Connection (see AI provider connections), Base URL and Model. So are Temperature, Max Output Tokens, Top P, Reasoning Effort, Images / Files and Structured Output (JSON Schema).
| Property | Required | Default | Description |
|---|---|---|---|
| System Prompt | Yes | — | The agent's role, goal and rules |
| Task | Yes | — | What to do this run. Supports expressions |
| Max Iterations | No | 10 | Model turns before the agent must answer (1–100) |
| Allow HTTP requests tool | No | On | Offer the built-in http_request tool |
| Tools requiring human approval | No | — | Comma-separated tool names, or * for all. The run pauses before each call to one of these tools until someone approves or rejects it. See Tool approval |
| Approval timeout (minutes) | No | — | How long a tool call waits for a decision. Empty: wait until someone decides. On timeout the call is refused |
| Memory Session ID | No | — | Turns on memory for this conversation (see Memory) |
| Memory Window (messages) | No | 20 | How many recent messages are remembered |
| Memory TTL (minutes) | No | 1440 | How long a conversation is remembered after its last use |
Tools
Tools from your library and MCP servers
Tools, knowledge bases and MCP servers adds tools without wiring steps:
- Add a tool picks from What AI can use: building blocks and app actions with Let AI use this on, quick tools (an HTTP request or code), workflows and knowledge base searches — each with a description and a described set of inputs. Items marked Ask a person before it runs always pause for approval; paused items (Let AI use this off) are skipped and the step's log says so.
- Add a knowledge base lets the agent search a knowledge base — no Search Knowledge
step needed. The tool is called
search_<name>and returns passages with numbered citations the agent can quote. - Add MCP server picks an MCP server connection; tick the server's tools the agent may use.
Every call — from any source — is listed in the step's Tool calls tab in the run details, with arguments, result, duration and source. Secret values are masked.
Blocks as tools
Connect steps to the agent's Tools port. Each one becomes a tool:
- Name — the step's name, with characters other than letters, digits,
_and-replaced by_. - Description — the step's description. Write it for the model: what the tool does and when to use it.
- Arguments — every
$vars.tool.<name>(or$vars.tool['name']) you use in the step's settings becomes a required text argument. When the model calls the tool, its values are available as$vars.tool.
Tool steps run inside the agent's step, with the same context as the agent ($nodes, $trigger, secrets,
environment). Their output is returned to the model. After the agent finishes, the tool steps show as skipped
on the canvas — they are not part of the normal flow.
Example — a tool named get_weather: an HTTP Request step with the URL
https://api.example.com/weather?city={{ $vars.tool.city }}. The model sees a tool get_weather with a
required argument city.
These steps can't be used as tools because they pause the workflow: triggers, Approval Gate, Loop, Join, Wait,
Integration Input/Output and another AI Agent. They are listed in the output's warnings instead.
Building blocks as tools
A Building block step connected to the Tools port is offered as a tool like
any other step. When the model calls it, the agent pauses while the building block runs as a child run, then
continues with the building block's output as the tool result ({ "output": … }, or { "error": … } if the
building block failed).
This also works when your project runs on a self-hosted worker: the agent waits on your worker and continues there with the result.
Built-in http_request
When Allow HTTP requests tool is on, the model can call any public URL:
| Argument | Required | Description |
|---|---|---|
url | Yes | Absolute http/https URL |
method | No | GET (default), POST, PUT, PATCH, DELETE or HEAD |
body | No | Request body; sent as JSON when it is valid JSON |
headers | No | Request headers |
It returns the status, content type and body (truncated to 8000 characters) and times out after 30 seconds. Private and internal addresses are blocked, so a prompt can't make the agent reach your internal network. Turn the tool off if the agent should only use your own steps.
Tool approval
List sensitive tools in Tools requiring human approval, separated by commas, or enter * for all tools
(including http_request). Use the tool names the model sees, e.g. create_refund, http_request.
When the model calls one of these tools:
- The agent pauses before the call runs. The run gets the status Awaiting approval and the agent's step shows Pending approval, just like an Approval Gate. No worker is busy while it waits.
- Someone approves or rejects the call, from the run page or the editor canvas. See Approvals.
- The agent continues where it stopped, with the same conversation. Calls that already ran are not repeated.
| Decision | What the model gets |
|---|---|
| Approve | The tool runs and its result goes back to the model. |
| Reject | The call is refused. The model is told a human rejected it, with your reason if you entered one, and continues without it. |
| Timeout | If Approval timeout (minutes) is set and nobody decides in time, the call is refused and the model continues without it. The step doesn't fail. |
A run can pause several times, once per gated call. The conversation saved while paused is limited to 256 KB; if it's larger, the step fails with a message asking you to lower Max Iterations or make the tools return less data.
Memory
Set Memory Session ID to an expression that identifies the conversation, such as a user or chat id:
{{ $trigger.body.userId }}
The agent then remembers earlier tasks and answers for that id — up to Memory Window messages, for Memory TTL minutes after the last use. Memory is kept per workflow, per agent step and per session id. Only the tasks and final answers are stored, not tool calls. Leave the field empty for no memory.
Structured output
With a Structured Output JSON Schema, the final answer must be JSON that matches it. If it doesn't, the agent
gets one chance to correct it; otherwise the step fails. The parsed value is in structured. See
AI Text → Structured output.
Output
| Field | Type | Description |
|---|---|---|
answer | String | The final answer |
structured | Object | The parsed answer when a schema is set, otherwise null |
iterationCount | Number | Model turns used |
toolCallCount | Number | Tool calls made |
toolCalls | Array | Every call: iteration, tool, arguments, result (first 2000 characters), isError, durationMs |
stoppedAtMaxIterations | Boolean | true if the agent hit Max Iterations |
model | String | The model that answered |
finishReason | String | Why the model stopped |
usage | Object | Tokens and estimated cost for the whole run, as in AI Text |
warnings | Array | Only present when connected steps couldn't be used as tools |
{{ $nodes['Research Agent'].answer }}
{{ $nodes['Research Agent'].usage.estimatedCostUsd }}
Examples
Support agent with your own tools
- Tools port → HTTP Request lookup_order (URL
https://shop.example.com/api/orders/{{ $vars.tool.orderId }}, description "Look up an order by its id"), and HTTP Request create_refund (description "Refund an order"). - Tools requiring human approval:
create_refund(a person approves every refund before it is made). - Approval timeout (minutes):
60(unanswered refunds are refused after an hour). - System Prompt:
You answer customer questions about orders. Look orders up before answering. - Task:
{{ $trigger.body.message }} - Memory Session ID:
{{ $trigger.body.customerId }}
Enrich a company record as JSON
- System Prompt:
Use http_request to find public information about the company. - Task:
Company domain: {{ $trigger.body.domain }} - Structured Output:
{ "type": "object", "properties": { "name": { "type": "string" }, "country": { "type": "string" } }, "required": ["name"] }
Notes
- Keep secrets out of prompts. Put sign-in details in the tool steps (connections,
$secrets) rather than telling the model a token. - Use
toolCallsandusagein the run page to see what the agent did and what it cost.