agent_id to run tasks and pins the agent version active when the session is created.
Every update to an agentâs configuration produces a new immutable version, while older versions remain intact. Existing sessions continue using the version pinned at creation time and are unaffected by subsequent updatesâensuring consistent behavior even when long-running tasks pause and resume.
Agent fields
Tool declarations
Thetools array declares which tools the agent can use. Each entry is distinguished by its type field:
If no
agent_toolset is declared on creation, agent_toolset_20261101 is prepended to tools by default (counting toward the 128-item limit). Once you explicitly declare an agent_toolset, only the declared toolset is loaded; each tools list allows at most one sandbox toolset, and mixing agent_toolset_20260901 with agent_toolset_20261101 returns 400 invalid_parameter_error. To disable sandbox tools, explicitly declare an agent_toolset with default_config.enabled set to false for the entire toolset. For detailed tool configuration options, see Tools.
MCP servers
mcp_servers stores connection metadata: type (currently only "url" is supported), name, url, and optional headers. headers specifies custom non-sensitive HTTP request headers (such as User-Agent or tenant routing headers), up to 16 entries; they are accepted in requests and omitted from responses. On update, the entire mcp_servers array is replacedâany server omitted from the request is removed. headers follows a different rule: if headers is omitted or empty and the serverâs name, type, and url are unchanged, existing headers are preserved; if headers is non-empty, it replaces all headers for that server, and setting a key to an empty string deletes that key. Access credentials are not stored in the agent configurationâinstead, they are injected via a Vault when creating a session. See MCP and Vaults.
Skill references
Each entry inskills contains skill_id and version. When creating or updating an agent, omitting version pins it to the latest version available at write time; specifying an exact version pins that version; explicitly passing "latest" preserves the literal "latest" value and re-resolves it whenever the agent is read or woken up. See Skills for details.
Official agents vs. custom agents
Agents fall into two categories:Official agents are read-only: you can inspect their full configuration and reference them directly when creating sessions, but update and archive requests are rejected. To customize one, create your own custom agent based on the official agentâs configuration.
API endpoints
When listing agents, you can pass
exclude_multiagent=true to return only agents without multiagent configuredâuseful when building a delegation list and filtering out agents that already delegate to others.
In addition to the console and REST API, you can create, update, and archive agents with the kha CLI. The examples below show both cURL and kha CLI commands; cURL examples read your API key from the KIMI_API_KEY environment variable.
Create an agent
Creating a minimal working agent requires onlyname and model, though you will typically include a system prompt as well. A successful request returns the full agent object, including its id and initial version. Save the id for creating sessions later.
Update an agent
Updates follow an immutable versioning model:PATCH does not mutate the configuration in place, but instead creates a brand-new immutable version based on the current configuration while preserving earlier versions. On the agent details page in the console, you can edit the current version from the Configuration tab; saving also creates a new immutable version.
Keep two rules in mind when updating via the API:
- Optional
versionconcurrency control: You can include the currentversionreturned when reading the agent in the request body. If the agent was modified in the meantime, the server responds with409; re-fetch the latestversionand retry. Omittingversionskips the concurrency check. - Only included fields are updated: Omitting a field leaves it unchanged; explicitly passing
nullreturns400(invalid_parameter_error). Array fields (skills,plugins) andmetadataare replaced in fullâpass an empty array or empty object to clear them.toolsfollows the same rule, except that omittingagent_toolset(including passing[]) keeps the current versionâsagent_toolsetdeclarations, or prependsagent_toolset_20261101if none exists; if you update an older version that has noagent_toolsetand omittools, the request returns400failed_precondition_error.mcp_serversreplaces the array in full, except forheaders, which preserves or replaces entries according to the rules under âMCP serversâ above.
View version history
Every update creates a new immutable version. You can inspect the full configuration of any historical version through the version history endpoint. Results are paginated; usenext_page_token in the response to fetch the next page (the field is omitted when there are no more results).
View associated resources and runtime metrics
The agent details page in the console also provides the following tabs:- Sessions: Lists sessions and their pinned versions, with filtering by version, source, and status. After an agent is updated, existing sessions continue displaying the version pinned at creation time; newly created sessions without an explicit version use the current version.
- Deployments: Shows associated triggers along with their version, next run, last run, and creation time.
- Observability: Shows total sessions, session success rate, tool calls, and token usage, as well as recent sessions and associated triggers.
Archive an agent
When an agent is no longer needed, you can archive it by selecting Archive from the action menu in the consoleâs agent list or by calling the archive endpoint. Once archived:- The agent becomes read-only, and update requests are rejected.
- It is hidden by default from the agent list and the agent selector when creating a session, and can no longer be used to create new sessions.
- The agent and its historical versions remain directly readable.
- Existing sessions are unaffected and can continue running and resuming.
204 and an empty response bodyâdo not attempt to parse response JSON.
Next steps
Start a task with your agent
Launch a task session using the agent you created.
Configure built-in and custom tools
Learn how to configure the built-in toolset and custom tools.
Attach skills
Mount versioned skill packages onto your agent.
Connect MCP servers
Connect remote MCP servers and inject access credentials.
Manage access credentials
Store and manage credentials for MCP and external services.