Skip to main content

AI Agent

Runs an autonomous AI agent that can make HTTP requests to complete a task. Unlike the AI Text node, which sends a single prompt and returns the response, the AI Agent node gives the model a goal and lets it decide for itself what HTTP calls to make in order to reach a final answer.

How it works

The agent uses the ReAct pattern (Reason + Act):

  1. The model receives the system prompt and task.
  2. The model reasons about what information it needs and calls the http_request tool.
  3. The HTTP response is fed back to the model.
  4. The model either calls another tool or returns a final answer.
  5. This repeats up to Max Iterations times.

This is the same pattern used by AI assistants that "search the web" or "call an API" to answer questions — the model drives the process, not the workflow.

Properties

PropertyRequiredDescription
ModelNoThe language model to use. Defaults to the model configured in your deployment settings
System PromptYesDefines the agent's role and what it should do. Should describe the goal and any constraints. Supports expressions
TaskYesThe specific task to complete. Supports expressions
Max IterationsNoMaximum number of tool call / response cycles before giving up (default: 10)

Model options

See AI Text → Model options. The same models are available. For agentic tasks, models with stronger reasoning (Claude 3.5 Sonnet, GPT-4o) tend to produce more reliable results than smaller models.

Built-in tool: http_request

The agent has access to one tool: http_request. It can call any URL with any method, body, and headers.

ParameterRequiredDescription
urlYesThe URL to request
methodNoGET, POST, PUT, DELETE, or PATCH (defaults to GET)
bodyNoJSON string body for write requests
headersNoKey/value HTTP headers

The tool returns statusCode, contentType, and the response body. JSON responses are automatically parsed so the model receives structured data rather than raw text.

Non-JSON response bodies are truncated to 4 000 characters to avoid exceeding the model's context window.

Output

FieldTypeDescription
answerStringThe agent's final answer
modelStringThe model ID that was used
iterationCountNumberHow many LLM calls were made
toolCallCountNumberHow many http_request calls were made

Access these downstream via expressions:

{{ $nodes['Research Agent'].answer }}
{{ $nodes['Research Agent'].toolCallCount }}

Examples

Look up live exchange rates

  • System Prompt: You are a currency conversion assistant. Use the http_request tool to fetch live exchange rate data from a public API, then answer the user's question.
  • Task: What is {{ $nodes['Form'].amount }} USD in EUR right now?

Enrich a contact record

  • System Prompt: You enrich company records. Given a company domain, use the http_request tool to look up publicly available information and return a JSON object with "name", "description", and "country".
  • Task: Enrich the company with domain: {{ $nodes['Webhook'].body.domain }}

Conditional multi-step API interaction

  • System Prompt: You interact with a REST API on behalf of the user. The base URL is https://api.example.com. Use the Authorization header "Bearer {{ $env.API_TOKEN }}" on every request. Complete the task by making whatever API calls are necessary.
  • Task: Create a new project called "{{ $nodes['Form'].projectName }}", then add the user with email "{{ $nodes['Form'].email }}" to it.

Notes

  • The node fails if the model does not return a final answer within Max Iterations cycles. Increase the limit for tasks that require many lookups.
  • The agent can access any URL reachable from your worker host. If you need to restrict which URLs the agent can call, set your system prompt to explicitly require the agent to use specific base URLs.
  • Use the iterationCount and toolCallCount output fields to monitor cost and complexity in your execution logs.
  • For simple single-call AI operations, use AI Text instead — it is faster and cheaper.