Example Workflow
- Open a WebSocket connection.
- Send a structured
interactObject
payload. - Listen for responses and process different event types.
- Close the WebSocket when done.
continueInteract
WebSocket into their applications for real-time communication.
WebSocket Endpoint
The WebSocket connection URL is generated based on the region:<server-region>
is either:
eu
for the European Unionna
for the North America
Connecting to the WebSocket
Upon opening the connection, send a JSON payload to start interacting with the AI agent:Sending Data
To send a message, structure the request as follows:Receiving Messages
Responses from the WebSocket arrive as message stream. To listen for incoming messages from the WebSocket:Closing the Connection
To handle WebSocket closure:Handling Errors
To manage errors gracefully:Response Structure
Messages received from the WebSocket follow this structure:Conclusion
This document outlines the setup, usage, and integration of theInteract
WebSocket. Developers can follow these instructions to integrate real-time AI interactions into their applications using WebSockets.