Agents

Create an agent (Preview)

Preview · Available to selected organizations. Creates an agent with a draft and returns it with status 201.

POST
/v1/agents

Creates an agent with a draft and returns it with status 201. The agent answers nothing until its draft is published. A new agent starts in supervised mode, so each reply waits for a person to approve it. The namespace is set at creation and cannot change.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
name*AgentName
Match^\S[\s\S]*\S$|^\S$|^$
Length1 <= length <= 120
namespaceId?|

The namespace the agent belongs to; it cannot move later. Omit for an organization-level agent. A namespace-scoped key always creates in its own namespace.

definition?|

The first draft. Defaults to an agent with no instructions, knowledge, or endpoints, in supervised mode on the standard model at auto reasoning.

Default
{  "instructions": "",  "knowledge": "",  "knowledgeSourceIds": [],  "endpointIds": [],  "integrations": [],  "mode": "supervised",  "model": "standard",  "reasoning": "auto",  "workingHours": null,  "takeoverTimeoutMinutes": 30}

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.create({  "name": "example"});
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