Skip to main content
Embedded AI agent that can use tools, access data, and have multi-turn conversations with users.

Execution behavior

Unlike other nodes that execute and immediately advance, agent nodes maintain workflow execution at the node until the agent explicitly calls the complete_task tool. This allows:
  • Multi-turn conversations: Agent can exchange multiple messages with the user
  • Stateful execution: Maintains conversation context throughout
  • Tool orchestration: Decides when to call tools, send messages, or complete
  • Dynamic input: New user messages are automatically injected into the agent’s conversation
  • Controlled completion: Workflow only advances when agent determines task is done

Configuration

  • id: Unique node identifier
  • system_prompt: Instructions for the agent’s behavior
  • provider_model_id: AI model to use
  • temperature: Model creativity, 0.0-1.0 (default: 0.0)
  • max_iterations: Maximum tool calls/responses (default: 80)
  • max_tokens: Maximum tokens per response (default: 8192)
  • reasoning_effort: For o1 models - low, medium, high (optional)
  • prompt_cache_ttl: Prompt cache lifetime, 5m or 1h (default: 5m)
  • flow_agent_webhooks: Custom API tools (optional)
  • flow_agent_function_tools: Deployed functions as tools (optional)
  • flow_agent_mcp_servers: MCP server tools (optional, HTTP streamable only)
  • enabled_default_tools: Built-in tools enabled for the agent node
  • default_tool_configs: Optional configuration for built-in tools
  • sandbox_enabled: Enables the remote sandbox for this node
  • sandbox_network_mode: Sandbox outbound policy, allow_all or allow_list
  • sandbox_allowed_outbound_hosts: Extra outbound hosts allowed when using allow_list
  • flow_agent_resources: Repository resources mounted into the sandbox
  • observer_prompt_mode: Behavior when outbound disabled (advanced, see below)
  • message_delivery_mode: Message delivery behavior, auto_send_assistant_text or tool_only
  • ui_skills: Buttons, lists, WhatsApp Flows, and other rich messages the agent can send (optional, see Agent UI skills)

Prompt caching

prompt_cache_ttl controls how long reusable prompt content stays cached between agent turns.
  • 5m: Default.
  • 1h: Longer cache lifetime with a higher cache-write cost. Only accepted for Anthropic models, including Anthropic models served through OpenRouter. Setting it on any other model is rejected.
Check supported_prompt_cache_ttls on GET /platform/v1/provider_models to see which values a model accepts.

Message delivery mode

Use message_delivery_mode to control whether normal assistant text is sent to the WhatsApp user.
  • auto_send_assistant_text: Normal assistant text is sent automatically. This is the default.
  • tool_only: Normal assistant text is kept internal. The agent must call send_notification_to_user for every user-visible message, including questions.
When using tool_only, enable send_notification_to_user and enter_waiting. Call enter_waiting after sending a question that needs a reply. tool_only needs forced tool calls, which some Anthropic models do not accept. claude-fable-5-1, claude-opus-5-5 and claude-sonnet-5-5 are rejected with a provider_model validation error when the node uses tool_only. Use auto_send_assistant_text with those models.

Emitting project events

Enable the built-in emit_event tool when an agent should record outcomes, labels, scores, or other project events during its work. In the dashboard, you can choose which event definitions the agent may emit:
  • Select one event definition when the agent should only fill properties for that event.
  • Select multiple event definitions to give the agent a small allowlist.
  • Leave the selection empty to allow the agent to emit any valid project event.
When using the Platform API directly, include emit_event in enabled_default_tools. To restrict the agent to specific event definitions, also set default_tool_configs.emit_event.event_definition_ids:
Agent-emitted events follow the same validation, plan, usage, and loop-prevention rules as other workflow event emission. See Events for limits and behavior.

Remote sandbox

Enable the remote sandbox when the agent needs a disposable workspace to inspect or modify repository files during execution. When sandbox access is enabled and at least one repository has valid credentials, the agent gets these repository tools:
  • bash
  • read
  • list_dir
  • write
  • edit
Configured repositories are cloned into /workspace/repos/<repo-slug> before those tools run.
Remote sandbox is in beta. Sandbox usage is free during the beta. Pricing may change later.

Repository resources

Repository resources are separate from agent tools. They are mounted only when sandbox_enabled is true.
  • v1 supports GitHub repositories only
  • Use a repository root URL like https://github.com/org/repo or git@github.com:org/repo.git
  • GitHub file, subdirectory, and tree/... URLs are not valid here
  • Saved responses never echo credentials back; they return metadata such as auth_type, has_pat, has_github_app, and github_app_installation_id
Set auth_type to choose how the sandbox authenticates:
  • pat: send a GitHub Personal Access Token in pat. Required for a new PAT-backed resource unless one is already stored.
  • github_app: connect a GitHub App to the project first, then send github_app_installation_id for an active connection that grants access to the repository.
  • public: no credentials; clears any stored PAT or App connection.
Manage which repositories the App can access in GitHub. Duplicating or importing a workflow across projects does not carry App connections over: the resource comes back with imported_missing_github_app: true and needs a connection selected before the workflow runs.

Sandbox network

Use sandbox_network_mode to control outbound network access from the sandbox:
  • allow_all: allow all outbound hosts
  • allow_list: only allow sandbox_allowed_outbound_hosts
When GitHub repositories are attached, Kapso automatically adds the GitHub hosts needed to clone and read them. You only need to add extra hosts your workflow depends on.

Example

Custom tools

Extend agent capabilities with external integrations.

Webhook tools

Call external APIs during agent execution. Configure URL, method, headers, and body with variable interpolation.

Function tools

Call deployed functions (Cloudflare Workers) as agent tools. Each function tool has:
  • Name: Tool identifier the agent calls (letters, numbers, underscores, dashes)
  • Description: Tells the agent when to use this tool
  • Function: Select a deployed function
  • Input Schema: Define the arguments the agent can pass
Payload structure:
The agent only controls input. Kapso automatically injects the rest. Read it in your function like this:
Response format: Return JSON. Include a vars object to update flow variables:

Knowledge bases

Attach inline text the agent can search. Each knowledge base becomes its own tool, so an agent can hold several and pick between them.
  • Name: Shown to the agent and used to derive the tool name (search_faq for a knowledge base named “FAQ”). Accents are folded and non-alphanumeric characters become underscores. When two names produce the same tool name, or the name collides with a function, webhook or MCP tool, Kapso appends _2, _3, and so on.
  • Description: Included in the tool description so the agent knows which knowledge base holds what. Worth filling in when an agent has more than one.
  • Content: The searchable text, one fact per line.
Retrieval is keyword-based, not semantic. The agent’s query is split into terms, accent-folded, lowercased, and common Spanish/English/Portuguese stopwords are dropped. Each line is scored by how many query terms prefix one of its words — anticoncep matches anticonceptivo, but uso does not match abuso. The top 12 lines are returned with their neighbouring lines for context, capped at 6,000 characters. Because matching is by keyword, phrase content the way a user would ask about it, and keep each line self-contained.

MCP servers

MCP server URLs and headers support variable substitution:
Supported: {{vars.*}}, {{system.*}}, {{context.*}}, ${ENV:KEY}
URLs resolving to localhost or private IPs will fail in production (SSRF protection).

UI skills

Let the agent send reply buttons, lists, URL buttons, WhatsApp Flows, images, locations, location requests, and carousels. Each skill becomes a send_ui_<key> tool. Add them in the Tools tab under UI Skills. See Agent UI skills.

Observer mode

When a workflow runs with outbound messages disabled (allow_outbound: false), the agent operates in “observer mode”. The observer_prompt_mode setting controls how the agent behaves:
  • interactive_chat (default): Agent chats with the operator via the Workflow Chat sidebar in the inbox. Use for workflows where human review or input is needed.
  • analysis_only: Agent runs non-interactively with no chat interface. Use for background analysis or logging workflows.
The Workflow Chat sidebar appears in the inbox when viewing conversations with active observer-mode executions.

Built-in tools

Send a message to the user without waiting for a response.Parameters:
  • message (string, required): The text message to send
Usage: Send progress updates, confirmations, or notifications
Send media files to the user via WhatsApp.Parameters:
  • media_url (string, required): URL of the media file
  • media_type (string, required): “image”, “video”, “audio”, or “document”
  • caption (string, optional): Caption for the media
Usage: Share images, documents, or other media content
Access flow execution context and variables.Parameters: NoneReturns: Flow variables, execution context, and metadataUsage: Access stored data and flow state information
Get WhatsApp conversation details.Parameters: NoneReturns: Phone number, conversation ID, and contact informationUsage: Access user contact details for personalization
List or read older WhatsApp conversations for the current contact.Parameters:
  • action (string, required): Use "list" to return older conversations, then "read" to inspect one conversation
  • conversation_id (string, required for read): Conversation ID returned by list
  • limit (number, optional): Limits conversations for list or messages for read
Returns: Matching contact details, prior conversation IDs, statuses, timestamps, and message snippetsUsage: Give an agent context from earlier support conversations before it answers a returning WhatsApp contact
Store data for use in later flow steps.Parameters:
  • variable_name (string, required): Variable name to save
  • value (string, required): Value to store. The tool receives this as a string and parses it using value_type
  • value_type (string, required): One of string, integer, float, boolean, array, or object
Type rules:
  • Use integer for whole numbers, e.g. value: "42"
  • Use float for decimals, e.g. value: "19.99"
  • Use boolean with value: "true" or value: "false"; yes/no, 1/0, and on/off are also accepted
  • Use array with a valid JSON array string, e.g. value: "[\"small\", \"medium\"]"
  • Use object with a valid JSON object string, e.g. value: "{\"plan\":\"pro\",\"seats\":3}"
  • Do not use the legacy key parameter
Usage: Save user data, API responses, or calculated values
Retrieve previously stored data.Parameters:
  • variable_name (string, required): Variable name to retrieve. Use "*" to retrieve all variables
  • include_metadata (boolean, optional): Include inferred type and size metadata
Do not use the legacy key parameter.Usage: Access data saved in earlier steps
Get the current date and time.Parameters: NoneReturns: Current timestamp in ISO formatUsage: Time-based logic and timestamp generation
Complete the agent’s task and continue the flow.Parameters: NoneUsage: Signal task completion and advance to next step
Transfer the conversation to a human agent.Parameters:
  • reason (string, optional): Reason for handoff
Usage: Escalate complex issues to human support
Pause the workflow execution and enter waiting state. The conversation can resume when the user sends a new message.Parameters: NoneUsage: Wait for user input mid-conversation without completing the taskHow it works:
  • Agent pauses execution at the current node
  • Workflow enters “waiting” state
  • When user sends a new message, workflow resumes and the agent continues from where it left off
  • Agent retains full conversation context after resuming
Note: This tool is required by default for new workflows (created after Feb 5, 2026). Legacy workflows can enable it as an optional tool.
Analyze files and answer questions about their content. Supports PDFs, images, text files, and Office documents (.docx, .xlsx, .pptx).Parameters:
  • file_url (string, required): Kapso file URL (use WhatsApp media_data.url from get_whatsapp_context)
  • question (string, required): What you want to know about the file
Returns: Answer text, filename, MIME typeLimits:
  • Max file size: 30MB
  • Office docs: Text extracted (DOCX paragraphs, XLSX first 10 sheets/50 rows, PPTX first 40 slides)
  • Legacy formats (.doc/.xls/.ppt) not supported - convert to modern format first
Usage: Summarize documents, extract data from spreadsheets, analyze images
Custom tools for external API integration.Parameters: Defined by webhook configurationUsage: Call external APIs, fetch data, trigger actions

External inputs

When a workflow is resumed via API or receives input from non-WhatsApp sources (e.g., Slack replies, API payloads), the agent automatically tags these as external inputs to distinguish them from direct user messages. How it works: External inputs are wrapped in <external_input> tags when presented to the agent:
The agent’s system prompt includes context that these inputs are from internal teams or external systems, not the WhatsApp user. This helps the agent:
  • Understand the input source
  • Adapt its tone (e.g., acknowledge internal team input differently than user messages)
  • Make better decisions about what to communicate to the end user
Triggering external inputs: External inputs are automatically created when:
  • Resuming a workflow via the Platform API resume endpoint with a payload
  • Using Slack integration to provide internal team responses
  • Triggering workflows via API with initial data
Example workflow: When the Slack reply arrives, it’s tagged as an external input so the agent knows it’s from your team, not the customer.

How it works

  1. Starts conversation: Uses system prompt and conversation history
  2. Tool access: Can call built-in tools and custom webhooks
  3. Multi-turn: Continues until calls complete_task or needs user input
  4. Message injection: New user messages are automatically injected during conversation
  5. External input tagging: API payloads and non-WhatsApp inputs are wrapped in <external_input> tags
  6. Workflow control: Returns next edge when task completed, wait when needs input

Usage patterns

Support workflow Data processing

Workflow library example