Bot Endpoints¶
Learn how to integrate bots in OI Agents.
API Integration¶
For programmatic integration with your applications, bots use conversations as the primary interface. You can find integration examples with code snippets under the "Share" tab inside your RAG bot.
Integration Workflow¶
The basic workflow for integrating with a bot involves two main steps:
- Create a Conversation - Initialize a new conversation session
- Stream Chat - Send messages and receive responses
Step 1: Create a Conversation¶
First, you need to create a conversation using the create conversation endpoint:
Endpoint: ${baseUrl}/app/rag_conversation/add
Method: POST
Headers:
Request Body:
Parameters:
bot_id- The unique identifier of the bot you want to create a conversation withname- A descriptive name for the conversation
Response:
{
"id": string,
"bot_id": string,
"name": string,
"queries": Array<ConversationQuery>,
"created_at": string,
"updated_at": string,
...other metadata
}
Step 2: Stream Chat¶
Once you have a conversation ID, you can send messages using the stream chat endpoint:
Endpoint: ${baseUrl}/rag/stream_answer
Method: POST
Headers:
Request Body:
{
"bot_id": "[BOT_ID_PLACEHOLDER]",
"question": "[USER_QUESTION]",
"conversation_id": "[CONVERSATION_ID_FROM_STEP_1]",
"debug_mode": false,
"web_search": false
}
Parameters:
bot_id- The unique identifier of the bot you want to interact withquestion- The user's message or question to send to the botconversation_id- The conversation ID obtained from the create conversation endpointdebug_mode- Boolean flag to enable debugging information in the response (optional, default: false)web_search- Boolean flag to enable web search capabilities for the bot response (optional, default: false)
Important Notes¶
- Each conversation maintains its own context and history