AnthropicClaude 托管智能体

创建部署

为智能体新建一个定时部署,让它在指定计划或触发条件下自动运行。

POST /anthropic/v1/deployments○ 未支持

请求体

  • namestring必填

    Human-readable name for the deployment.

  • agentstring | object必填

    Agent to deploy. Accepts the `agent` ID string, which pins the latest version, or an `agent` object with both id and version specified. The agent must exist and not be archived.

    ▸ 展开子字段(3)
    • idstring必填

      The `agent` ID.

    • typestring必填
      取值 agent
    • versionnumber可选

      The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

  • environment_idstring必填

    ID of the `environment` defining the container configuration for sessions created from this deployment.

  • initial_eventsarray必填

    Events to send to each session immediately after creation. At least 1, maximum 50.

  • budgetobject可选

    A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.

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

      A monetary amount in a specific currency.

    • typestring必填
      取值 limit
  • descriptionstring可选

    Description of what the deployment does.

  • metadataobject可选

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  • resourcesarray可选

    Resources (e.g. repositories, files) to mount into each session's container. Maximum 500.

  • scheduleobject可选

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

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

      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).

    • timezonestring必填

      Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Validated against the IANA timezone database.

    • typestring必填
      取值 cron
  • vault_idsarray可选

    Vault IDs for stored credentials the agent can use during sessions created from this deployment. Maximum 50.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-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.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<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.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring