---
title: "Compose agent scenario"
method: POST
path: "/api/agent-scenarios/compose"
tags: ["agent_scenarios"]
---

# Compose agent scenario

`POST /api/agent-scenarios/compose`

## Request

- Base URL: `https://beta.getsales.io/unibox/v1`
- URL: `https://beta.getsales.io/unibox/v1/api/agent-scenarios/compose`
- Auth: HTTP bearer and API key in header `Team-SID`

Compose a scenario draft from what the person said: a new scenario of the team's own, or with sid a change to it, the unmentioned kept. Nothing is saved: the draft comes back to edit and save through create_agent_scenario or update_agent_scenario (platform_key names a platform scenario it recognized: edit that one). result.notes says what it still needs. 503 composer_unavailable; 422 compose_invalid (outside the vocabulary); 404 when sid names no scenario.

Contract:
- MCP tool `compose_agent_scenario`, registry package `mcp.unibox/agent_scenarios`, mount `unibox.agent`.
- Operation `action`, response envelope `action`.
- Flags: read only.

## Request body

- ComposeAgentScenarioRequest: Request body of `compose_agent_scenario`.
  - `agent_sid` string: The AI SDR whose scenario it is (ub_ag_…); with a platform key, which agent's version. Left out, the team's default agent.
  - `text` string, required: What the person said, as they said it.
  - `sid` string: The scenario the words change; leave it out for a new scenario.

## Response `200`

`action` success envelope.

- ComposeAgentScenarioResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` unknown, required
  - `result` object, required
    - `draft` object, required
      - `title` string, nullable, required: A new scenario of the team's own: its name. A change to a platform scenario: null (the name is the platform's).
      - `trigger` string, nullable, required: A new scenario: when it applies, in the words a reply would use (the classify reads it). A change to a platform scenario: null.
      - `goal` string, required: One line: what the scenario is for.
      - `steps` object[], required: The steps in order, as create or update takes them: every param a value of its dictionary, the defaults filled, enabled and locked set.
        - `id` string, required: Stable inside the playbook (react, stage, reply, wait, followup, last_wait, task on the platform seeds); minted for an added step.
        - `kind` 'react' | 'move_stage' | 'like_post' | 'send_message' | 'wait_for_reply' | 'wait_until' | 'create_task' | 'find_people' | 'reach_objective' | 'use_playbook' | 'resume_orchestration' | 'stoplist_person', required
        - `enabled` boolean, required: Off: never planned under this scenario.
        - `locked` boolean, required: Platform only: the step cannot be switched off, moved or removed (the stoplist step of do_not_contact).
        - `when` string, nullable, required: "Plan it when ...": the condition the planning turn judges; null = always.
        - `instructions` string, nullable, required: What the step must do or say, the text the model reads; the product copy a team reads IS the prompt text.
        - `params` object, required: The kind's product parameters, each a value of its dictionary (see above).
      - `instructions` string, nullable, required: The team's words over every step; null when there are none.
      - `level` 'autopilot' | 'copilot' | 'conditional' | 'off', required: The level the draft keeps or sets: off only when the person wants no reply at all, never with a message step; the scenario's own level otherwise.
      - `platform_key` string, nullable, required: A new scenario the composer recognized as one of the platform's (an objection, a meeting request, ...): edit that one instead of making a duplicate. Null otherwise.
      - `notes` string[], required: What the composer could not do or still needs to know (a step kind that does not exist, a cap the ask exceeds, a link the person did not give), one short line each.
    - `basis` object, nullable, required: The scenario the draft changes, as the call named it; null for a new scenario.
      - `sid_or_key` string, required
      - `source` 'platform' | 'edited' | 'custom', required
      - `key` string, nullable, required
    - `cost_usd` number, nullable, required: What the composition cost on the model, a few thousandths of a dollar.
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/revisions/8f1bc317897f?raw)
