On this page
Sommatic Docs
Open portal

Detect Intent

Detects user intent from text input and extracts relevant parameters for downstream routing.

View as Markdown
Open in
AI Available ai.intent Version 1.0.0 Execution: async

Detects the user's intent in text against an intent catalog (inline and/or from a knowledge resource) and routes to detected or unknown, with extracted parameters.

This operator classifies input text against a configurable intent catalog, producing a primary intent, confidence score, extracted parameters, and routing hints for workflow orchestration.

Operations

  • Intent Detection: Matches text against a catalog of named intents with descriptions and examples.
  • Parameter Extraction: Extracts key-value slot parameters relevant to the detected intent.
  • Routing: Provides routing hints to guide downstream workflow branching.

Use Cases

  • Chatbot message routing based on user intent (e.g., "book_appointment", "check_status", "complaint").
  • Email triage and automatic categorization by purpose.
  • Command Center input classification for explicit vs. inference-assisted execution.
  • Multi-channel intake routing with confidence-based human review escalation.

How it works

  1. Merges the upstream payload with the node config (config wins) and reads text, context and channel; throws Missing 'text' when text is empty.
  2. Collects intents from intents (items need name) and adds those in content.structured_data.intents of knowledge_resource_id whose name is not already present (case-insensitive). Fails when none remain.
  3. Sends a classifier system prompt with the catalog, the threshold and a strict JSON format; the user message joins Channel:, Context: and text; temperature: 0.
  4. Parses the answer as JSON. primary_intent is matched case-insensitively to the catalog; any other value becomes unknown. Every catalog intent missing from all_intents is added with confidence 0.
  5. needs_review is the model's value or, when missing, confidence < confidence_threshold. Routes to detected unless the intent is unknown.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-detect-intent",
  "label": "Detect intent",
  "operator_slug": "ai.intent",
  "operator_version": "1.0.0",
  "config": {
    "text": "{{ $json.message }}",
    "channel": "chat",
    "intents": [
      {
        "name": "track_order",
        "description": "The user wants to know where an order is",
        "examples": "where is my order, tracking number"
      },
      {
        "name": "cancel_order",
        "description": "The user wants to cancel an order"
      },
      {
        "name": "refund",
        "description": "The user asks for money back"
      }
    ],
    "allow_multiple": false,
    "confidence_threshold": 0.7,
    "language": "en",
    "llm_provider_id": "wf-llm-provider-xxxx",
    "invocation_mode": "sync"
  }
}

Configuration

llm_provider_id string Optional

The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.

invocation_mode string Optional

Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.

Default: sync

Allowed values: syncstream

timeout_ms integer Optional

Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.

intents array<object> Optional

Define the intents to detect. Each needs a name and description.

Default: []

allow_multiple boolean Optional

Allow detecting multiple intents in a single input.

Default: false

confidence_threshold number Optional

Flag as needs_review when confidence falls below this threshold.

Default: 0.7

knowledge_resource_id string Optional

Load intent catalog from a Knowledge Resource instead of inline config.

language string Optional

Output language code (e.g., "en", "es").

Default: en

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

confidence_threshold
Does not change the port: a low-confidence catalog intent still goes to detected. It only sets needs_review when the model omits it.
text, context, channel
Not in the config schema (it is in the input contract), but read from the config first and then from the upstream payload.
timeout_ms
Stream mode only: idle timeout between chunks, default 600000. In sync mode it is not applied to the request.
execution
Declared but ignored: neither the worker nor the engine reads retryOnFail, maxTries, waitBetweenTries, continueOnFail, alwaysOutputData or timeout_ms from this block.

Output ports

detected default

The primary intent is a catalog intent, whatever its confidence. Check needs_review for low confidence.

Data
{
  "primary_intent": "track_order",
  "confidence": 0.92,
  "all_intents": [
    {
      "intent": "track_order",
      "confidence": 0.92
    },
    {
      "intent": "cancel_order",
      "confidence": 0.05
    },
    {
      "intent": "refund",
      "confidence": 0.03
    }
  ],
  "parameters": {
    "order_id": "4521"
  },
  "routing_hint": "order-status-flow",
  "needs_review": false,
  "raw": null,
  "port": "detected"
}
unknown

The model answered unknown, no intent, or a name outside the catalog.

Data
{
  "primary_intent": "unknown",
  "confidence": 0.2,
  "all_intents": [
    {
      "intent": "track_order",
      "confidence": 0.1
    },
    {
      "intent": "cancel_order",
      "confidence": 0.05
    },
    {
      "intent": "refund",
      "confidence": 0.05
    }
  ],
  "parameters": {},
  "routing_hint": null,
  "needs_review": true,
  "raw": null,
  "port": "unknown"
}
error

text or the catalog is missing, the model call failed or the answer was not JSON.

Data
{
  "error": "Model did not return valid JSON output"
}

In expressions

What a later node can read from this node's output with $("Detect Intent").item.json.<path> (write your node's label instead of Detect Intent). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through detected, from the output shown in Ports.

ExpressionEditorWorker
$("Detect Intent").item.json.primary_intentstring= "track_order"The detected primary intent name or "unknown".
$("Detect Intent").item.json.confidencenumber= 0.92Confidence score (0-1) for the primary intent.
$("Detect Intent").item.json.all_intentsarray= […] (3)Probability distribution across all catalog intents.
$("Detect Intent").item.json.parametersobject= {…}Extracted key-value parameters relevant to the intent.
$("Detect Intent").item.json.routing_hintstring= "order-status-flow"Suggested next action or routing target.
$("Detect Intent").item.json.needs_reviewboolean= falseTrue when confidence is below the threshold.
$("Detect Intent").item.json.parameters.order_idstringNot suggested by the editor= "4521"—
$("Detect Intent").item.json.rawnullNot suggested by the editor= null—
$("Detect Intent").item.json.portstringNot suggested by the editor= "detected"—

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Errors

Message Port Cause and fix
Missing 'text' error No text in the config or the upstream payload.
No intents found. Provide intents in the config or link a Knowledge Resource with an intent catalog. error Neither intents nor the resource provides an intent with a name. If there are no inline intents and the resource fetch fails, that fetch error is returned instead.
Model did not return valid JSON output error The answer could not be parsed as a JSON object.
[AiIntent] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). The legacy 'model_id' alias is no longer supported — update the node config to use 'llm_provider_id'. error llm_provider_id is empty or not a string. Pick an LLM provider record with chat capability.
LLM Invocation Error: <backend message> error The backend rejected the call: unknown or inactive provider record, provider error, quota or content filter. Check the provider record and the backend logs.
LLM Invocation Error: empty response from backend (<transport error>) error Sync mode: the HTTP call to the backend failed (network error, non-2xx status or timeout). Long prompts often hit the request timeout; switch to invocation_mode: "stream".
RemoteApiService.stream: idle timeout after <timeout_ms>ms error Stream mode: no chunk arrived within timeout_ms. A failed stream request shows RemoteApiService.stream: HTTP <status> — <body> instead.

Input contract

text string Required

The text input to analyze for intent.

context string Optional

Optional conversation or session context.

channel string Optional

Optional channel identifier (chat, email, api, etc.).

Output contract

primary_intent string Optional

The detected primary intent name or "unknown".

confidence number Optional

Confidence score (0-1) for the primary intent.

all_intents array<object> Optional

Probability distribution across all catalog intents.

parameters object Optional

Extracted key-value parameters relevant to the intent.

routing_hint string Optional

Suggested next action or routing target.

needs_review boolean Optional

True when confidence is below the threshold.

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "ai.intent",
  "name": "Detect Intent",
  "category": "ai",
  "version": "1.0.0",
  "description": "Detects user intent from text input and extracts relevant parameters for downstream routing.\n\nThis operator classifies input text against a configurable intent catalog, producing a primary intent, confidence score, extracted parameters, and routing hints for workflow orchestration.\n\n**Operations**\n- **Intent Detection:** Matches text against a catalog of named intents with descriptions and examples.\n- **Parameter Extraction:** Extracts key-value slot parameters relevant to the detected intent.\n- **Routing:** Provides routing hints to guide downstream workflow branching.\n\n**Use Cases**\n- Chatbot message routing based on user intent (e.g., \"book_appointment\", \"check_status\", \"complaint\").\n- Email triage and automatic categorization by purpose.\n- Command Center input classification for explicit vs. inference-assisted execution.\n- Multi-channel intake routing with confidence-based human review escalation.",
  "capabilities": [
    "ai",
    "nlp",
    "intent",
    "classification",
    "routing"
  ],
  "knowledge_binding": {
    "enabled": true,
    "resource_types": [
      "intent_catalog"
    ],
    "field": "knowledge_resource_id",
    "label": "Intent Catalog"
  },
  "config_schema": {
    "type": "object",
    "properties": {
      "llm_provider_id": {
        "type": "string",
        "title": "LLM Provider",
        "description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
        "x-ui-widget": "llm-provider-picker",
        "x-llm-provider-capabilities": [
          "chat"
        ]
      },
      "invocation_mode": {
        "type": "string",
        "title": "Invocation Mode",
        "description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.",
        "enum": [
          "sync",
          "stream"
        ],
        "default": "sync"
      },
      "timeout_ms": {
        "type": "integer",
        "title": "Timeout (ms)",
        "description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
        "minimum": 1000
      },
      "intents": {
        "type": "array",
        "title": "Intent Catalog",
        "description": "Define the intents to detect. Each needs a name and description.",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "title": "Intent Name"
            },
            "description": {
              "type": "string",
              "title": "Description"
            },
            "examples": {
              "type": "string",
              "title": "Example Phrases"
            }
          },
          "required": [
            "name",
            "description"
          ]
        },
        "default": []
      },
      "allow_multiple": {
        "type": "boolean",
        "title": "Allow Multiple Intents",
        "description": "Allow detecting multiple intents in a single input.",
        "default": false
      },
      "confidence_threshold": {
        "type": "number",
        "title": "Confidence Threshold",
        "description": "Flag as needs_review when confidence falls below this threshold.",
        "default": 0.7,
        "minimum": 0,
        "maximum": 1
      },
      "knowledge_resource_id": {
        "type": "string",
        "title": "Intent Catalog (Knowledge Resource)",
        "description": "Load intent catalog from a Knowledge Resource instead of inline config.",
        "ui_widget": "knowledge_resource_picker"
      },
      "language": {
        "type": "string",
        "title": "Language",
        "description": "Output language code (e.g., \"en\", \"es\").",
        "default": "en"
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "description": "The text input to analyze for intent."
      },
      "context": {
        "type": "string",
        "description": "Optional conversation or session context."
      },
      "channel": {
        "type": "string",
        "description": "Optional channel identifier (chat, email, api, etc.)."
      }
    },
    "required": [
      "text"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "primary_intent": {
        "type": "string",
        "description": "The detected primary intent name or \"unknown\"."
      },
      "confidence": {
        "type": "number",
        "description": "Confidence score (0-1) for the primary intent."
      },
      "all_intents": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "intent": {
              "type": "string"
            },
            "confidence": {
              "type": "number"
            }
          }
        },
        "description": "Probability distribution across all catalog intents."
      },
      "parameters": {
        "type": "object",
        "description": "Extracted key-value parameters relevant to the intent."
      },
      "routing_hint": {
        "type": "string",
        "description": "Suggested next action or routing target."
      },
      "needs_review": {
        "type": "boolean",
        "description": "True when confidence is below the threshold."
      }
    }
  },
  "ports": [
    {
      "port_id": "detected",
      "label": "Detected",
      "is_default": true
    },
    {
      "port_id": "unknown",
      "label": "Unknown"
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "async",
  "tags": [
    "ai",
    "nlp",
    "intent",
    "routing",
    "classification"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Retries (retryOnFail)
No
Capabilities
ainlpintentclassificationrouting
Tags
ainlpintentroutingclassification

Notes and limits

  • The model is asked for reasoning, but it is not returned. parameters is passed through from the model as an object.
  • The worker returns its fields at the top level instead of inside data, so the engine stores the whole return value as the node output: port and raw appear in $json next to the result fields.
  • raw is the provider's raw response in sync mode and null in stream mode.
  • The model call goes through the Sommatic AI backend, which resolves the provider record named by llm_provider_id (endpoint, credentials, deployment); the orchestrator never holds provider keys. invocation_mode: "sync" (default) waits for the full answer; "stream" reads it as server-sent events and joins the chunks.
  • timeout_ms only takes effect in stream mode, as the idle time allowed between chunks (default 600000). In sync mode the value is logged but not applied to the HTTP request, so the platform's default request timeout governs.
  • In stream mode the backend endpoint does not apply sampling settings, so the fixed temperature: 0 only takes effect in sync mode.
  • The knowledge resource is read from the backend on every run (10 s timeout). A resource whose status is not active is used anyway, with a warning in the log.
  • No automatic retries: the engine does not honour execution.retryOnFail, maxTries or waitBetweenTries for this node; a failed call goes straight to error.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs