Send a custom instruction
https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/thinkUse this endpoint to send a custom text instruction to the specified Conversational AI agent instance. The instruction is injected into the current conversation pipeline as user input, and the agent processes and responds to it following the standard user input logic.
Use this endpoint for the following scenarios:
- Implicit instruction injection: Inject hidden context or directives into the conversation.
- Client-side event triggering: Notify the agent of client-side events, such as a user clicking a button.
- Voice and text collaboration: Combine text instructions with voice input for richer interaction.
Request
Path parameters
The App ID of the project.
The agent instance ID you obtained after successfully calling join to Start a conversational AI agent.
Request body
BODYrequired
- text stringrequired
The custom instruction text to inject into the current conversation pipeline. The system processes this as user input.
- on_listening_action stringnullable
Default:
injectPossible values:
inject,ignoreThe action to take when the agent is in a listening state:
inject: Inject the custom text instruction into the current turn without interrupting it.ignore: Ignore the request.
- on_thinking_action stringnullable
Default:
interruptPossible values:
interrupt,ignoreThe action to take when the agent is in a thinking state:
interrupt: Interrupt the current state and start a new conversation turn.ignore: Ignore the request.
- on_speaking_action stringnullable
Default:
ignorePossible values:
interrupt,ignoreThe action to take when the agent is in a speaking state:
interrupt: Interrupt the current state and start a new conversation turn.ignore: Ignore the request.
- interruptable booleannullable
Default:
trueWhether user speech can interrupt the injected instruction:
true: User speech can interrupt the instruction.false: User speech cannot interrupt the instruction.
- metadata objectnullable
Custom metadata in key-value pair format. Use this field to pass additional business information such as identifiers or model references.
Response
-
If the returned status code is
200, the request was successful. The response body contains the result of the request. -
If the returned status code is not
200, the request failed. The response body includes thedetailandreasonfor failure. Refer to status codes to understand the possible reasons for failure.