Create Agent
Create a new AI agent with specified configuration, tools, and knowledge bases
ACTIVE as soon as the call returns and can be invoked right away.
Only name is required. A create that names no model_provider, model_name or CLI model follows your organization’s default LLM (Settings, LLM); when the organization has none, the platform default applies: framework: external-harness, harness_settings.default_cli: claude-code, model_provider: anthropic, model_name: claude-sonnet-5, harness_settings.runtime: fleet.
Request Body
serverless (default; also the value for an agent on the runtime fleet) or container (one always-on pod per agent, only with harness_settings.runtime: legacy).anthropic (default), openai, gemini, and others. Omit it together with model_name to follow the organization’s default LLM.GET /llm_providers/{provider}/models (default claude-sonnet-5; for example gpt-4o, gemini-2.0-flash).xpi:workflow:dusk; a single emoji character is also accepted.personal (visible only to the creator) or organizational (visible to the entire organization). Defaults to organizational if not specified.low, medium, high)manager (default), regular, a2a, curl, orchestration. orchestration marks a workflow; create those through the Workflows API rather than setting it here.markdown (default), text, json (pair with output_schema), or voiceoutput_format is jsonexternal-harness (default): the agent runs on a coding CLI (claude-code, codex or opencode, chosen by harness_settings.default_cli). agno: the built-in xpander loop. The legacy values claude-code and codex are read as external-harness with that CLI as the default.external-harness agent; ignored for agno. Every field is optional.attached_tools and graph for you. Each item is discriminated on type: action, custom_function, mcp, agent, workflow or skill (skill_name from the skills catalog). When tools and attached_tools/graph are both sent, tools is resolved and merged on top. Prefer this over hand-built attached_tools and graph.framework: agno only, including memory, session storage, call limits, and safety featuresResponse
Returns the fullAIAgent object (about 80 fields). The ones you will read most:
xpi:workflow:dusk)male-avatar)DRAFT, ACTIVE or INACTIVE. A created agent is ACTIVE.manager, regular, a2a, curl or orchestrationserverless or containerrole, goal, general, plus the dynamic-prompt fields dynamic_prompt_enabled, dynamic_prompt_code, dynamic_prompt_position)personal or organizationalanthropic)claude-sonnet-5)medium)text, markdown (default), json or voiceexternal-harness (default) or agnoexternal-harness agent; null for agno.framework is agno; present with defaults on every agentname, description, version), resolved at read timeid, operation_ids) as sent on create or added with Add Agent Toolid, name, description, strategy, rw, documents)id, type (assistant, sdk, webhook, email, and so on), targets and metadata. A new agent gets the default set.{match, unless?, note?, approvers?, channels?} items, where match is literal text. null means no gates.null means none.true)true)Example Request
Minimal create request (required fields only). The agent follows your organization’s default LLM, or the platform default when there is none:Example Response
Recorded from the live API on 2026-09-18 for a minimal create; ids replaced with placeholders, two default blocks shortened (agno_settings, source_nodes) and two internal flags (use_agent_gateway, connectivity_details) left out.
Notes
- Only
nameis required. Every other field falls back to your organization’s default LLM and then to the platform defaults shown above. - A new agent runs as
framework: external-harnessonclaude-code(harness_settings.default_cli) on the runtime fleet (harness_settings.runtime: fleet), withpermission_mode: fullandapproval_hold_hours: 4. Setframework: agnofor the built-in loop. harness_settings.modelsholds one model per CLI;model_providerandmodel_namemirror the default CLI’s entry.- The
unique_nameis auto-generated as a human-friendly slug (e.g., “lavender-peacock”) - The
webhook_urlis auto-generated for agent invocations - The agent is
ACTIVEimmediately upon creation and ready for invocation versionstarts at 2 and increments with each deploymenthas_pending_changesindicates whether there are unpublished configuration changesskills,toolsandattached_toolsare empty on a new agent. Capabilities the runtime provides on its own (web search, email, file sharing, scheduling, live surfaces) never appear in these arrays.
Next Steps
After creating an agent:- Update instructions using Update Agent
- Attach skills with Add Agent Tool and knowledge bases
- Deploy the agent using Deploy Agent
- Invoke the agent using the task execution endpoints
Authorizations
API Key for authentication
Body
Request model for creating a new AI agent on the xpander.ai platform.
Only name is required. All other fields have sensible defaults matching
the platform's standard agent configuration. The agent will be created
with type 'manager' by default, which supports tool use, sub-agent
delegation, and multi-step task execution.
Fields like organization_id, id, status, version, and other
system-managed properties are set automatically by the platform and
should not be provided.
Human-readable name for the agent. Must be unique within the organization. Examples: 'Customer Support Agent', 'Research Assistant'.
A brief description of what the agent does. Shown in agent listings and used by other agents when deciding delegation. Keep it concise and action-oriented.
Icon shown next to the agent name: the platform icon id (default 'xpi:workflow:dusk') or a single emoji character.
Avatar identifier for the agent's visual representation in chat interfaces.
The agent type. 'manager' is the standard type that supports tools, sub-agents, and multi-step execution. 'regular' is a simpler agent without orchestration capabilities. 'a2a' and 'curl' are for external agent integrations. 'orchestration' marks a workflow: create those through the Workflows API instead of setting it here.
manager, regular, a2a, curl, orchestration User ID of the creator. Auto-populated from the API key if not provided.
The LLM provider for this agent's reasoning. Must match an available provider from GET /llm_providers. Common values: 'anthropic' (default), 'openai', 'gemini'. Omit it together with model_name to follow the organization's default LLM.
openai, nim, amazon_bedrock, azure_ai_foundary, huggingFace, friendlyAI, anthropic, gemini, fireworks, google_ai_studio, helicone, bytedance, tzafon_lightcone, cerebras, open_router, nebius, cloudflare_ai_gw, z_ai The specific model identifier within the chosen provider. Must match a model from GET /llm_providers/{provider}/models. Examples: 'claude-sonnet-5', 'gpt-4o', 'gemini-2.0-flash'.
Controls the depth of reasoning the LLM applies. 'low' for simple tasks, 'medium' for balanced performance, 'high' for complex reasoning, 'xhigh' for maximum reasoning depth (slower, more expensive).
low, medium, high, xhigh Custom API base URL for the LLM provider. Use this when connecting to a self-hosted or proxied LLM endpoint instead of the provider's default URL. Leave None to use the provider's standard endpoint.
Reference key to stored LLM API credentials in the xpander.ai vault. When set, the agent uses these credentials instead of the organization's default. Create credentials via the platform settings.
Type of credential storage. 'xpander' uses xpander.ai's built-in credential vault. 'custom' indicates externally managed credentials.
xpander, custom Direct LLM credentials object. Prefer using llm_credentials_key for secure credential management. Only use this for testing or when vault access is unavailable.
Additional HTTP headers to include in every LLM API request. Useful for custom authentication, routing through gateways (e.g., Helicone, Cloudflare AI Gateway), or passing metadata.
Structured instructions that define the agent's behavior. Contains 'role' (list of role descriptions), 'goal' (list of objectives), and 'general' (free-form instructions text). These are injected into the agent's system prompt.
Description of the expected output format and content. Guides the agent on what the final response should look like. Used in the system prompt to set output expectations.
The format for the agent's final response. 'markdown' for rich text, 'text' for plain text, 'json' for structured JSON output (pair with output_schema), 'voice' for speech synthesis.
text, markdown, json, voice JSON Schema defining the structure of the agent's output when output_format is 'json'. The agent will conform its response to match this schema. Must be a valid JSON Schema object.
How the agent runs. 'external-harness' (default): a coding CLI (claude-code, codex or opencode, chosen by harness_settings.default_cli). 'agno': the built-in xpander loop. Legacy 'claude-code' / 'codex' values read as 'external-harness' with that CLI.
Enable deep planning mode where the agent creates a detailed execution plan before taking actions. Useful for complex multi-step tasks. Increases latency but improves accuracy on complex workflows.
When True, forces the agent to always use deep planning regardless of task complexity. When False (default), the agent decides when to plan based on the task.
Tools to attach to the agent, in the unified simplified shape (the same payload as POST /v1/agents/{agent_id}/tools). This is the preferred way to attach tools — the API resolves catalog ids and wires the graph for you.
Each entry is one of (discriminated on type):
- {"type": "action", "connection_id": "<connection_id>", "operation_ids": ["<catalog_op_id>", ...]}
- {"type": "custom_function", "custom_function_id": ""}
- {"type": "mcp", "mcp_id": "<registry_id>"} OR {"type": "mcp", "url": "https://...", "name": "...", "transport": "...", "auth_type": "...", "allowed_tools": [...]}
- {"type": "agent", "agent_id": ""}
- {"type": "workflow", "workflow_id": ""}
- {"type": "skill", "skill_name": ""}
Resolves into attached_tools + graph server-side, so you don't need to construct those by hand.
For advanced control you may still pass attached_tools/graph directly; when both are provided, tools are resolved and merged on top.
Attach connector operations as agent tools.
- AddActionTool
- AddCustomFunctionTool
- AddMcpTool
- AddSubAgentTool
- AddWorkflowTool
- AddSkillTool
Advanced/low-level: list of connector connections with their operation IDs that this agent can use as tools. Prefer tools for the simplified shape.
Each entry binds a connection (connector_organization) to specific operations the agent is allowed to invoke.
Structure: [{"id": "<connection_id>", "operation_ids": ["<catalog_operation_id_1>", "<catalog_operation_id_2>"]}]
- 'id' is the connection ID (connector_organization.id) from POST /connectors/{connector_id}/connect
- 'operation_ids' are the catalog operation _id values from GET /connectors/{connector_id}/{connection_id}/operations
If you provide attached_tools without corresponding graph entries, the API will automatically create graph items of type 'tool' for each operation, resolving catalog _id to operationId.
Special cases:
- Custom functions: use id="xpander-custom-functions" and operation_ids=["<custom_function_id>", ...] Custom function IDs are the function UUIDs, not catalog operation IDs.
- Sub-agents: do NOT use attached_tools. Add sub-agents directly to the 'graph' field with type='agent'.
- MCP servers: do NOT use attached_tools. Add MCP servers directly to the 'graph' field with type='mcp'.
Example (connector operations): [{"id": "770832b8-c32b-4e4c-9ca2-232fec8099a7", "operation_ids": ["694bddfcd72d937c39875cf7"]}]
Example (custom functions): [{"id": "xpander-custom-functions", "operation_ids": ["my-function-uuid-1", "my-function-uuid-2"]}]
The agent's tool graph — defines which tools are available to the LLM and their execution flow. Each graph item represents a tool the agent can call during task execution.
For connector operations (type='tool'):
- item_id: the operationId string (e.g., 'XpanderEmailServiceSendEmailWithHtmlOrTextContent')
- name: human-readable name shown to the LLM (e.g., 'Send Email')
- type: 'tool'
- targets: list of graph item IDs that should execute after this tool (empty [] for no chaining)
- NOTE: auto-created from attached_tools if not provided
For sub-agents (type='agent'):
- item_id: the agent ID (UUID) to delegate work to
- name: display name of the sub-agent
- type: 'agent'
- NO attached_tools entry needed — sub-agents are graph-only
For custom functions (type='tool', sub_type='custom_function'):
- item_id: the custom function UUID
- name: function name
- type: 'tool'
- Requires attached_tools entry with id='xpander-custom-functions'
For MCP servers (type='mcp'):
- item_id: a unique ID for this MCP server instance
- name: display name of the MCP server
- type: 'mcp'
- settings.mcp_settings: {url, transport, auth_type, name, allowed_tools, ...}
- NO attached_tools entry needed — MCP servers are graph-only
NOTE: If you provide attached_tools with operation_ids but no corresponding graph items, the API will auto-create graph items with resolved operationId and pretty_name from catalog.
Examples: Connector tool: {"item_id": "SlackPostMessage", "name": "Send Slack Message", "type": "tool", "targets": []} Sub-agent: {"item_id": "agent-uuid-here", "name": "Research Agent", "type": "agent", "targets": []} MCP server: {"item_id": "mcp-uuid", "name": "Notion", "type": "mcp", "targets": [], "settings": {"mcp_settings": {"url": "https://mcp.notion.com/sse", "transport": "sse", "name": "Notion"}}}
Knowledge bases attached to this agent for RAG (Retrieval-Augmented Generation). Each entry references a knowledge base by ID and specifies the retrieval strategy ('vanilla' for simple retrieval, 'agentic_rag' for agent-driven retrieval).
Entry points that can trigger this agent. Defines how the agent can be invoked — via SDK, scheduled tasks, webhooks, assistant UI, MCP, A2A protocol, Telegram, or Slack.
Where the agent runs. 'serverless' runs on xpander.ai's managed infrastructure (recommended). 'container' runs on your own infrastructure as a Docker container.
serverless, container Who can access this agent. 'personal' restricts access to the creating user. 'organizational' makes it available to all organization members.
personal, organizational Target deployment environment ID. Leave None for the organization's default environment. Use this to deploy agents to specific on-premise or regional environments.
Connection details for external agent integrations (A2A protocol or CURL-based). Only relevant when type is 'a2a' or 'curl'. For standard agents, leave as empty dict.
- AIAgentConnectivityDetailsA2A
- AIAgentConnectivityDetailsCurl
- Connectivity Details
Configuration specific to the Agno framework. Controls session storage, coordinate mode (multi-agent), learning, memory strategies, guardrails (PII detection, prompt injection), tool call limits, and plan retry strategies. Only applies when framework is 'agno'.
Runtime settings for an 'external-harness' agent: default CLI, per-CLI models, permission mode, parallel task limit, working-directory retention, approval hold, image tag and per-turn sandbox ceilings (resources). Ignored for 'agno'.
Execution strategies applied at the task level. Configure retry behavior (max retries), iterative execution (max iterations with stop conditions), stop strategies, daily run limits, and agentic context (persistent memory across runs).
Notification configuration for task completion events. Define notifications to send on success or error via email, Slack, or webhook. Each channel supports custom subject, body, and branding.
Voice ID for text-to-speech output when output_format is 'voice'. References a voice profile in the platform's TTS service.
Enable NVIDIA NeMo guardrails integration for this agent. Provides additional safety and content filtering capabilities.
Enable supervised mode where the agent requires human approval before executing mutating operations (write/update/delete). Non-mutating operations (read/search) execute automatically.
Run the agent in autonomous mode.
When True, the agent is exposed to agent-discovery surfaces (e.g. omni). When False, it is hidden from discovery and can only be invoked directly.
When True, the SDK runs its automatic context optimizer (compaction). When False, context management is skipped.
When True, the agent is reachable from the developer API and webhook entry points. When False, external API/webhook invocation is rejected.
When True, edits are staged as a draft version before being published. When False, edits publish directly.
Enable real-time event streaming for on-premise deployments. When True, task progress events are streamed to connected clients.
Enable OIDC pre-authentication for this agent. When enabled, the agent requires a valid OIDC token from the invoking user before execution. Used for user-context-aware operations.
List of allowed OIDC token audiences for pre-authentication validation. Only tokens with matching audience claims are accepted.
When True, the user's OIDC token is forwarded to the LLM provider for authenticated LLM calls. Requires use_oidc_pre_auth to be enabled.
The audience claim to request when exchanging the user's OIDC token for LLM provider access. Only used when use_oidc_pre_auth_token_for_llm is True.
The audience claim to request when exchanging the user's OIDC token for MCP server access. Enables user-context-aware MCP tool execution.
Response
Successful Response
Runtime environment (image and environment spec) assigned to the agent, if any.
serverless, container - AIAgentConnectivityDetailsA2A
- AIAgentConnectivityDetailsCurl
- Connectivity Details
How the agent runs: 'external-harness' (default; a coding CLI chosen by harness_settings.default_cli) or 'agno' (the built-in loop). Legacy 'claude-code' / 'codex' values read as 'external-harness' with that CLI.
Icon shown next to the agent name: the platform icon id (default 'xpi:workflow:dusk') or a single emoji.
personal, organizational Skills enabled for the agent (name, description, version), resolved at read time. Attached skills only; built-in runtime capabilities are not listed.
Flattened environment spec resolved at read time; not persisted.
Vault secrets bound to the agent as resolved for its runtime; null means none.
Workspace commands that need approval before they run: {match, unless?, note?, approvers?, channels?} items where match is literal text. null means no gates; empty approvers asks the agent owner.
Enumeration of possible agent statuses.
Attributes: DRAFT: Agent is in a draft state. ACTIVE: Agent is active and operational. INACTIVE: Agent is inactive and not operational.
DRAFT, ACTIVE, INACTIVE Organization user to run as when a non-UI invocation has no resolved user.
Enumeration of the agent types.
Attributes: Manager: marks the agent as a Managing agent. Regular: marks the agent as a regular agent. A2A: marks the agent as an external agent used via A2A protocol. Curl: marks the agent as an external agent used via a CURL. Orchestration: marks the agent as an Orchestration object.
manager, regular, a2a, curl, orchestration openai, nim, amazon_bedrock, azure_ai_foundary, huggingFace, friendlyAI, anthropic, gemini, fireworks, google_ai_studio, helicone, bytedance, tzafon_lightcone, cerebras, open_router, nebius, cloudflare_ai_gw, z_ai low, medium, high, xhigh text, markdown, json, voice xpander, custom Runtime settings for an agent whose framework is 'external-harness'; null for 'agno' agents.
Configuration for event-based notifications.
Attributes: on_success: Notifications to send when an operation succeeds. Maps notification types to a list of notification configurations. on_error: Notifications to send when an operation fails. Maps notification types to a list of notification configurations. on_budget: Notifications to send on budget threshold crossings. A dedicated category — budget alerts are not errors.
Configuration object for task-level execution strategies.
This model groups optional strategy configurations that control how a task is executed and managed over time, including retries, iterative execution, stopping conditions, and daily run limits.
Attributes: retry_strategy: Optional retry policy configuration that defines how the task should behave when execution fails (e.g., max attempts, backoff rules).
1 <= x <= 1000Whether the agent may share the live surfaces it builds.

