Agents

Replace an agent draft (Preview)

Preview · Available to selected organizations. Replaces the whole draft and returns the agent with a new revision.

PUT
/v1/agents/{id}/draft

Replaces the whole draft and returns the agent with a new revision. The request names the revision it read; a stale revision returns 409. Published versions, and the conversations answered on them, do not change. An endpoint answers for one agent at a time: a draft that names an endpoint another agent answers on returns 409. A draft that pins a catalog model returns 402 unless your plan is Growth or Scale, and 422 when the model is not available or does not support the reasoning level.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^agt_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
revision*string
Length1 <= length
definition*

Response Body

Agent

application/json
  1. response
id*AgentId
Match^agt_[0-9a-hjkmnp-tv-z]{16,24}$
name*string
namespaceId*|null
revision*string
draft*
publishedVersion*|null
publishedAt*string|null
pausedAt*string|null
creditsPausedAt?string|null|null
monthlySpendCapDollars*number|null
spend*
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.agents.replaceDraft({  "id": "example",  "revision": "example",  "definition": {    "instructions": "example",    "knowledge": "example",    "endpointIds": [      "example"    ],    "integrations": [      {        "integrationId": "example",        "tools": {          "kind": "all"        },        "requireApproval": [          "example"        ]      }    ],    "mode": "live",    "model": "standard",    "reasoning": "auto",    "workingHours": {      "timeZone": "example",      "ranges": [        {          "day": "monday",          "opens": "example",          "closes": "example"        }      ]    },    "takeoverTimeoutMinutes": 1  }});
Example Response
{  "id": "string",  "name": "string",  "namespaceId": "string",  "revision": "string",  "draft": {    "instructions": "string",    "knowledge": "string",    "knowledgeSourceIds": [      "string"    ],    "endpointIds": [      "string"    ],    "integrations": [      {        "integrationId": "string",        "tools": {          "kind": "all"        },        "requireApproval": [          "string"        ]      }    ],    "mode": "live",    "model": "standard",    "reasoning": "auto",    "workingHours": {      "timeZone": "string",      "ranges": [        {          "day": "monday",          "opens": "string",          "closes": "string"        }      ]    },    "takeoverTimeoutMinutes": 1  },  "publishedVersion": -9007199254740991,  "publishedAt": "string",  "pausedAt": "string",  "creditsPausedAt": "string",  "monthlySpendCapDollars": 0,  "spend": {    "month": "string",    "spentDollars": 0,    "capReachedAt": "string"  },  "createdAt": "string",  "updatedAt": "string"}

Related documentation