Work with AI
How to use the AI-related nodes in your workflows — the AI Agent, tools, and Knowledge Base.
Prerequisites:
- At least one AI Provider connection configured (see Connect Services)
The AI Agent Node
The AI Agent node (🤖) in the AI category sends a prompt to an AI language model and stores the response in the result variable.
Required Configuration
| Field | Description |
|---|---|
| AI Provider Integration | Select your configured AI provider connection (e.g., OpenAI, Anthropic) |
| Prompt | The main instruction sent to the AI. Use {varName} to include flow variables. |
Optional Configuration
| Field | Default | Description |
|---|---|---|
| System Prompt | "You are a helpful AI assistant." | Defines the AI's role and behavior. Leave as default or customize. |
| Max Messages to Remember | 10 | How many conversation turns to retain in memory for multi-turn conversations |
| Stream to Chat | Off | If enabled, the AI response streams to the public chat UI in real time |
| Enable Generative UI | Off | (Requires Stream to Chat) Allow the AI to generate interactive UI components |
| Wait for User Response | Off | (Requires Stream to Chat) Pause after the AI responds and wait for user input |
The result Variable
After the AI Agent runs, its output is stored in the result variable. Reference it in subsequent nodes using {result}.
If the AI was instructed to return JSON (e.g., "Return your answer as JSON with fields: summary, category"), you can access specific fields:
{result.summary}— the summary field{result.category}— the category field
Use a Set Variable node after the AI Agent to extract and rename these fields if needed.
Variable Syntax Reminder
Use {varName} (curly braces, no dollar sign) in the Prompt and System Prompt fields:
You are a helpful support agent. The customer's issue is: {customerMessage}
Classify it as: billing, technical, or general.
Return JSON: {"category": "...", "summary": "..."}
Connecting Tools to an AI Agent
Tools extend what the AI Agent can do — searching documents, querying databases, calling APIs, etc. Connect tools to the AI Agent using tool connections.
Adding a Tool
- Add a tool node to the canvas (from the AI category: Knowledge Base Tool, SQL Tool, REST API Tool, etc.)
- Configure the tool in its Step Settings
- Draw a connection from the tool node to the AI Agent node — the connection type changes automatically to Tool Connection (blue)
The AI Agent will call the tool automatically when it decides a tool is needed based on the prompt context. You do not need to explicitly invoke the tool in your prompt.
Knowledge Base Tool
Connect a document collection to the AI Agent for RAG (retrieval-augmented generation):
- Upload documents to a collection in the Knowledge Base (via Upload in the top nav) — see Knowledge Base
- Add a Knowledge Base Tool node to the canvas
- In its Step Settings, select your collection
- Connect the Knowledge Base Tool to your AI Agent node
The AI will search the collection at runtime when it needs information to answer a question.
SQL Tool
Let the AI query a database:
- Add a SQL Tool node
- Select your database connection in Step Settings
- Connect the SQL Tool to your AI Agent node
The AI generates and executes SQL queries as needed. The database schema is automatically provided to the AI as context.
REST API Tool
Let the AI call an external HTTP API:
- Add a REST API Tool node
- Select your REST API connection in Step Settings
- Connect the REST API Tool to your AI Agent node
MCP Tool
Connect to a Model Context Protocol server:
- Add an MCP Tool node
- Select your MCP connection in Step Settings
- Connect the MCP Tool to your AI Agent node
Multi-Step AI Flows
For complex AI workflows, chain multiple AI Agent nodes:
Start → AI Agent (classify) → If/Else → AI Agent (respond) → End
→ AI Agent (escalate) → End
Each AI Agent stores its output in {result}. Use a Set Variable node between AI Agents to rename {result} to a descriptive variable (e.g., {classification}) before it is overwritten by the next AI Agent.
Streaming to Chat (Public Workflows)
For public-facing chat workflows, enable Stream to Chat on the AI Agent:
- Enable Stream to Chat in the AI Agent's Step Settings
- Optionally enable Wait for User Response to pause after each AI reply
- Publish the workflow and share the public URL (via Share in the designer toolbar)
Users who open the public URL see a chat interface where the AI's responses stream in real time.
See Build Public Forms for the full public workflow setup.