Saltar al contenido principal

Interrupt an agent

POST 

/api/v2/agent/:agentCode/interrupt

Sends a message into the turn running on a conversation while the agent is still answering. The running turn merges it and streams the updated answer on its own SSE stream; this endpoint never streams. Requires User Interruptions to be enabled for the agent, and the running turn to be an API v2 execution streamed over SSE.

Request​

Path Parameters

    agentCode stringrequired

    The code of the conversational agent running the turn.

Query Parameters

    culture string

    Use this param to override the culture of the response. Options: - en (default) - es

Body

array

required

The conversation's chatId and a text message, as a JSON array of key/value input parameters.

  • Array [

  • key stringrequired

    Possible values: [chatId, message]

    The parameter key: chatId or message.

    value stringrequired

    The conversation id for chatId, or the text of the message for message.

  • ]

Responses​

The input guardrails blocked the message (status: "Blocked"). It's saved with the running turn, and content carries the guardrails' standard response.

Schema

    instanceId uuid

    The id of the running agent instance the message was sent to.

    userMessageId uuidnullable

    The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.

    status UserInterruptionStatusEnum (string)

    Possible values: [Queued, Blocked]

    How the message was handled: Queued to be merged into the running turn, whose stream carries the answer, or Blocked by the input guardrails.

    content stringnullable

    The guardrails' standard response when the message was blocked; null otherwise.

    violations

    object[]

    nullable

    The guardrail rules the message violated when it was blocked; null otherwise.

  • Array [

  • rule int32

    Possible values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

    The guardrail rule, serialised as an integer. The rule name is also returned in ruleName: 0 InvestmentAdvice, 1 LegalAdvice, 2 MedicalAdvice, 3 TaxAdvice, 4 Sexual, 5 Harassment, 6 Hate, 7 Illicit, 8 SelfHarm, 9 Violence, 10 PromptInjection, 11 IdentityInformation, 12 GovernmentIssuedIdentifier, 13 FinancialIdentifier, 14 DigitalIdentifier, 15 VehicleIdentifier, 16 CredentialAndAccessInformation, 17 EthicalComprehension, 18 ChildSafetyFocus, 19 ContextualHallucination, 20 RegulatoryComplianceAwareness.

    ruleName stringnullable

    The name of the violated rule, such as PromptInjection.

    scoreInput doublenullable

    The score the rule gave the input, when the input was evaluated.

    scoreOutput doublenullable

    The score the rule gave the output, when the output was evaluated.

    ruleDisplayName stringnullable

    The localised display name of the violated rule.

  • ]

Loading...