Agents
Replace an agent draft (Preview)
Preview · Available to selected organizations. Replaces the whole draft and returns the agent with a new revision.
PUT
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.
apiKeyheader
x-api-key<token>id*stringMatch
^agt_[0-9a-hjkmnp-tv-z]{16,24}$application/json- body
revision*stringLength
1 <= lengthdefinition*Agent
application/json- response
id*AgentIdMatch
^agt_[0-9a-hjkmnp-tv-z]{16,24}$name*stringnamespaceId*|nullrevision*stringdraft*publishedVersion*|nullpublishedAt*string|nullpausedAt*string|nullcreditsPausedAt?string|null|nullmonthlySpendCapDollars*number|nullspend*createdAt*stringupdatedAt*stringimport { 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"}