API: Agents
Agent CRUD
Section titled “Agent CRUD”List Agents
Section titled “List Agents”GET /api/agents{ "agents": [ { "id": "bookstore_bot", "name": "Bookstore Assistant", "description": "Book recommendation assistant", "system_prompt": "...", "model": null, "created_at": "2026-04-07 10:00:00" } ]}Get Agent
Section titled “Get Agent”GET /api/agents/<agent_id>Returns the agent with its assigned tools (array of tool IDs) and channels.
Create Agent
Section titled “Create Agent”POST /api/agentsContent-Type: application/json
{ "id": "bookstore_bot", "name": "Bookstore Assistant", "description": "Book recommendation assistant"}The id must match ^[a-zA-Z0-9_]+$.
Update Agent
Section titled “Update Agent”PUT /api/agents/<agent_id>Content-Type: application/json
{ "name": "Updated Name", "system_prompt": "New system prompt...", "model": "gpt-4"}Updatable fields: name, description, system_prompt, model.
Delete Agent
Section titled “Delete Agent”DELETE /api/agents/<agent_id>Removes the agent, its channels, sessions, messages, and KB directory.
Agent Tools
Section titled “Agent Tools”Get Assigned Tools
Section titled “Get Assigned Tools”GET /api/agents/<agent_id>/tools{"tools": ["get_weather", "calculator"]}Set Assigned Tools
Section titled “Set Assigned Tools”PUT /api/agents/<agent_id>/toolsContent-Type: application/json
{"tools": ["get_weather", "calculator", "search_restaurants"]}Replaces the entire tool assignment list.
Knowledge Base
Section titled “Knowledge Base”List KB Files
Section titled “List KB Files”GET /api/agents/<agent_id>/kb{ "files": [ {"filename": "facilities.md", "size": 2345, "modified": 1712500000.0} ]}Read KB File
Section titled “Read KB File”GET /api/agents/<agent_id>/kb/<filename>{"filename": "facilities.md", "content": "# Facilities\n\n..."}Upload KB File (multipart)
Section titled “Upload KB File (multipart)”POST /api/agents/<agent_id>/kbContent-Type: multipart/form-data
file=@facilities.mdCreate KB File (JSON)
Section titled “Create KB File (JSON)”POST /api/agents/<agent_id>/kbContent-Type: application/json
{"filename": "faq.md", "content": "# FAQ\n\n..."}Update KB File
Section titled “Update KB File”PUT /api/agents/<agent_id>/kb/<filename>Content-Type: application/json
{"content": "Updated content..."}Delete KB File
Section titled “Delete KB File”DELETE /api/agents/<agent_id>/kb/<filename>Channels
Section titled “Channels”List Channels
Section titled “List Channels”GET /api/agents/<agent_id>/channelsCreate Channel
Section titled “Create Channel”POST /api/agents/<agent_id>/channelsContent-Type: application/json
{ "type": "telegram", "name": "Main Bot", "config": {"bot_token": "123456:ABC..."}}Update Channel
Section titled “Update Channel”PUT /api/agents/<agent_id>/channels/<channel_id>Delete Channel
Section titled “Delete Channel”DELETE /api/agents/<agent_id>/channels/<channel_id>Start Channel
Section titled “Start Channel”POST /api/agents/<agent_id>/channels/<channel_id>/startStop Channel
Section titled “Stop Channel”POST /api/agents/<agent_id>/channels/<channel_id>/stopSend Message
Section titled “Send Message”POST /api/agents/<agent_id>/chatContent-Type: application/json
{ "message": "Apakah kamar Bismo tersedia?", "user_id": "web_test"}Response:
{ "success": true, "response": "Selamat datang! Kamar Bismo tersedia untuk tanggal tersebut..."}The user_id is used as the external user identifier for session management. Each unique user_id gets a separate conversation history.
Clear Chat History
Section titled “Clear Chat History”POST /api/agents/<agent_id>/chat/clearContent-Type: application/json
{"user_id": "web_test"}