创建部署
为智能体新建一个定时部署,让它在指定计划或触发条件下自动运行。
/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必填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必填
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必填
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
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this deployment. |
| agent | object | A resolved agent reference with a concrete version. |
| agent.id | string | |
| agent.type | string | |
| agent.version | number | |
| 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 | ID of the `environment` where sessions run. |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 |