Prerequisites:
- Authentication configured (see Authentication guide)
- Optional: A knowledge base for RAG (see Create a Knowledge Base guide)
Create the agent
Define the agent with a name, LLM model, and system prompt that describes its behavior.Endpoint:
POST /api/agentsmodel is a LiteLLM model ID. Bare IDs (gpt-4o, claude-sonnet-4-6) route to OpenAI/Anthropic; other providers are prefixed (gemini/..., openrouter/...). The field is not limited to the Studio model picker, but a provider you haven’t registered a key for (and that isn’t AI-on-us) returns 402 provider_key_decrypt_failed. Bring your own LLM covers the formats and an OpenRouter/DeepSeek example.Assign a builtin tool
Enable the agent to use builtin tools like database_query, http_request, or code_execute.Endpoint:
POST /api/agents/{id}/toolsLink a knowledge base
Assign a knowledge base and the agent automatically gets a search tool for it. During a conversation it can search the KB to ground its responses.Endpoint:
POST /api/agents/{id}/knowledge-basesChat with the agent (streaming)
Send a message and receive a Server-Sent Events (SSE) stream. Events include tool calls, tool results, and the final response.Endpoint:
POST /api/agents/{id}/run/streamSSE events: start, chunk, step_started, tool_call, tool_result, step_completed, approval_requested, complete, error.
What’s Next
Streaming Responses
Deep dive into SSE event handling.
Advanced Agent Config
Add MCP servers, hooks, and approval flows.
Agents & Tools
Understand the ReAct loop and tool system.