Agents & Sub-Agents
An agent is an autonomous AI entity with its own system prompt, tool set, knowledge bases, and LLM configuration. Agents can be composed into hierarchies where an orchestrator delegates to specialized sub-agents.Agent types
System agents
System agents are the built-in specialists that ship with AgentFlow:| Agent | Domain | Capabilities |
|---|---|---|
| MainAgent | Orchestration | Routes requests to the right sub-agent; never handles domain actions directly |
| EmailsAgent | Read, search, draft, send, reply via connected email accounts | |
| TasksAgent | Tasks | Create, assign, track, prioritize tasks and follow-ups |
| MeetingsAgent | Calendar | Schedule, check availability, analyze transcripts |
| ResearchAgent | Research | Web search, company news, SEC filings, industry intelligence |
| RecordsAgent | CRM | Query and manage accounts, contacts, opportunities, pipelines |
| SnowflakeAgent | Data | Snowflake query and analysis workflows |
| JediAgent | Internal | Hidden sub-agent used by the jedi_council tool; not exposed to MainAgent |
GeneralSubAgent. Unknown domains should be handled by the orchestrator as missing capability rather than routed to a catch-all.
Dynamic sub-agents
You can create custom sub-agents at runtime under an existing parent agent. Dynamic sub-agents are full agents that can have their own tools, knowledge bases, model configuration, and prompt:knowledge_bases are KB IDs. tool_assignments on create/update are tool names stored with the sub-agent; the dedicated tool assignment endpoint accepts tool UUIDs.
Configuration
Agents are configured in the backend, seeded into the tenant database, and managed through/api/v1/agent/* endpoints. The Python SDK mirrors that resource shape:
Capabilities
| Capability | Config field or surface | What it does |
|---|---|---|
| Planning | enable_planning | Agent decomposes complex requests into multi-step plans before execution |
| Retrieval | knowledge_bases request field, direct capability endpoint, or registered retrieval tools | Search assigned knowledge bases for relevant context |
| Reflection | enable_reflection | Agent evaluates its own response quality and can iterate |
- Request-scoped retrieval: when
knowledge_basesare passed on a chat request, assigned matching KBs are searched before the model call and injected as context. - Direct capability endpoint:
POST /api/v1/agent/{agent_id}/capability/retrieveinvokes retrieval directly. - Model-callable retrieval tool: retrieval is available to the model only when a retrieval tool is registered or assigned through the normal tool system.
Agent lifecycle
Via SDK
Via REST API
Tool and knowledge base composition
Agents are composable building blocks. Tools and knowledge bases are assigned through agent-scoped resources:Chat request parameters
ThePOST /api/v1/agent/{agent_id}/chat endpoint accepts a rich set of parameters for controlling execution. Every parameter beyond message, conversation_id, and message_id is optional.
Core
| Parameter | Type | Description |
|---|---|---|
message | string | User message (required) |
conversation_id | string | Conversation ID for multi-turn context (required) |
message_id | string | Stable unique identifier for this user message (required) |
stream | boolean | Stream response via SSE (default: true) |
verbose | boolean | Include detailed execution events in the stream (default: false) |
conversation_id once per conversation and message_id once per submitted user message. Reuse the same message_id when retrying the same user action after a timeout, reconnect, or duplicate-submit response.
LLM overrides
| Parameter | Type | Description |
|---|---|---|
model | string | Override the model for this run, e.g. "openai/gpt-5.4-mini" |
temperature | float | Override temperature |
max_tokens | integer | Override max output tokens |
top_p | float | Override nucleus sampling (0.0-1.0) |
frequency_penalty | float | Override frequency penalty |
presence_penalty | float | Override presence penalty |
max_turns | integer | Maximum agent turns (tool calls + responses) |
Reasoning
| Parameter | Type | Description |
|---|---|---|
reasoning_effort | string | Reasoning depth. Supported values are model-specific; OpenAI GPT-5.4 models accept "none", "low", "medium", "high", "xhigh", while some models accept a smaller set. |
reasoning_summary | string | Reasoning output: "auto", "concise", "detailed" |
Context & attachments
| Parameter | Type | Description |
|---|---|---|
attachment_ids | string[] | File IDs from upload (triggers vision model for images) |
knowledge_bases | string[] | Knowledge base IDs to make available for this request |
retrieval_options | object | Bounded per-run KB search tuning, such as top_k, search_type, metadata_filters, and reranking flags |
context_refs | object[] | Entity references, e.g. [{"system":"crm","type":"account","id":"001x"}] |
skills | string[] | Optional allowlist that narrows the agent’s skill catalog |
artifacts | string[] | Optional allowlist that narrows the agent’s artifact catalog |
image_detail | string | Vision resolution: "low", "high", "auto" (default) |
session_context | object | Client-side context (current page, selected data, route info) |
client_timezone | string | IANA timezone for temporal awareness, e.g. "America/New_York" |
Capability overrides
| Parameter | Type | Description |
|---|---|---|
enable_planning | boolean | Override agent planning for this request |
enable_reflection | boolean | Override agent reflection for this request |
selected_tools | string[] | Restrict which tools the agent can use for this request |
enable_query_rewrite | boolean | Rewrite KB search queries against prior conversation context |
Advanced metadata
These fields are usually set by SDKs, embedded UIs, or orchestration layers rather than typed into a public chat form.| Parameter | Type | Description |
|---|---|---|
call_id | string | Optional client correlation ID stored with the run. The server still generates the runtime call_id used for streaming and cancellation. |
source | string | Origin label such as a UI surface, automation, or integration |
source_id | string | Stable ID from the origin system |
source_metadata | object | Extra origin metadata for audit, analytics, or routing |
Example: full-featured request
Multi-agent orchestration
When a user sends a message, the orchestrator:- Parses intent - identifies which domain(s) the request touches
- Delegates - routes to the appropriate sub-agent(s)
- Sequences - for multi-part requests, delegates to each sub-agent in order
- Aggregates - combines sub-agent responses into a coherent reply
call_id hierarchies, so you can observe exactly which agents and tools were invoked for every request.
