For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.
Chatbot
Official inference plugin with optional memory and MCP tools
The chatbot plugin adds a ready-made chat inference API on top of BrainAPI. It talks to your configured LLM providers, can call MCP tools for the current brain, and optionally persists turns when chatbot-memory is installed.
For agents
- Install:
./bin/brainapi install chatbotthen restart API (and MCP if using tools) POST /chatbot/inferencewithBrainPAT+ brain scope; requires BrainAPI>=2.13.0- Pair with chatbot-memory for conversation persistence
- Product MCP ≠ docs MCP — docs tools live at
/docs/mcp
- Package dir:
plugins/chatbot - Manifest:
name: chatbot,version: 1.0.0, requires BrainAPI>=2.13.0 - Route prefix:
/chatbot
Install
The repo already vendors the plugin under plugins/chatbot. For a registry install:
./bin/brainapi install chatbot
# or via TUI: brainapi plugins install chatbotRestart the API (and MCP if you rely on tool-calling) after install. See Plugins for CLI details.
Endpoint
POST /chatbot/inference
Auth: same as other BrainAPI routes (BrainPAT or Authorization: Bearer …, plus brain scoping / X-Brain-ID as configured).
curl -X POST "<DEPLOYMENT_URL>/chatbot/inference" \-H "Content-Type: application/json" \-H "BrainPAT: YOUR_BRAIN_PAT" \-H "X-Brain-ID: example01" \-d '{ "model": "openai::gpt-4o-mini", "input": "Write a one-line greeting", "stream": false, "max_tokens": 64}'Request fields
Prop
Type
Model string
model must be api_provider::llm_name. Providers resolve through BrainAPI’s runtime registry. Aliases include:
| Alias | Resolves to |
|---|---|
azureopenai, azure_openai | azure |
claude | anthropic |
bedrock | amazon_bedrock |
vertex, gcp | gcp_vertex |
Supported providers include: ollama, azure, openai, anthropic, deepseek, gcp_vertex, amazon_bedrock. Configure keys/endpoints in .env the same way as core LLM adapters (see Installation for DeepSeek).
Invalid format or unsupported provider → 422.
Non-stream response
{
"message": "Inference completed successfully",
"data": {
"model": "azure::gpt-4o-mini",
"provider": "azure",
"output": "Hello there!",
"stream": false
}
}Stream response
- Set
"stream": true - Content-Type:
text/event-stream - Chunks: OpenAI-style
data: {...}lines, ended bydata: [DONE] - Header
X-Model: provider::llm_name
Memory integration
If the chatbot-memory plugin directory is present, inference:
- Builds a richer prompt from last messages, conversation meta summary, and user preferences (when
conversation_id/user_idare set). - Saves the user message before generation and the agent reply after (including streamed replies once the stream finishes).
Without chatbot-memory, conversation_id does not load memory context; bare text chunks are not written through the memory pipeline.
Pair both plugins for multi-turn assistants. Details: Chatbot memory.
MCP tool calling
By default, when a brain_id is available, inference prepends MCP tool instructions and may iterate tool calls (env CHATBOT_MCP_TOOL_MAX_ITERATIONS, default 5). The agent uses the same BrainPAT as the HTTP request to execute tools.
Ensure the MCP server is running if you expect tool use. Streaming with MCP still runs the tool loop first, then emits the final answer as SSE.
Related
Last updated on
