Skip to content
Covo Developers

Reference

Apply a draft

Applies an open draft to the live agent, saving an automatic version first.

RESTPOST /api/v1/agents/{agent_id}/drafts/{draft_id}/apply
MCP toolapply_draft
ClassificationSensitive write
Scopeagents:write
Minimum role on the agenteditor
ConfirmationRequired: confirm: true, after the person agrees
Retry safetySend an Idempotency-Key header (REST) or idempotency_key argument (MCP) to retry safely
Success status200

What it does

Applies an open draft to the live agent, saving an automatic version first. Refuses with version_conflict if the agent changed after the draft was written, unless force is true. Removals need confirm: true.

Side effects

Saves a version, then applies the draft to the configuration. If the agent is published, visitors see it at once.

Inputs

NameTypeRequiredInDescription
agent_idstringyespathThe agent id (agt_...), from list_agents.
draft_idstringyespathThe draft id.
forcebooleannobodyApply even though the agent changed since the draft was written. Default false.
confirmtruenobodySet to true after reviewing the effect with the person you work for. Required for destructive operations.

Example

REST
curl -X POST "https://covo.lanaai.io/api/v1/agents/agt_4edc89bb2964/drafts/80da083a-0818-47b5-afc4-ef5b39c59137/apply" \
  -H "Authorization: Bearer $COVO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"confirm":true}'
MCP (POST /mcp)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "apply_draft",
    "arguments": {
      "agent_id": "agt_4edc89bb2964",
      "draft_id": "80da083a-0818-47b5-afc4-ef5b39c59137",
      "confirm": true
    }
  }
}

Response

Returns an object with draft_id, status, applied, revision, previous_revision, changes, backup_version and validation. This is a real response, shortened to two items per list.

200 response
{
  "draft_id": "80da083a-0818-47b5-afc4-ef5b39c59137",
  "status": "applied",
  "applied": true,
  "revision": 7,
  "previous_revision": 6,
  "changes": [
    {
      "path": "personality.greeting",
      "operation": "replace",
      "before": "I'm Avery Quinn's Concierge. I can help you learn about Avery Quinn's work, what's on offer, or anything else you're curious about.",
      "after": "Hi, I am Avery’s Concierge. Ask me about spring projects."
    }
  ],
  "backup_version": 2,
  "validation": {
    "valid": true,
    "state": "ready",
    "errors": [],
    "warnings": [
      {
        "step": "knowledge",
        "field": null,
        "severity": "recommended",
        "message": "Add a few common questions. Short, specific answers work best."
      },
      {
        "step": "publish",
        "field": null,
        "severity": "recommended",
        "message": "Ask the preview a question before you publish."
      }
    ]
  }
}

Over MCP the same object comes back as the tool result, in structuredContent and as JSON text.

Errors

StatusCodeMeaning
401unauthorizedNo token, or it is unknown, revoked or expired. OAuth apps refresh or reconnect.
403account_suspendedThe account that owns the token is paused.
403insufficient_scopeThe token lacks agents:write.
404agent_not_foundUnknown agent, or not reachable with this token.
400bad_requestAn input is invalid; field names it.
409confirmation_requiredReview the effect with the person you work for, then send confirm: true.
409, 422idempotency_in_progress, idempotency_key_reusedSee Idempotency on the REST page.
429rate_limitedWait Retry-After seconds.