Skip to Content

Update an agent

Renames an agent or sets its monthly spend cap. Both take effect at once, without publishing.

PATCH
/v1/agents/{id}

Renames an agent or sets its monthly spend cap. Both take effect at once, without publishing. At the cap the agent pauses and its conversations wait for your team until the month turns (UTC) or the cap is raised or removed.

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
name?|null
monthlySpendCapDollars?||

The most the agent may spend in a calendar month (UTC), in dollars and whole cents. Null removes the cap. Takes effect at once, without publishing.

Response Body

Agent

application/json
  1. response
id*AgentId
Match^agt_[0-9a-hjkmnp-tv-z]{16,24}$
name*string
setupJob*|null
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.update({
  "id": "example"
});
Example Response
{
  "id": "string",
  "name": "string",
  "setupJob": "support",
  "namespaceId": "string",
  "revision": "string",
  "draft": {
    "instructions": "string",
    "knowledge": "string",
    "knowledgeSourceIds": [
      "string"
    ],
    "endpointIds": [
      "string"
    ],
    "integrations": [
      {
        "integrationId": "string",
        "tools": {
          "kind": "all"
        }
      }
    ],
    "policy": {
      "presets": [
        "string"
      ],
      "rules": [
        {
          "match": {
            "kind": "send",
            "effect": "read",
            "channel": "sms",
            "integration": "string",
            "tool": "string",
            "subject": "agent"
          },
          "note": "string",
          "decide": "run",
          "atLeast": null
        }
      ],
      "instructions": "string"
    },
    "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