TypeScript SDK: Agents

⚠️
Preview — this feature is being built; the design below is the spec.

Agent definitions and their versions.

import Syntic from '@syntic/sdk'
 
const client = new Syntic() // reads SYNTIC_API_KEY
MethodEndpointReturns
agents.createPOST /v1/agentsAgent
agents.listGET /v1/agentsSyncPage[Agent]
agents.retrieveGET /v1/agents/{agent_id}Agent
agents.updatePATCH /v1/agents/{agent_id}Agent
agents.versions.listGET /v1/agents/{agent_id}/versionsSyncPage[AgentVersion]
agents.archivePOST /v1/agents/{agent_id}/archiveAgent

Methods

agents.create

Create a versioned agent definition. Maps to POST /v1/agents.

const result = await client.agents.create({
  name: "refund-helper",
  model: "Amara S1.2",
  instructions: "You help customers with refunds."
})

agents.list

List agents. Maps to GET /v1/agents.

for await (const item of client.agents.list({
  limit: 50
})) {
  console.log(item)
}

agents.retrieve

One agent at its latest or a given version. Maps to GET /v1/agents/{agent_id}.

const result = await client.agents.retrieve("agt_01JC4R8W6Q2N9X3T5V7Y")

agents.update

Change the definition; creates a new version. Maps to PATCH /v1/agents/{agent_id}.

const result = await client.agents.update("agt_01JC4R8W6Q2N9X3T5V7Y", {
  instructions: "…"
})

agents.versions.list

All versions. Maps to GET /v1/agents/{agent_id}/versions.

for await (const item of client.agents.versions.list("agt_01JC4R8W6Q2N9X3T5V7Y")) {
  console.log(item)
}

agents.archive

Stop new sessions from using it. Maps to POST /v1/agents/{agent_id}/archive.

const result = await client.agents.archive("agt_01JC4R8W6Q2N9X3T5V7Y")

Conventions

Every method accepts a final options object with headers, query, timeout, maxRetries and signal (an AbortSignal). List methods return pages that work with for await across all pages.

See the TypeScript SDK overview for installation, errors and retries.

Was this page helpful?