跳转到内容
EN

更新部署

POST/agent/v1/deployments/{deployment_id}● 支持

请求参数

  • deployment_idstring必填

    path: Deployment id (depl_...), returned by deployments.create or deployments.list.

  • namestring可选

    可读名称,必须非空。省略则保留,不可清除。

  • agentstring | object可选

    要运行的智能体:智能体 ID 字符串,或对象 {type, id, version?}(见子字段);版本与覆盖规则见操作说明。

    展开子字段 (6)
    • idstring必填

      会话要运行的智能体 ID。

    • typestring必填

      引用类型:agent,或携带内联覆盖的 agent_with_overrides。

      取值 agentagent_with_overrides
    • versionnumber可选

      固定使用的智能体版本;省略取创建会话时的 active_version(不一定是最新保存版本)。

    • permission_modestring可选

      每个新会话的权限模式;省略或 null 继承智能体策略。type 为 agent 时不使用。

    • cwdstring可选

      每个新会话的工作目录;省略则使用会话默认值。type 为 agent 时不使用。

    • modelstring | object可选

      替换本会话的模型:模型名字符串(如 claude-opus-5)或配置对象;省略沿用智能体自身的模型。

  • environment_idstring可选

    会话运行环境的 environment ID。省略则保留,不可清除。

  • metadataobject可选

    元数据补丁。将键设为字符串以新增或更新,设为 null 以删除。省略则保留。存储最多 16 个键,每个键最多 64 个字符,值最多 512 个字符。

  • budgetobject可选

    硬性费用上限。记录的列表价费用达到 max_list_cost 后,会话停止发起新的模型请求。

    展开子字段 (2)
    • max_list_costobject必填

      会话可达到的列表价费用上限:{amount, currency:"USD"},amount 以美元为单位,传整数或最多 2 位小数(如 "0.50"),响应固定 2 位小数(如 "20.00")。

    • typestring必填

      预算类型,恒为 limit;传 max_list_cost 等其他值返回 400。

      取值 limit
  • descriptionstring可选

    Description. Omit to preserve; send empty string or null to clear.

  • initial_eventsarray可选

    初始事件,整体替换。省略则保留,不可清除。至少 1 条,最多 50 条。

  • resourcesarray可选

    会话资源,整体替换。省略则保留;空数组或 null 清除。最多 500 项。

  • scheduleobject可选

    5-field POSIX cron schedule. Literal wall-clock matching in the configured timezone.

    展开子字段 (3)
    • expressionstring必填

      五字段 POSIX cron 表达式:分、时、日、月、星期(如工作日早上 9 点为 0 9 * * 1-5)。星期为 0–7,0 和 7 均表示星期日。不支持扩展 cron 语法(秒或年字段,以及特殊字符 L、W、#、?),也不支持预定义快捷写法(如 @daily)。

    • timezonestring必填

      必填。IANA 时区标识(如 America/Los_Angeles、UTC)。按 IANA 时区数据库验证。

    • typestring必填

      Cron schedule selector: five POSIX fields matched in the required IANA timezone.

      取值 cron
  • 更多参数 (2)
    • vault_idsarray可选

      保险库 ID,整体替换。省略则保留;空数组或 null 清除。最多 50 项。

    • targetobject可选

      执行目标。environment(默认)要求现有且未归档的 environment_id。computer 仅供个人智能体使用,允许省略 environment_id。

      展开子字段 (1)
      • typestring必填

        environment uses an environment recipe; computer uses the agent computer.

        取值 environmentcomputer

返回

200

支持部署资源创建、读取、过滤、更新、归档、暂停与恢复,固定智能体版本并返回最多五次未来调度时间;初始事件仅 user.message,资源仅 file;vault_ids 最多 50 个、自动去重,须属于当前组织且未归档,不存在或已归档返回 400 vault_ids[<index>] <id> was not found。支持手动运行及每分钟 cron 调度,运行创建的会话携带该部署的 vault_ids;创建失败会记录运行错误并自动暂停,部署保存后保险库被归档记为 vault_archived_error。 自有扩展接受 agent_with_overrides 与 target=computer(仅 general 智能体)。

错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码

请求示例

curl
curl https://api.deepraxis.com/agent/v1/deployments/depl_123 \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"文档测试(已更新)"}'
Python
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.post(
    f"{opts['base_url']}/v1/deployments/depl_123",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
    json={"name":"文档测试(已更新)"},
)
print(resp.status_code, resp.json())
TypeScript
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/deployments/depl_123`, {
  method: "POST",
  headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({"name":"文档测试(已更新)"}),
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "id": "depl_83bb5a29306346a981bbb3f6ea93c61b",
  "type": "deployment",
  "agent": {
    "type": "agent",
    "id": "agent_3a5f2fc1-018b-4b37-82ae-e304ed0a36d4",
    "version": 1
  },
  "target": {
    "type": "environment"
  },
  "environment_id": "env_146ed831076e402980f28d7802ecdc8d",
  "name": "文档测试(已更新)",
  "description": null,
  "initial_events": [
    {
      "type": "user.message",
      "content": [
        {
          "type": "text",
          "text": "Hi"
        }
      ]
    }
  ],
  "resources": [],
  "vault_ids": [],
  "budget": null,
  "schedule": null,
  "metadata": {},
  "status": "active",
  "paused_reason": null,
  "created_at": "2026-10-22T15:24:43.200Z",
  "updated_at": "2026-10-22T15:24:44.186Z",
  "archived_at": null
}

响应

HTTP 200

Successful response

application/json

名称 类型 说明
id string Unique identifier for this deployment.
agent object Agent reference. Naming a version pins the deployment to it; naming only an id (or a bare id string) makes it follow the agent's active version, so every run uses whichever version is in effect then and a later agent save carries through automatically. The response also carries pinned_version (null while following) and active_version (the agent's currently effective version). The own face also accepts model, permission_mode and cwd overrides for new sessions.
agent.id string Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. / The agent ID.
agent.type string Always agent. An agent definition. / An agent reference with model, permission_mode and cwd overrides for new sessions.
agent.version number The latest saved version of the agent, the editable head; it differs from active_version after a save with apply false. Starts at 1 and increments each time the agent is modified. / The agent version this deployment uses now; while the deployment follows the agent this is the active version, otherwise the version it is pinned to.
agent.pinned_version integer | null The version this deployment is pinned to; null when it follows the agent's active version.
agent.active_version integer | null The agent's currently effective version, the one a run would use now; null when the agent cannot be read.
agent.permission_mode string | null Permission mode for each new session; omitted or null inherits the agent policies.
agent.cwd string Working directory for each new session; omitted uses the session default.
agent.model string | object Replacement model id or model_config. Validated and stored without executing a session.
archived_at null | string A timestamp in RFC 3339 format
created_at string A timestamp in RFC 3339 format
description null | string Description of what the deployment does.
environment_id string | null Existing, unarchived environment id; environment_id and target are alternatives, so send at least one. target=environment requires it, target=computer (own face, general agents) may omit it; null is also accepted there.
initial_events array<object> Events sent to each session immediately after creation.
initial_events[].content array<object> Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].type string Always user.message. A message from the user to the agent, with content blocks. / Always user.define_outcome. The user defined the outcome the agent should reach. / Always system.message. A message produced by the platform rather than the user or the agent.
initial_events[].description string What the agent should produce. This is the task specification.
initial_events[].rubric object Rubric for grading the quality of an outcome.
initial_events[].max_iterations null | number Eval→revision cycles before giving up. Default 3, max 20.
metadata object Arbitrary key-value metadata. Maximum 16 pairs.
name string Human-readable name.
paused_reason null | object Why a deployment is paused. Non-null exactly when status is paused.
paused_reason.type string Always manual. An explicit request triggered this run or paused this deployment. / Always error. A stream error.
paused_reason.error object The error that triggered an auto-pause. Matches the failed run's error.type.
resources array<object> Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].type string Always github_repository. A GitHub repository resource; not supported on this platform. / Always file. A file resource: an uploaded file mounted into the session's machine. / Always memory_store. A memory store resource; not supported on this platform.
resources[].url string Github URL of the repository
resources[].checkout null | object Branch or commit to check out. Defaults to the repository's default branch.
resources[].mount_path null | string Mount path in the container. Defaults to /workspace/<repo-name>. / Mount path in the container. Defaults to /mnt/session/uploads/<file_id>.
resources[].file_id string ID of a previously uploaded file.
resources[].memory_store_id string The memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].access null | string Access mode for an attached memory store.
resources[].instructions null | string Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedule null | object 5-field POSIX cron schedule with computed runtime timestamps.
schedule.expression string 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezone string IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.type string Always cron. A five-field POSIX schedule matched in its IANA timezone.
schedule.last_run_at null | string A timestamp in RFC 3339 format
schedule.upcoming_runs_at array<string> Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (archived_at set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
status string Lifecycle status of a deployment.
type string Always deployment. A frozen set of session parameters and an optional schedule.
updated_at string A timestamp in RFC 3339 format
vault_ids array<string> Vault IDs supplying stored credentials for sessions created from this deployment.
budget null | object A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.
budget.max_list_cost object A monetary amount in a specific currency.
budget.type string Budget kind; always limit. Any other value, including max_list_cost, returns 400 budget.type must be "limit".
target object Execution target. environment (default) requires an existing, unarchived environment_id. computer is available only for general agents and permits environment_id to be omitted.
target.type string environment uses an environment recipe; computer uses the agent computer.

运行示例前

先创建部署,用返回的 ID 替换 depl_123。部署运行 ID drun_123 取自运行部署的响应。取消暂停前先暂停部署;测试结束后等待生成的会话空闲并删除会话,再归档部署、环境和智能体。