An Agent is a reusable configuration template that defines an AI agent's model, instructions, and tools. Multiple Sessions can share one Agent, and modifying an Agent does not affect running Sessions.
Key concepts
You can think of an Agent as a "job description":
|
Element |
Description |
|
model |
The Agent's intelligence level |
|
system prompt |
The Agent's behavioral guidelines |
|
tools |
The actions the Agent performs |
|
Skills |
The high-level skills the Agent invokes |
An Agent itself does not execute tasks; it is merely a configuration. Task execution is handled by a Session bound to that Agent.
Parameter reference
|
Parameter |
Type |
Required |
Description |
|
|
string |
— |
System-generated ID, with an |
|
|
string |
— |
Always |
|
|
string |
Yes |
The Agent name. The recommended format is kebab-case (≤ 64 characters). |
|
|
string |
No |
A description for the Agent. Defaults to |
|
|
string |
Yes |
The model identifier. See details below. |
|
|
string |
No |
The system prompt. Defaults to |
|
|
string |
No |
Behavioral instructions appended to the system prompt. |
|
|
array |
No |
A list of available tools. See details below. |
|
|
array |
No |
A list of associated Skill IDs. |
|
|
array |
No |
A list of MCP server configurations. Defaults to |
|
|
string |
No |
The default Environment ID for this Agent. Defaults to |
|
|
object |
No |
Custom key-value pairs for tagging and filtering. |
|
|
integer |
— |
The version number, which starts at 1 and increments with each update. |
|
|
boolean |
— |
Whether the Agent has been archived. Defaults to |
|
|
string|null |
— |
The archival timestamp in ISO 8601 format. |
|
|
string |
— |
The creation timestamp in ISO 8601 format. |
|
|
string |
— |
The timestamp of the last update. |
Model
The model field specifies the model that the Agent uses.
|
Value |
Description |
|
|
Automatic model selection |
|
|
Qwen flagship |
|
|
Qwen multimodal |
|
|
Qwen lightweight |
|
|
DeepSeek flagship |
|
|
DeepSeek lightweight |
|
|
Zhipu flagship |
|
|
Moonshot AI |
|
|
MiniMax |
Tools
The tools field is an array of tool objects. Currently, only the agent_toolset_20260401 toolset is supported. You enable atomic tools within this toolset by listing them in the enabled_tools array:
{
"tools": [
{
"type": "agent_toolset_20260401",
"enabled_tools": ["Bash", "Read", "Write", "Edit", "Glob", "Grep", "WebFetch", "WebSearch"]
}
]
}
Available values for enabled_tools (values are case-sensitive and must be in PascalCase):
|
Tool name |
Description |
|
|
Execute shell commands. |
|
|
Read file content. |
|
|
Create or overwrite a file. |
|
|
Edit part of a file. |
|
|
List files using wildcards. |
|
|
Search for content within files. |
|
|
Perform an HTTP GET request for a single webpage. |
|
|
Search the web. |
For more tool configurations, see Agent Tool Configuration.
Manage agents
For all CRUD operations, see API Reference / Agents. The following examples cover common workflows.
Create
curl -s -X POST https://api.qoder.com.cn/api/v1/cloud/agents \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"name": "code-reviewer",
"model": "auto",
"instructions": "You are a code review expert. Review the code line by line and output issues and improvement suggestions in Markdown.",
"tools": [
{
"type": "agent_toolset_20260401",
"enabled_tools": ["Bash", "Read", "Write"]
}
],
"metadata": {
"team": "backend",
"purpose": "code-review"
}
}' | jq .
A successful request returns 201 Created. The version starts at 1.
Query
# Get a single Agent
curl -s https://api.qoder.com.cn/api/v1/cloud/agents/agent_xxx \
-H "Authorization: Bearer $QODER_PAT"
# List Agents with pagination
curl -s "https://api.qoder.com.cn/api/v1/cloud/agents?limit=20" \
-H "Authorization: Bearer $QODER_PAT"
Update
When you update an Agent, you must provide the current version. For more information, see Version management below.
curl -s -X PUT https://api.qoder.com.cn/api/v1/cloud/agents/agent_xxx \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"name": "code-reviewer",
"model": "auto",
"instructions": "You are a senior code review expert, focusing on security vulnerabilities and performance issues.",
"version": 1
}' | jq .
A successful request returns 200 OK, and the version increments by 1.
Delete
curl -s -X DELETE https://api.qoder.com.cn/api/v1/cloud/agents/agent_xxx \
-H "Authorization: Bearer $QODER_PAT"
Deleting an Agent does not terminate active Sessions bound to it. A Session snapshots the Agent's configuration upon creation.
Version management
The Agent API uses optimistic concurrency control (OCC):
-
The
versionstarts from1upon creation. -
After each successful update, the
versionis automatically incremented by 1. -
Update requests must include the current
version. Two failure scenarios:-
Missing
versionfield — returns 400invalid_request_error("Field 'version' is required.") -
The
versionis provided but does not match the server-side version — returns 409conflict_error
-
This prevents concurrent modifications from overwriting each other.
Handling 409 conflicts
If your request fails because the version is outdated, you receive this error:
{
"type": "error",
"error": {
"type": "conflict_error",
"message": "Version conflict. Expected version 2, got 1."
}
}
To resolve the conflict:
-
GETthe latest Agent to retrieve the currentversion -
Re-apply your desired changes to the latest object data.
-
Use the new
versionto perform anotherPUT.
Best practices
-
Naming conventions — Use the
team-purposeformat, such asbackend-code-review,frontend-test-gen. -
Prompt refinement — Specify the role, output format, and constraints in the
systemfield. -
Apply the principle of least privilege: Grant only the
toolsessential for the task to minimize risk. -
Use metadata effectively: Add key-value pairs to categorize Agents for easier filtering and auditing.
-
Version locking in production — When creating a Session, use the
{"id": ..., "version": ...}format to lock the Agent version. This prevents new versions from affecting your online services.
FAQ
Q: Does updating an Agent affect currently running Sessions?No. A Session is bound to a specific Agent version upon creation.Q: Can the tools array be empty?Yes. An Agent without tools can only engage in text-based conversation and cannot perform actions.Q: Is there a length limit for the name field?Keep it under 64 characters and use lowercase letters, numbers, and hyphens.Q: How do I roll back to an older version of an Agent?Automatic rollback is not supported. Save the Agent configuration before updating it. To revert, PUT the old configuration with the latest version number.