Agent Decision
Description
Section titled “Description”This module evaluates the current state of a conversation and determines the action to follow. It supports three decision modes:
- Rules: Evaluates a set of configured rules against the input data. Each rule defines a field, operator, value, and resulting action. Supported operators include: equals, not_equals, greater_than, less_than, contains, not_contains, is_empty, is_not_empty, in, not_in.
- AI: Sends the conversation context to an LLM that analyzes and decides the action. Uses low temperature (0.3) for consistent decisions. Can use the same brain configured in the session’s agent or its own.
- Hybrid: First evaluates the rules; if none apply, falls back to AI.
The possible actions are:
- continue: The conversation continues normally (status: active).
- pause: Pause the conversation (status: dormant).
- close: Close the conversation (status: closed).
- escalate: Escalate to a human (status: active, marked for escalation).
- archive: Archive the conversation (status: archived).
The module has 5 output ports, one for each action, allowing the flow to be directed differently based on the decision made. It optionally updates the session status in the database.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| decision_mode | select | Yes | How decisions are made. Options: rules, ai, hybrid. Default: rules. |
| rules | agentDecisionRules | No | Configures the rules for making automatic decisions. |
| ai_prompt | textarea | No | Instructions for the AI to determine the action to take. Visible in ai and hybrid modes. |
| use_session_brain | boolean | No | Use the same AI configured in the agent. Default: true. Visible in ai and hybrid modes. |
| brain_provider | select | No | AI provider. Options: openai, anthropic, google, deepseek, qwen, llama. Visible if use_session_brain is false. |
| brain_model | aiModelSelector | No | AI model to use. Visible based on brain_provider. Default: gpt-4o. |
| credentials_key | credentials | No | Provider credentials. Visible if use_session_brain is false. |
| default_action | select | Yes | Action when no rule applies. Options: continue, pause, close, escalate, archive. Default: continue. |
| update_session_status | boolean | No | Automatically update the session status based on the decision. Default: true. |
Credentials
Section titled “Credentials”Optional. If use_session_brain is true, the session agent’s credentials are reused. Otherwise, credentials_key must be configured with credentials of type: openai, anthropic, google_ai, deepseek, qwen, llama.
Output
Section titled “Output”{ "success": true, "action": "continue", "reason": "Regla aplicada: mensajes > 5", "confidence": 1.0, "session_id": "uuid-sesion", "previous_status": "active", "new_status": "active", "decision_mode": "rules", "decided_at": "2026-03-23T10:00:00.000Z", "_outputPort": "continue"}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "decision_mode": "rules", "rules": [ { "field": "follow_up_number", "operator": ">=", "value": "3", "action": "close", "name": "Cerrar tras 3 follow-ups sin respuesta" } ], "default_action": "continue", "update_session_status": true}Expected input data
Section titled “Expected input data”session_id: Agent session ID.follow_up_number: Current follow-up number.previous_follow_ups: Number of follow-ups sent.minutes_since_last_message: Minutes since the last message.messages_count: Total messages in the session.session_status: Current session status.memory: Session memory.entities: Extracted entities.
API Used
Section titled “API Used”In AI or hybrid mode, the configured provider’s API (OpenAI, Anthropic, Google, etc.) is called for the LLM to make the decision.
- The
_outputPortfield in the output determines which of the 5 ports the flow exits through (continue, pause, close, escalate, archive). - In hybrid mode, rules take priority over AI.
- AI decision uses temperature 0.3 for greater consistency.
- If the AI cannot parse a valid response, the default action is used.
- Input data is passed completely to the next node along with the decision result.
Related Nodes
Section titled “Related Nodes”- Agent - AI Agent
- AgentSendFollowUp - Send Follow-Up