Skip to main content
Managed AgentsVersion: v3New

Start or continue a Managed Agent build

POST/agent-studio/managed-agents/builds

Builds a new Managed Agent, or edits one, from a plain-language request, using the same builder as the app. Returns 202 at once with a buildId; poll Get build until it finishes. To continue a build, send its buildId with answers to its questions, or with a follow-up message. The result is a saved draft; publish it with Publish a Managed Agent.

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your access token.

Scope:managed-agents.buildAndPublish
Auth methods:OAuthPrivate Integration
Token type:Sub-Account Token

Request​

Headers

Versionstringrequired

API version.

Available optionsv3
Example:v3
Idempotency-Keystringrequired

Unique key for this request. Resending it with the same request returns the original result.

Possible values: non-empty and <= 128 characters

Example:build-7f3cf4c0-39eb-46be-baa3-a1eb15021f25

Body

locationIdstringrequired

Location (sub-account) the agent belongs to

Example:ve9EPM428h8vShlRW1KT
messagestring

What to build or change, in plain language. Required, except when the request answers the questions of a build in NEEDS_INPUT.

Example:Build an agent that qualifies new leads and books them into my sales calendar
managedAgentIdstring

Edit this existing Managed Agent, published or not. Omit to create a new agent. Not allowed with buildId.

Example:027ee957-ae94-40ad-89a3-b25c985f729b
buildIdstring

Continue this build: answer its questions, or send a follow-up message such as a reply to its question. Not allowed with managedAgentId.

Example:b7a1f0e2-4c3d-4e5f-8a9b-0c1d2e3f4a5b
answersobject[]

Answers to the questions of a build in NEEDS_INPUT. Needs buildId; not allowed with message.

Example
[
  {
    "questionId": "a1b2c3d4e5f6",
    "values": [
      "uQWaF4gPj7NQ1696EEp2"
    ]
  }
]
skippedQuestionIdsstring[]

Question ids the user chose not to answer; the builder picks a sensible default for each

Example:["f6e5d4c3b2a1"]

Response

Build round started

buildIdstringrequired

Build id to poll and to continue the build with

Example:b7a1f0e2-4c3d-4e5f-8a9b-0c1d2e3f4a5b
statusstringrequired

RUNNING: still building. NEEDS_INPUT: answer questions. NEEDS_REPLY: the builder asked something in message; send the reply as a new message on this build. ANSWERS_STALE: the questions changed, so send the request again. COMPLETED: done (changed tells whether the agent was saved). FAILED: see error.

Available optionsRUNNINGNEEDS_INPUTNEEDS_REPLYANSWERS_STALECOMPLETEDFAILED
Example:RUNNING
nextActionstringrequired

What to do next. POLL: call get build again after pollAfterMs. ASK_USER: show the user the questions or message and send their answer. REVIEW: the draft was saved; review it, then publish when ready. USE_RESULT: use message as the answer; nothing changed. RETRY: nothing was applied (see error or staleReason); send the request again with a new Idempotency-Key.

Available optionsPOLLASK_USERREVIEWUSE_RESULTRETRY
Example:POLL
pollAfterMsnumber

Milliseconds to wait before polling again (RUNNING only)

Example:5000
managedAgentIdstring

The agent this build creates or edits, once known

Example:027ee957-ae94-40ad-89a3-b25c985f729b
changedboolean

COMPLETED only: true when the agent draft was saved, false when the builder only answered

Example:true
messagestring

The builder's message: its summary, its answer, or the question it needs answered

Example:I built a lead qualifier that books qualified leads into your Sales calendar.
questionsobject[]

NEEDS_INPUT only: the questions to answer

staleReasonstring

ANSWERS_STALE only: why the answers no longer apply

Available optionsno_pending_roundexpiredconfig_changedwrong_targetround_mismatch
Example:expired
errorobject

FAILED only: why the build failed

hasPublishedVersionboolean

Whether the agent has a published version

Example:false
hasUnpublishedChangesboolean

Whether the saved draft differs from the published version

Example:true
createdAtstringrequired

When the build started

Example:2026-10-29T12:00:00.000Z
updatedAtstringrequired

When the build last changed state

Example:2026-10-29T12:01:30.000Z