TypeScript
Installation
npm install @voker/vokerpnpm add @voker/vokerbun add @voker/vokeryarn add @voker/vokerMake sure to set the environment variable VOKER_API_KEY.
Quick Start
If you're using one of our supported SDKs, you can simply swap out the class you instantiate:
import { OpenAI } from 'openai';
import { OpenAI } from '@voker/voker/ai/provider-openai'
const client = new OpenAI();
await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{
role: 'user',
content: 'Hello, word!'
}
],
});TypeScript SDK Reference
Voker Client
The Voker Client provides a way to create an update Agents, Agent Versions, People and Events programmatically.
Requests are made in the background as to not add latency to your application. This is used by the SDKs but can also be used directly if you want more control over when requests are sent.
Class VokerClient
Client for interacting with the Voker API.
Fields
events: VokerClient_Events
Access events related endpoints.
people: VokerClient_People
Access people related endpoints.
agents: VokerClient_Agents
Access agents related endpoints.
agentVersions: VokerClient_AgentVersions
Access agent versions related endpoints.
Class VokerClient_Agents
Access agents related endpoints.
Methods
Method create
Create an agent.
See Creating an Agent for more information.
Parameters
payload: CreateAgentPayload
Class VokerClient_AgentVersions
Access agent versions related endpoints.
Methods
Method create
Create an agent version.
See Creating an Agent Version for more information.
Parameters
agentName: string
payload: CreateAgentVersionPayload
Class VokerClient_Events
Access events related endpoints.
Methods
Method create
Create a new event.
Parameters
payload: ClientCreateEventPayload
Class VokerClient_People
Access people related endpoints.
Methods
Method create
Create a person.
See Creating a Person for more information.
Parameters
payload: CreatePersonPayload
Method update
Update a person.
Parameters
personId: string
payload: UpdatePersonPayload
API Client
The API Client provides a way to make requests to the Voker API directly. This is used under the hood by the Voker Client, but can also be used directly if you want more control over how requests are made.
Fetching Agents, Agent Versions, and People is a common use cases for using the API Client directly.
Class ApiClient
Client for interacting with the API.
Fields
events: ApiClient_Events
Access events related endpoints.
people: ApiClient_People
Access people related endpoints.
fingerprints: ApiClient_Fingerprints
Access fingerprints related endpoints.
agents: ApiClient_Agents
Access agents related endpoints.
agentVersions: ApiClient_AgentVersions
Access agent versions related endpoints.
Class ApiClient_Agents
Access agents related endpoints.
Methods
Method create
Create an agent.
See Creating an Agent for more information.
Parameters
payload: CreateAgentPayload
Returns: AgentMethod get
Get an agent.
Parameters
agentName: string
Returns: Agent
Class ApiClient_AgentVersions
Access agent versions related endpoints.
Methods
Method create
Create an agent version.
See Creating an Agent Version for more information.
Parameters
agentName: string
payload: CreateAgentVersionPayload
Returns: AgentVersionMethod get
Get an agent version.
Parameters
agentName: string
agentVersionName: string
Returns: AgentVersion
Class ApiClient_Events
Access events related endpoints.
Methods
Method create
Create a new event.
Parameters
payload: CreateEventPayload
Class ApiClient_Fingerprints
Access fingerprints related endpoints.
Methods
Method create
Create a fingerprint.
See Creating a Fingerprint for more information.
Returns: Fingerprint
Class ApiClient_People
Access people related endpoints.
Methods
Method get
Get a person.
Parameters
personId: string
Returns: PersonMethod create
Create a person.
See Creating a Person for more information.
Parameters
payload: CreatePersonPayload
Returns: PersonMethod update
Update a person.
Parameters
personId: string
payload: UpdatePersonPayload
Returns: Person
Types
Type CreateAgentVersionPayload
Create an agent version.
See Creating an Agent Version for more information.
Fields
agentVersionName: string
Unique identifier for the agent version within its agent.
description: string | null | undefined
Type CreateAgentPayload
Create an agent.
See Creating an Agent for more information.
Fields
agentName: string
Unique identifier for the agent.
description: string | null | undefined
-
Create an event.
See Creating an Event for more information.
Fields
vokerAgent: string | undefined
The name of the agent associated with the event.
If this agent does not exist, it will be created. If an agent is not supplied, a default agent will be used.
vokerAgentVersion: string | undefined
The name of the agent version associated with the event.
If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.
vokerPerson: string | undefined
The unique identifier of the person associated with the event.
If the person does not exist, it will be created.
vokerSession: string | undefined
The unique identifier of the session associated with the event.
If the session does not exist, it will be created.
eventName: string
properties: Record<string, any>
Type CreateEventPayload
Fields
vokerAgent: string | undefined
The name of the agent associated with the event.
If this agent does not exist, it will be created. If an agent is not supplied, a default agent will be used.
vokerAgentVersion: string | undefined
The name of the agent version associated with the event.
If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.
vokerPerson: string | undefined
The unique identifier of the person associated with the event.
If the person does not exist, it will be created.
vokerSession: string | undefined
The unique identifier of the session associated with the event.
If the session does not exist, it will be created.
eventName: string
properties: Record<string, any>
fingerprintId: string
The fingerprint of the client that generated the event.
-
Fields
vokerAgent: string | undefined
The name of the agent associated with the event.
If this agent does not exist, it will be created. If an agent is not supplied, a default agent will be used.
vokerAgentVersion: string | undefined
The name of the agent version associated with the event.
If this agent version does not exist, it will be created. If an agent version is not supplied, a default version will be used.
vokerPerson: string | undefined
The unique identifier of the person associated with the event.
If the person does not exist, it will be created.
vokerSession: string | undefined
The unique identifier of the session associated with the event.
If the session does not exist, it will be created.
-
Create a fingerprint.
See Creating a Fingerprint for more information.
Fields
language: string
languageVersion: string
system: string
openaiSdkVersion: string | undefined
anthropicSdkVersion: string | undefined
geminiSdkVersion: string | undefined
vokerSdkVersion: string | undefined
allPackages: Record<string, string> | undefined
gitRepositoryUrl: string | undefined
gitBranch: string | undefined
gitCommitHash: string | undefined
gitCommitDate: string | undefined
Type CreatePersonPayload
Create a person.
See Creating a Person for more information.
Fields
personId: string
properties: Record<string, any> | undefined
Type UpdatePersonPayload
Update a person.
Fields
properties: Record<string, any>
Type AgentVersion
Represents an agent version.
See Agent Versions for more information.
Fields
agentVersionName: string
Unique identifier for the agent version within its agent.
description: string | null
agentVersionNumber: number
Unique number assigned to the agent version within its agent.
createdAt: Date
deprecatedAt: Date | null
Type Agent
Represents an agent.
See Agents for more information.
Fields
agentName: string
Unique identifier for the agent.
description: string | null
agentNumber: number
Unique number assigned to the agent.
createdAt: Date
deprecatedAt: Date | null
Type Fingerprint
Represents a fingerprint.
See Fingerprints for more information.
Fields
fingerprintId: string
Type Person
Represents a person.
See People for more information.
Fields
personId: string
properties: Record<string, any> | null
createdAt: Date