Skip to content

Approvals and operation jobs

Campaign publication, unpublication and respondent access are separate operations. Draft writes do not authorize either effect. campaign:publish permits preparing publication campaign:unpublish permits preparing unpublication, and campaign:access permits preparing access changes. All are part of the complete permission set and are included with read and write access; read-only access excludes them. Existing grants and refresh tokens retain their original scopes.

Read campaign_get, then prepare the intended operation with the current revision:

{
"campaignKey": "solar-consultation",
"expectedRevision": 3,
"idempotencyKey": "solar-access-20261109",
"maximumCredits": 0,
"publicAccess": true
}

Send this to campaign_prepare_access_change. For publication, use campaign_prepare_publish with the same fields except publicAccess and a new idempotency key. Preparation runs the same domain checks as Betterstood and returns an immutable preview, operation ID, approval URL and deadline. It does not perform the effect. Unknown fields, including confirm: true, are rejected.

Publication activates a ready draft with its existing access mode. Public access allows collection only when the campaign is active. Changing access revokes existing access sessions and invitation links. Setting publicAccess: false requires a new password to be configured in Betterstood before respondents can enter; the agent never receives a password or invitation secret. Public access is unavailable for telephone campaigns.

Call campaign_prepare_unpublish with the campaign key, current revision, idempotencyKey, maximumCredits: 0 and cancelScheduledCallbacks: false. It prepares ACTIVE → DRAFT without changing access settings or deleting results. The user approves the preview and the agent waits for job success. New respondent collection then stops. Existing interactions are not terminated.

If callbacks still await dispatch, including ones whose scheduled time has passed, preparing the change requires cancelScheduledCallbacks: true. The preview shows their count; approval binds the exact callback identities and scheduled times. They are cancelled with the campaign transition and are not recreated by republishing. New or rescheduled callbacks invalidate approval. In-flight dispatch blocks unpublication.

Use scenario_update_draft, then scenario_prepare_channel (voice for Web Call/Phone Call, text_chat for Text Chat), review the updated draft, and prepare publication with campaign_prepare_publish. Each effect needs its own approval. All active campaigns sharing the scenario must first be unpublished; alternatively, clone the scenario and configure the draft campaign to use the copy.

Give the user the returned approvalUrl. The user must sign in to the account that owns the connection and review the organization, campaign, revisions, changes, effects, cost and deadline. An owner/admin with a recent, personal session can approve or decline. Impersonation cannot approve. A model assertion, MCP parameter, copied approval URL or an OAuth grant is not this approval.

Approval is bound to the connection, user, organization, operation, resources, configuration snapshot, revisions, budget and 15-minute deadline. It queues a job; it does not bypass readiness. Configuration changes require a new preview. The worker rechecks current permissions, membership, entitlement, deadline and resource state before committing. Revocation, scope removal and plan or role downgrades stop queued effects. An active editor lease postpones execution.

Show approvalUrl in a progress message, keep the current agent turn active, then call betterstood_operation_wait:

{
"operationId": "<returned UUID>",
"timeoutMs": 10000
}

Do not end the turn asking the user to say “done”. The tool waits for approval and worker completion, returning the operation receipt as soon as it observes a terminal state. The optional timeoutMs is an integer from 1,000 to 10,000; the default is 10,000. A pending result after the wait window is not a job failure.

  • nextAction: "wait": call the same tool again with the same operation ID. Keep the approval link available; stop waiting if the user pauses or cancels.
  • nextAction: "inspect_result": inspect operation.state, error and result. Continue the requested workflow only after successful completion. Explain failure, cancellation, expiry or partial/unchanged configuration.

This works through an active MCP tool call and needs no new event capability. It cannot wake a chat that the client has ended or suspended. Such a client can resume by calling the wait tool with the original operation ID; the human approval and durable job do not depend on the chat staying connected.

Only the exact requesting connection can read its operation, and it must still have that operation’s effect scope. The observation tools’ campaign:read scope is necessary but does not by itself authorize a job read or cancellation. Every read during a wait rechecks current ownership, scopes, role and entitlement. Reads are sequential, once per second, in separate transactions. The MCP request deadline and client disconnect stop observation without cancelling the job. Existing rate/concurrency limits apply; honor retry delays on transient errors and stop on access loss.

States are awaiting_approval, queued, running, succeeded, failed, cancelled and expired. Current database-only campaign jobs move atomically from queued to a terminal state, so running need not be observed. On success, the result contains the campaign key, new revision, status and access mode. These are allowlisted metadata, without private configuration or access secrets.

betterstood_operation_get returns a single immediate snapshot for inspection. betterstood_operation_cancel cancels pending work when cancellable is true. Cancellation and worker execution serialize: the returned terminal state is authoritative. Cancellation never undoes a committed effect.

Preparation retries with identical arguments and key return the same operation for 24 hours. Reusing the key with different input returns IDEMPOTENCY_KEY_REUSED. After a lost response, reuse the key or read the job; do not create another intent. The database effect and job receipt commit in one transaction, preventing duplicate effects after a crash or concurrent retry. Expired, stale or failed operations require a newly reviewed request and key.

MCP is included on every plan, including Free and Pro, for owners/admins with its entitlement enabled. Preparation, consent, job reads/waits/cancellation, campaign publication, unpublication and access changes consume 0 credits. Their maximum operation budget is therefore 0. Later respondent conversations retain their existing rating and limits. There is no MCP surcharge or automatic credit purchase.

At most 10 pending/running operations per connection and 50 per organization may exist. Approval and the start of execution must occur within 15 minutes of preparation; receipts are retained for 24 hours. Existing request limits still apply. The operation deadline is independent of browser login age. A valid signed-in session can approve an operation without signing out and back in, even if the login occurred more than 15 minutes ago. An expired operation requires a new preview from the agent, not another login. AUTHORIZATION_CHANGED, APPROVAL_EXPIRED, REVISION_CONFLICT, PREVIEW_CHANGED, CONDITIONS_CHANGED and INVALID_APPROVAL are terminal job errors. Read the current resource and prepare a new operation after resolving the reason; do not blindly resubmit stale configuration.

Transcript tests, Coach and analysis execution jobs are not yet available through these tools. Use the effective catalog and current reference. Implementation, deployment and native-client acceptance are separate facts.

knowledge:write saves settings. Source preparation requires knowledge:prepare together with knowledge:read, both included with read and write access. Existing grants are never widened automatically.

Call scenario_knowledge_stage_source with one source:

{
"scenarioId": "scenario_01",
"expectedRevision": 2,
"idempotencyKey": "prepare-product-faq-20261109",
"source": { "kind": "url", "url": "https://example.com/product-faq.txt" }
}

For files, replace source with a closed object containing kind: "file", fileName: "faq.txt" and contentBase64. Supported extensions are PDF, txt, md, csv, json, html and htm. Decoded files must be 1–131072 bytes. Use Studio for larger files (up to the canonical 10 MiB limit). URLs must be public HTTPS without credentials or a fragment; DNS, redirects and the fetched content are checked by the same ingestion service as the web product. The URL fetch limit is 10 MiB; revisions retain the canonical 50 sources / 50 MiB bounds. Preparing a source with the same canonical identity replaces its draft entry rather than duplicating it.

The result has state: "queued", approvalRequired: false, approvalUrl: null and a statusUrl. This is configuration authorized by the dedicated OAuth grant: no additional approval, publication, embedding or credit charge occurs. Poll the operation. running covers external source I/O. On success, the result gives the scenario ID/revision, canonical Knowledge Base revision ID and publicationStatus: "draft". Read scenario_knowledge_get afterward. Its readiness uses the actual canonical published revision/projection used by campaign publication; its saved publicationStatus alone does not prove readiness.

The job rechecks authorization and the scenario lease before storage/fetch and commit. Revocation, downgrade, an active campaign or a changed revision stops new work. The durable ingestion receipt recovers an already staged source after a crash; the scenario snapshot and terminal job receipt commit together. A failed or expired job can leave an unpublished private draft for recovery in Studio. Running source jobs cannot be cancelled; the returned cancellable is authoritative. The source content and checkpoint are private and retained with the receipt for 24 hours; public job output never includes them. Publication/embedding remains a separate capability, and is not performed by this source tool.

Source jobs permit at most three execution attempts within their 15-minute deadline. A persistent I/O failure ends with CONDITIONS_CHANGED; inspect the private draft before creating a new intent. A retry never publishes or embeds.

Private source storage and settings remain separate from execution. Request knowledge:read plus knowledge:publish for publication/removal, or knowledge:read plus knowledge:validate for retrieval validation, using fresh unchecked consent. These scopes do not publish a campaign or change public access. Developer Access and knowledge_base_embedding must both be available; active campaign Knowledge Base changes remain in Studio.

After scenario_knowledge_get, call scenario_knowledge_prepare_publish:

{
"scenarioId": "scenario_01",
"expectedRevision": 4,
"idempotencyKey": "publish-faq-20261109",
"maximumCredits": 100
}

The preview identifies the scenario revision, immutable knowledge revision and source manifest. Text-only embedding retains the existing 100-credit rating; a revision containing PDF retains 200 credits. A lower maximumCredits is rejected before approval. billingMode: "shadow" records the weight without a real credit deduction; enforce uses the ordinary ledger. A mode or material configuration change invalidates the approval. There is no MCP surcharge.

For scenario_knowledge_prepare_removal, add the exact sourceId returned by scenario_knowledge_get. Source identifiers are bound to the current scenario revision; reread after an edit. The preview explicitly lists removal plus either republication of remaining sources (100/200 credits according to their content) or disabling the last source (0 credits). This is never an implicit free removal followed by an unapproved embedding operation.

For scenario_knowledge_prepare_validation, supply the same common fields, maximumCredits: 0, and a query of 1–2000 characters. The current latest revision must be published and ready. Approval binds the query. The shared retrieval service returns only a result count, at most the configured 1–10 results, and validation time; private passages are not exposed. A timeout without a durable validation result returns RECOVERY_REQUIRED on recovery, requiring a new reviewed request rather than silently repeating the search.

All three tools prepare a job with approvalRequired: true. Send its real Betterstood approval URL to the user. The worker rechecks the grant, role, entitlement, configuration, budget mode and lease before provider I/O and inside the canonical credit transaction. Concurrent retries reuse the immutable domain operation and ledger receipt. Provider identifiers and internal checkpoints are never included in public output.

Publication can remain running while the canonical projection worker completes or reconciles an already accepted operation. Expiry prevents starting new work; it does not undo an accepted effect, cancel its reconciliation or promise a refund. The domain’s existing terminal-evidence refund rules apply. Only pending jobs can be cancelled. Poll the same operation after timeouts; do not create a new publication or idempotency key to force a retry.

On completion, result includes publicationStatus, knowledgeBaseRevisionId, revision, configurationUpdated and nullable validation metadata. The public job defers its configuration commit until the terminal domain outcome; Studio may save intermediate progress and later refresh it. Each actual configuration commit uses the same revision fence. Configuration and the terminal job receipt commit atomically. If authorization or configuration changes after the external effect, the job is failed with an explicit result and configurationUpdated: false; the accepted domain effect is still recorded. Inspect it in Studio before a new intent. EXECUTION_FAILED describes a terminal domain failure; CONFIGURATION_CHANGED_AFTER_EXECUTION describes a configuration commit that could not follow the effect. A failed job is not evidence of a refund.

The current v31 artifact replaces the prior MCP artifact tree. Existing grants and refresh authority are preserved; the new permissions require new consent. Webhook wire schemas remain v17, with unchanged queued payloads, signatures and receipts. This source capability still requires deployment and client acceptance before production availability can be claimed.