Skip to content

Create Deployment

POST/v1/deployments

Create a Deployment that runs an Agent manually, on a cron schedule, or both.

Beta

Agent Deployments is a Beta API.

Create from an existing Agent

Use this mode when you already manage an Agent and Environment.

bash
curl -fsS -X POST https://api.sandbase.ai/v1/deployments \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "daily-ai-news",
    "agent_id": "agent_01abc",
    "agent_version": 1,
    "environment_id": "env_01abc",
    "initial_events": [{
      "type": "user.message",
      "content": "Find today’s important AI news and write a concise Chinese summary with source links."
    }],
    "timeout_policy": {
      "hard_timeout_sec": null,
      "inactivity_timeout_sec": 300
    },
    "schedule": {
      "type": "cron",
      "expression": "0 9 * * *",
      "timezone": "Asia/Shanghai"
    }
  }' | jq .

Create from a runtime definition

SandBase creates the Agent and Environment used by the Deployment from the runtime definition. Do not mix runtime with agent_id or environment_id.

bash
curl -fsS -X POST https://api.sandbase.ai/v1/deployments \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "daily-ai-news",
    "runtime": "hermes",
    "system": "Research carefully, verify sources, and be concise.",
    "skills": [],
    "tools": [{"type": "agent_toolset_20260401"}],
    "mcp_servers": [],
    "initial_events": [{
      "type": "user.message",
      "content": "Find today’s important AI news and write a concise Chinese summary with source links."
    }],
    "schedule": {
      "type": "cron",
      "expression": "0 9 * * *",
      "timezone": "Asia/Shanghai"
    }
  }' | jq .

JSON, application/yaml, and application/x-yaml definitions are accepted.

Request parameters

ParameterTypeRequiredDescription
namestringYesHuman-readable Deployment name.
agent_idstringExisting Agent modeNon-archived Agent visible to the organization.
agent_versionintegerNoVersion to pin. Defaults to the Agent's current version.
environment_idstringExisting Agent modeNon-archived, supported Environment in the organization.
runtimestringRuntime modeEnabled runtime profile. Cannot be mixed with Agent/Environment IDs.
descriptionstringNoManaged Agent description in runtime mode; not a Deployment description in existing-Agent mode.
modelstring or objectNoModel override in runtime mode.
systemstringNoSystem prompt in runtime mode.
skillsstring[] or nullNoSkill references in runtime mode.
toolsarray or nullNoTool configuration in runtime mode.
mcp_serversarray or nullNoOutbound MCP configuration in runtime mode.
initial_eventsarrayYesMust include at least one user.message event.
scheduleobject or nullNoFive-field cron schedule. null creates a manual-only Deployment.
timeout_policyobject or nullNoSandBase execution limits. Omit or use null for no hard limit and a 300-second inactivity limit.

Execution limits

json
{
  "hard_timeout_sec": null,
  "inactivity_timeout_sec": 300
}

hard_timeout_sec is an optional absolute limit measured from Run creation. null means SandBase does not impose a total-duration limit. When set, it must be between 60 and 604800 seconds.

inactivity_timeout_sec is optional inside the object and defaults to 300. When set, it must be between 180 and 3600 seconds and cannot be disabled. Authenticated runtime heartbeats and persisted Run progress refresh activity. API reads, Dashboard polling, and connection keepalives do not.

Schedule

json
{
  "type": "cron",
  "expression": "0 9 * * 1-5",
  "timezone": "Asia/Shanghai"
}

expression is a five-field cron expression without seconds. timezone must be a valid IANA timezone.

Response

json
{
  "id": "depl_01abc",
  "type": "deployment",
  "name": "daily-ai-news",
  "agent_id": "agent_01abc",
  "agent_version": 1,
  "environment_id": "env_01abc",
  "status": "active",
  "version": 1,
  "creation_mode": "advanced",
  "timeout_policy": {
    "hard_timeout_sec": null,
    "inactivity_timeout_sec": 300
  },
  "schedule": {
    "type": "cron",
    "expression": "0 9 * * *",
    "timezone": "Asia/Shanghai"
  },
  "next_run_at": "2026-07-22T01:00:00Z",
  "created_at": "2026-07-21T10:00:00Z",
  "updated_at": "2026-07-21T10:00:00Z"
}

Declarative responses use creation_mode: "declarative" and include the resolved runtime.

Errors

StatusTypeDescription
400invalid_creation_modeRuntime and Agent fields are mixed or incomplete.
400invalid_initial_eventsEvents are empty or contain an unsupported event type/content.
400invalid_scheduleCron expression or timezone is invalid.
400invalid_timeout_policyExecution-limit values or null/zero semantics are invalid.
404skill_not_foundA declared Skill is unavailable.
422unsupported_runtimeThe runtime profile is unknown or disabled.
422unsupported_sandbox_providerThe selected Agent or Environment cannot run on the supported provider.

Continue with Manage Deployments and Runs.