AI Agent

An autonomous AI agent that uses a ReAct (Reasoning + Acting) loop to process messages, call tools, and generate responses. Connect any action node as a tool, attach memory for conversation context, and choose from OpenAI, Anthropic, or any OpenAI-compatible LLM provider.

When to Use

Use AI Agent when you need an LLM to reason about inputs and dynamically decide which tools to call:

  • Building a chatbot or conversational assistant
  • Creating a customer support agent that searches knowledge bases and calls APIs
  • Orchestrating multi-step tasks where the LLM decides the next action
  • Processing unstructured data with natural language understanding

Inputs

HandleTypeDescription
messageanyThe input message or data for the agent to process. Typically a user's chat message or a structured payload from a trigger.

Special Handles

HandleTypeDescription
ToolsdynamicConnect any action node (HTTP Request, Code, MCP Server, etc.) to give the agent tools it can call. Multiple tools can be connected — each appears as a new handle slot.
MemorymemoryConnect a memory plugin (Window Memory or Qdrant Memory) to give the agent conversation history across messages.

Output

HandleTypeDescription
responseobjectThe agent's response after completing its reasoning loop.

The response (accessed as {{ ai_agent.* }}) shape:

FieldTypeDescription
answerstringThe agent's final text response to the user.
tool_callsarrayList of tool calls made during the reasoning loop, including tool name, arguments, and results.
iterationsnumberHow many reasoning iterations the agent performed before producing a final answer.

Additional output fields:

FieldTypeDescription
usageobjectToken usage statistics from the LLM (prompt tokens, completion tokens, total).
warningstring | nullWarning message if the agent hit max iterations or encountered a recoverable issue.

Error Branch

The agent has a control output handle On Error. If the LLM API call fails (invalid key, model not found, rate limit exhausted after retries), execution routes through this handle instead of response. Connect it to a Return node to send a custom error response.

Settings

Model

SettingTypeDefaultDescription
providerselectopenaiLLM provider: OpenAI, Anthropic, or Custom (any OpenAI-compatible endpoint like Ollama, DeepSeek, Together AI).
modelstringgpt-4oModel identifier. Supports bindings for dynamic model selection.
customBaseUrlstringBase URL for custom providers (e.g. http://localhost:11434/v1). Only shown when provider is Custom.
temperaturenumber0.7Sampling temperature. 0 = deterministic, 2 = creative.

Behavior

SettingTypeDefaultDescription
systemPrompttextYou are a helpful assistant.System prompt defining the agent's role and instructions. Supports {{ }} bindings.
maxIterationsnumber10Maximum tool-use iterations before forcing a final answer.
retryCountnumber3Retries for transient LLM API errors (429, 500).

Output

SettingTypeDefaultDescription
outputSchemaJSONJSON Schema for structured output. When set, the agent validates its final answer against this schema.
streamingbooleantrueStream tokens and tool events in real-time via SSE. Required for the Playground chat mode.

Memory

SettingTypeDefaultDescription
sessionKeystringKey for scoping memory per user or thread. Use bindings like user:{{ input.body.user_id }}.

Required Secrets

Environment VariableProviderWhen Required
OPENAI_API_KEYOpenAIWhen provider is openai
ANTHROPIC_API_KEYAnthropicWhen provider is anthropic
CUSTOM_API_KEYCustomWhen provider is custom

Example

Build a simple Q&A agent with web search:

  1. Add a Webhook Trigger (or API Endpoint with OpenAI Chat protocol for SDK compatibility)
  2. Add an AI Agent node and connect the trigger's output to the agent's message input
  3. Add an HTTP Request node configured to call a search API — connect it to the agent's Tools handle
  4. Add a Return node and connect the agent's response output to it
  5. Configure the system prompt: "You are a research assistant. Use the search tool to find accurate information before answering."
  6. Set the provider and model (e.g. OpenAI / gpt-4o)

The agent will receive a user question, decide whether to search, call the HTTP Request tool if needed, and return a grounded answer.

Connecting Tools

Any action node connected to the Tools handle becomes a callable tool. The agent sees the tool's name, description, and expected inputs. During reasoning, it can call any connected tool and use the result.

Common tool combinations:

  • HTTP Request — call external APIs, search engines, databases
  • Code — run custom Python logic, data processing, calculations
  • MCP Server — connect to external MCP-compatible tool servers (Stripe, databases, etc.)
  • Subworkflow — call another Tensorify workflow as a tool

Connecting Memory

Connect a Window Memory or Qdrant Memory node to the Memory handle. The agent loads conversation history before reasoning and saves new messages after responding.

Without memory, each request is independent — the agent has no context from previous messages.

Common Gotchas

  • API keys: Set the provider's API key in your team's Environment Variables (e.g. OPENAI_API_KEY). The agent reads it at runtime.
  • Tool descriptions matter: The agent uses tool names and descriptions to decide which tool to call. Vague names lead to unreliable tool selection.
  • Max iterations: If the agent hits maxIterations, it returns its best answer so far. Increase the limit for complex multi-step tasks.
  • Streaming requires OpenAI Chat protocol: SSE streaming works through the API Endpoint trigger with protocol: openai-chat. The Playground's Chat mode consumes this stream automatically. Manual Trigger does not support streaming.
  • Tool limit: Up to 20 tool connections per agent. If you need more, use MCP Server nodes which bundle multiple tools from a single connection.
  • Default session key: When no sessionKey is set and memory is connected, the agent falls back to agent_memory:{workflow_id}. This means all users share one conversation buffer — always set a session key in production.
  • Output schema + tools/streaming: When tools are connected or streaming is enabled, outputSchema validation is skipped. The agent returns free-form text instead.

See Also

On this page