Skip to main content

Agent Node


The Agent Node enables AI-powered automation within your workflows. It connects to AI Models and can use tools (Slack, Gmail, GitHub, etc.) to perform multi-step reasoning and task execution. The agent autonomously decides which tools to use and how to combine their results to accomplish complex tasks.

Configuration

Configuring Agent

SettingDescription
System PromptInstructions that define the agent's behavior, persona, and constraints.
User PromptThe task or question for the agent to process. Supports dynamic values using {{ }} syntax.
Output FormatDefines the structure of the agent's final response. Use this to specify a JSON schema or format that the agent should follow when returning results.

AI Model

Connect the Agent node to an AI model datasource by linking it to the ai-model handle on the node.

Supported AI providers:

  • OpenAI
  • Anthropic
  • Gemini
  • Mistral AI

Model Parameters

ParameterDescription
TemperatureControls randomness in responses. Higher values (0-1) produce more creative outputs.
Max TokensMaximum number of tokens the model can generate in a response.
Top PAlternative to temperature for controlling randomness via nucleus sampling (0-1).
Max StepsMaximum number of reasoning steps/iterations the agent can take.
Max RetriesNumber of retry attempts for failed API calls.
TimeoutMaximum time in milliseconds for the agent to complete execution.
Stop SequencesSequences that signal the model to stop generating further text.

Tools

Tools allow the agent to interact with your data and perform actions. Each tool is a workflow node that the agent can invoke. The agent autonomously decides which tools to use based on the task and your system prompt instructions.

To add tools, drag nodes from the Agent node's tool handle to connect datasource queries, REST API calls, JavaScript nodes, or any other workflow nodes.

Agent Tools Configuration

Supported Tool Types

You can use any workflow node as a tool, including:

  • Datasource Queries: PostgreSQL, MySQL, MongoDB, and other database queries
  • REST API: Connect to external services like Slack, GitHub, Gmail, Twilio, etc.
  • JavaScript: Custom logic for data transformation or complex operations
  • ToolJet Database: Query your ToolJet Database tables

Accessing Agent Node Data

Inside Tools

When the agent invokes a tool, it passes parameters that you can access within the tool node. Use the following syntax to retrieve these values:

aiParameters.<paramName>

The parameter names are determined by the agent based on your system prompt instructions. For example, if your system prompt instructs the agent to extract user_email from the user's message, you can access it in your tool as:

aiParameters.user_email

Outside Agent Node

Only the final result of the agent node can be accessed by other nodes in the workflow. If you need specific data in the output, define the expected output format in your system prompt.

To access the agent's output in subsequent nodes, use the following syntax:

<agentNodeName>.data

For example, if your agent node is named agent1:

agent1.data

Use Cases

Slack Notification Agent

Monitor events and send contextual notifications to the right Slack channels.

Tools:

ToolTypeDescription
getAlertDetailsPostgreSQLFetches alert information from the database
getUserOnCallREST APIGets the current on-call engineer
sendSlackMessageSlackSends a message to a Slack channel
createIncidentREST APICreates an incident in your incident management system

System Prompt:

You are an Alert Notification Agent.

When an alert is triggered:
1. Get alert details using "getAlertDetails"
2. Determine severity (critical, warning, info)
3. For critical alerts:
- Get on-call engineer using "getUserOnCall"
- Create incident using "createIncident"
- Send urgent Slack message using "sendSlackMessage"
4. For warnings: send Slack message to #engineering-alerts
5. For info: send Slack message to #system-logs

Always include: alert name, severity, timestamp, and recommended action.
Slack Agent

How It Works:

  Webhook Trigger (alert_id)


Agent Node receives User Prompt
"New alert triggered. Alert ID: {{ startTrigger.params.alert_id }}"


Agent Reasoning
AI model reads system + user prompt, plans tool calls


Tool: getAlertDetails (PostgreSQL)
Fetches severity, service name, timestamp


Severity Check
┌─────────────┬─────────────────┬──────────────────┐
│ Critical │ Warning │ Info │
│ │ │ │ │ │ │
│ ▼ │ ▼ │ ▼ │
│getUserOnCall│ sendSlackMessage│ sendSlackMessage │
│ │ │ #eng-alerts │ #system-logs │
│ ▼ │ │ │
│createIncident │ │
│ │ │ │ │
│ ▼ │ │ │
│sendSlackMsg │ │ │
│ #incidents │ │ │
└─────────────┴─────────────────┴──────────────────┘


Output → agentNodeName.data
Summary: incident ID, Slack message sent, on-call notified
Slack Agent

Email Assistant Agent

Process incoming emails and draft responses or route them to the appropriate team.

Tools:

ToolTypeDescription
getEmailContentGmailFetches email subject, body, and sender info
classifyEmailJavaScriptAnalyzes email intent and urgency
draftReplyGmailCreates a draft response
forwardEmailGmailForwards to the appropriate department
logEmailPostgreSQLLogs the email for tracking

System Prompt:

You are an Email Processing Agent.

For each incoming email:
1. Get email content using "getEmailContent"
2. Classify the email type (inquiry, complaint, order, spam)
3. Based on classification:
- Inquiries: draft a helpful reply using "draftReply"
- Complaints: forward to support team using "forwardEmail"
- Orders: log in database using "logEmail"
- Spam: ignore
4. Log all processed emails in the database

Maintain a professional and helpful tone in all responses.
Slack Agent

How It Works:

  Webhook / Cron Trigger (email_id)


Agent Node receives User Prompt
"Process incoming email. Email ID: {{ startTrigger.params.email_id }}"


Agent Reasoning
AI model reads system + user prompt, plans tool calls


Tool: getEmailContent (Gmail)
Fetches subject, body, sender details


Tool: classifyEmail (JavaScript)
Returns classification: inquiry / complaint / order / spam


Classification Check
┌────────────┬────────────┬────────────┬──────────┐
│ Inquiry │ Complaint │ Order │ Spam │
│ │ │ │ │ │ │ │
│ ▼ │ ▼ │ ▼ │ Ignore │
│ draftReply │forwardEmail│ logEmail │ │
│ (Gmail) │ (Gmail) │(PostgreSQL)│ │
└────────────┴────────────┴────────────┴──────────┘


Tool: logEmail (PostgreSQL)
Logs all processed emails for tracking


Output → agentNodeName.data
Summary: email classified, action taken, tracking ID
Email Assistant

Limitations

  • The agent's performance depends on the underlying AI model's capabilities
  • Complex multi-tool workflows may require higher max steps settings
  • API rate limits from AI providers may affect execution


Need Help?