SWIRLS_
ReferenceSDKClient

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

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 channel chat session for an agent

POST

Usage:

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

Input:

ParameterTypeRequiredDescription
projectIdstringYes
bindingNamestringYes
agentNamestringYes
titlestring | nullNo

Output:

FieldTypeDescription
sessionIdstring

listWebSessions

List web channel chat sessions for the current user

GET

Usage:

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

Input:

ParameterTypeRequiredDescription
projectIdstringYes
bindingNamestringYes
limitnumberNo

Output:

FieldTypeDescription
sessionsobject[]

getWebChatMessages

Load persisted chat-sdk message history for a web session (text-oriented v1)

GET

Usage:

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

Input:

ParameterTypeRequiredDescription
sessionIdstringYes

Output:

FieldTypeDescription
messagesobject[]

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[]

On this page