SDKClient

Agents

SDK reference for agents — Create and manage agent chat sessions, and list the agents in a deployment.

Create and manage agent chat sessions, and list the agents in a deployment.

createSession

Create a platform agent chat session

POST

Usage:

const result = await swirls.client.agents.createSession({
  agentName: '...',
  projectId: '...',
})

Input:

ParameterTypeRequiredDescription
agentNamestringYes
projectIdstringYes
titlestring | nullNo
metadataobjectNo

Output:

FieldTypeDescription
sessionIdstring

listSessions

List agent chat sessions for a project

GET

Usage:

const result = await swirls.client.agents.listSessions({
  projectId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
agentNamestringNo
limitnumberNo

Output:

FieldTypeDescription
sessionsobject[]

getSession

Load an agent chat session by id

GET

Usage:

const result = await swirls.client.agents.getSession({
  sessionId: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes

sendSessionMessage

Send a user message to an existing agent session and start a turn

POST

Usage:

const result = await swirls.client.agents.sendSessionMessage({
  sessionId: '...',
  message: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes
messagestringYes

Output:

FieldTypeDescription
runIdstring

mintActorSessionGrant

Mint a short-lived WebSocket grant for an agent session turn

POST

Usage:

const result = await swirls.client.agents.mintActorSessionGrant({
  sessionId: '...',
  runId: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes
runIdstringYes

Output:

FieldTypeDescription
actor"directory" | "project" | "session" | "execution"
grantstring
websocketUrlstring
expiresAtstring
appIdstring
projectIdstring
sessionIdstring
threadIdstring
runIdstring
executionIdstring

deleteSession

Delete an agent chat session by id

POST

Usage:

const result = await swirls.client.agents.deleteSession({
  sessionId: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes

Output:

FieldTypeDescription
deletedboolean

createWebSession

Create a web chat session (channel-keyed: bindingName is the channel name)

POST

Usage:

const result = await swirls.client.agents.createWebSession({
  projectId: '...',
  bindingName: '...',
  agentName: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
bindingNamestringYes
agentNamestringYes
titlestring | nullNo

Output:

FieldTypeDescription
sessionIdstring

createAgentChatSession

Create an in-app agent chat session (binding stored as agentName)

POST

Usage:

const result = await swirls.client.agents.createAgentChatSession({
  projectId: '...',
  agentName: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
agentNamestringYes
titlestring | nullNo

Output:

FieldTypeDescription
sessionIdstring

listWebSessions

List web channel chat sessions for the current user (bindingName is the channel name)

GET

Usage:

const result = await swirls.client.agents.listWebSessions({
  projectId: '...',
  bindingName: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
bindingNamestringYes
limitnumberNo

Output:

FieldTypeDescription
sessionsobject[]

listAgentChatSessions

List in-app agent chat sessions for the current user (binding stored as agentName)

GET

Usage:

const result = await swirls.client.agents.listAgentChatSessions({
  projectId: '...',
  agentName: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
agentNamestringYes
limitnumberNo

Output:

FieldTypeDescription
sessionsobject[]

getWebChatMessages

Load persisted web chat UI messages from execution event replay

GET

Usage:

const result = await swirls.client.agents.getWebChatMessages({
  sessionId: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes

Output:

FieldTypeDescription
messagesobject[]

getSessionContextStatus

Context utilization for an agent session: budget used, tokens by segment, the last compaction, and whether the next turn would compact

GET

Usage:

const result = await swirls.client.agents.getSessionContextStatus({
  sessionId: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes

Output:

FieldTypeDescription
sessionIdstring
tokensEstimatenumber
budgetobject
usedFractionnumber
remainingTokensnumber
shouldCompactboolean
pruningAppliedboolean
segmentsobject
messageCountnumber
compactedboolean
anchorobject
lastCompactionobject | null
cacheHitRatenumber | null

compactSessionContext

Compact an agent session now, optionally steering the summary with a focus instruction

POST

Usage:

const result = await swirls.client.agents.compactSessionContext({
  sessionId: '...',
})

Input:

ParameterTypeRequiredDescription
sessionIdstringYes
focusstringNo

listAgents

List agents in the active deployment for a project

GET

Usage:

const result = await swirls.client.agents.listAgents({
  projectId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes

Output:

FieldTypeDescription
agentsobject[]

getAgentWalletStatus

Per-agent tool wallet status for the current cadence window

GET

Usage:

const result = await swirls.client.agents.getAgentWalletStatus({
  projectId: '...',
  agentName: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
agentNamestringYes

Output:

FieldTypeDescription
configuredboolean
walletobject | null
windowKeystring | null
budgetCentsnumber | null
spentCentsnumber | null
reservedCentsnumber | null
remainingCentsnumber | null

getWorkspaceDisk

Resolve the platform-managed dedicated Archil workspace disk for a deployed agent

GET

Usage:

const result = await swirls.client.agents.getWorkspaceDisk({
  projectId: '...',
  deploymentId: '...',
  agentId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
deploymentIdstringYes
agentIdstringYes

Output:

FieldTypeDescription
agentIdstring
agentNamestring
mountPathstring
externalDiskIdstring

listWorkspaceDirectory

List files and directories on an agent workspace disk

GET

Usage:

const result = await swirls.client.agents.listWorkspaceDirectory({
  projectId: '...',
  deploymentId: '...',
  agentId: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
deploymentIdstringYes
agentIdstringYes
pathstringNo

Output:

FieldTypeDescription
pathstring
entriesobject[]

readWorkspaceFile

Read a single file from an agent workspace disk (size-capped)

GET

Usage:

const result = await swirls.client.agents.readWorkspaceFile({
  projectId: '...',
  deploymentId: '...',
  agentId: '...',
  path: '...',
})

Input:

ParameterTypeRequiredDescription
projectIdstringYes
deploymentIdstringYes
agentIdstringYes
pathstringYes

Output:

FieldTypeDescription
pathstring
sizenumber
contentstring
truncatedboolean

On this page