Skip to content

AI: Assign role (Routing)

This service task analyzes incoming text (e.g. emails, support tickets, applications) and assigns it to the most appropriate role or department. Available roles are provided with descriptions so the AI can make an informed assignment.

Technical name: prio_aiAssignRole


Input

Field Type Required Description
text String Yes The text to analyze (email, ticket, document).
roles Object[] Yes Available roles with id, name, and description (min. 2).
maxAssignees Number No Maximum number of assigned roles (default: 1).

Role format

Each role in the roles array requires:

Field Type Description
id String Unique role identifier.
name String Display name of the role.
description String Description of responsibilities.

Input example

{
  "text": "Dear Sir or Madam, I hereby cancel my contract no. V-2024-4711 effective at the earliest possible date.",
  "roles": [
    { "id": "support", "name": "Customer Service", "description": "Handles general customer inquiries and complaints" },
    { "id": "contracts", "name": "Contract Management", "description": "Cancellations, renewals, and contract changes" },
    { "id": "billing", "name": "Accounting", "description": "Invoices, payments, and dunning" },
    { "id": "tech", "name": "Technical Support", "description": "Technical issues and IT problems" }
  ],
  "maxAssignees": 1
}

Output

Field Type Description
assignments Object[] Assigned roles, sorted by confidence (highest first).

Each element in assignments:

Field Type Description
roleId String ID of the assigned role.
roleName String Display name of the assigned role.
confidence Number Confidence between 0 and 1.
reasoning String Brief explanation of the assignment (1–2 sentences).

Output example

{
  "assignments": [
    {
      "roleId": "contracts",
      "roleName": "Contract Management",
      "confidence": 0.95,
      "reasoning": "The text contains a contract cancellation with contract number and deadline."
    }
  ]
}

Multi-assignment

Use maxAssignees to allow assignment to multiple roles. The AI only assigns multiple roles when they are genuinely relevant — low-confidence roles are not forced.

{
  "text": "Invoice no. 2024-001 has an incorrect amount. Also, the login is no longer working.",
  "roles": [...],
  "maxAssignees": 2
}

Possible output:

{
  "assignments": [
    { "roleId": "billing", "roleName": "Accounting", "confidence": 0.88, "reasoning": "Invoice complaint with invoice number." },
    { "roleId": "tech", "roleName": "Technical Support", "confidence": 0.82, "reasoning": "Login issue indicates a technical problem." }
  ]
}

Notes

  • At least 2 roles must be provided.
  • Role descriptions are critical for assignment quality — the more precise, the better.
  • The service makes up to three attempts to produce a valid assignment.
  • Role IDs are matched exactly (case-insensitive fallback available).