Agent

更新时间:
复制 MD 格式

An agent is a reusable configuration of a model, system prompt, toolkits, and skills. Each update auto-increments the version number; sessions lock to the version that was current when they were created.

Versioning

An agent tracks its configuration history with the integer version field. The behavior is as follows:

  • The update endpoint uses full-replacement semantics. On success, version auto-increments by 1. The request body must carry the current value as an optimistic lock; a mismatch returns 409.

  • A session locks to the current version at creation time and is not affected by later updates. To query a historical version, use GET /agents/{agent_id}?version=N.

  • Archive is a soft operation: archived_at is set to the archive time. An archived agent cannot be used to create new sessions; existing sessions are unaffected.

Agent operations

Operation

Endpoint

Description

Create Agent

POST /agents

Create an agent; initial version is 1.

Get Agent

GET /agents/{agent_id}

Returns the latest version by default; pass ?version=N to query a historical version.

List Agents

GET /agents

Paginated list of agents under the workspace; archived agents are excluded by default.

Update Agent

POST /agents/{agent_id}

Full replacement; the request body must include version as an optimistic lock and is auto-incremented on success.

Archive Agent

POST /agents/{agent_id}/archive

Soft archive; cannot be used to create new sessions, existing sessions are unaffected.

List Agent Versions

GET /agents/{agent_id}/versions

Paginated list of all historical versions of the agent.