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
The code of the conversational agent running the turn.
Query Parameters
Use this param to override the culture of the response. Options: - en (default) - es
- application/json
Body
array
required
The conversation's chatId and a text message, as a JSON array of key/value input parameters.
Array [
]
Possible values: [chatId, message]
The parameter key: chatId or message.
The conversation id for chatId, or the text of the message for message.
Responses
- 200
- 202
- 400
- 401
- 403
- 404
- 500
The input guardrails blocked the message (status: "Blocked"). It's saved with the running turn, and content carries the guardrails' standard response.
- text/plain
- application/json
- text/json
- Schema
- Example (from schema)
Schema
Array [
]
The id of the running agent instance the message was sent to.
The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.
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.
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.
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.
The name of the violated rule, such as PromptInjection.
The score the rule gave the input, when the input was evaluated.
The score the rule gave the output, when the output was evaluated.
The localised display name of the violated rule.
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userMessageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Queued",
"content": "string",
"violations": [
{
"rule": 0,
"ruleName": "string",
"scoreInput": 0,
"scoreOutput": 0,
"ruleDisplayName": "string"
}
]
}
- Schema
- Example (from schema)
Schema
Array [
]
The id of the running agent instance the message was sent to.
The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.
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.
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.
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.
The name of the violated rule, such as PromptInjection.
The score the rule gave the input, when the input was evaluated.
The score the rule gave the output, when the output was evaluated.
The localised display name of the violated rule.
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userMessageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Queued",
"content": "string",
"violations": [
{
"rule": 0,
"ruleName": "string",
"scoreInput": 0,
"scoreOutput": 0,
"ruleDisplayName": "string"
}
]
}
- Schema
- Example (from schema)
Schema
Array [
]
The id of the running agent instance the message was sent to.
The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.
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.
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.
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.
The name of the violated rule, such as PromptInjection.
The score the rule gave the input, when the input was evaluated.
The score the rule gave the output, when the output was evaluated.
The localised display name of the violated rule.
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userMessageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Queued",
"content": "string",
"violations": [
{
"rule": 0,
"ruleName": "string",
"scoreInput": 0,
"scoreOutput": 0,
"ruleDisplayName": "string"
}
]
}
The message was queued into the running turn (status: "Queued"). Wait for the interruption_merged event with this userMessageId on the running stream.
- text/plain
- application/json
- text/json
- Schema
- Example (from schema)
Schema
Array [
]
The id of the running agent instance the message was sent to.
The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.
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.
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.
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.
The name of the violated rule, such as PromptInjection.
The score the rule gave the input, when the input was evaluated.
The score the rule gave the output, when the output was evaluated.
The localised display name of the violated rule.
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userMessageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Queued",
"content": "string",
"violations": [
{
"rule": 0,
"ruleName": "string",
"scoreInput": 0,
"scoreOutput": 0,
"ruleDisplayName": "string"
}
]
}
- Schema
- Example (from schema)
Schema
Array [
]
The id of the running agent instance the message was sent to.
The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.
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.
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.
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.
The name of the violated rule, such as PromptInjection.
The score the rule gave the input, when the input was evaluated.
The score the rule gave the output, when the output was evaluated.
The localised display name of the violated rule.
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userMessageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Queued",
"content": "string",
"violations": [
{
"rule": 0,
"ruleName": "string",
"scoreInput": 0,
"scoreOutput": 0,
"ruleDisplayName": "string"
}
]
}
- Schema
- Example (from schema)
Schema
Array [
]
The id of the running agent instance the message was sent to.
The id of the saved user message. Match it with the user_message_id of the interruption_merged event on the running stream.
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.
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.
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.
The name of the violated rule, such as PromptInjection.
The score the rule gave the input, when the input was evaluated.
The score the rule gave the output, when the output was evaluated.
The localised display name of the violated rule.
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userMessageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Queued",
"content": "string",
"violations": [
{
"rule": 0,
"ruleName": "string",
"scoreInput": 0,
"scoreOutput": 0,
"ruleDisplayName": "string"
}
]
}
If no turn on the conversation is accepting messages (interruption_not_accepted: none is running, it is finishing, or it reached its limit; send the message to execute instead), User Interruptions are off for the agent (user_interruptions_disabled), the message is missing, or too many messages are already queued (interruption_queue_full).
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {}
}
The user is unauthorized or the session expired
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
The user does not have permission
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
If the agent or the conversation doesn't exist.
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {}
}
There was an unexpected error
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}