Reference

SDK reference

Every function, type and field of @voicelayer/sdk, with its signature, typed parameters, defaults, errors and an example.

This is the reference for @voicelayer/sdk, the TypeScript package you use to define agents, serve them, test them and build channels. It lists each export with its signature, the type of every field or parameter, whether it is required, its default, the errors it throws and a small example. For a walk-through of how the pieces fit, start with the how-to pages; come here to look up a name.

The reference is generated from the package's TypeScript types and their comments each time the package changes, so it cannot drift from the code. For the REST calls (@voicelayer/api), see the API reference.

What is here

PageWhat it coversImport from
Defining an agentdefineAgent, every AgentConfig field, defineProcess, startAgents and agent.start()@voicelayer/sdk
The handler contextctx: say, ask, handoff, endCall, memory, and the errors they throw@voicelayer/sdk
ToolsdefineTool, httpTool, tool and their options@voicelayer/sdk
Modelsopenai, anthropic, google, deepgram, cartesia, elevenlabs, assemblyai and the models slots@voicelayer/sdk
Direct modeserveDirect, onMessage and the message context@voicelayer/sdk/direct
Custom channelsdefineChannel, actions, the store and serveChannel@voicelayer/sdk/channel
Hosted agentsserveRoom and the request your published endpoints receive@voicelayer/sdk
BrainsonQuery, framework adapters and brain tools@voicelayer/sdk, @voicelayer/sdk/brain
The testing kittestContext, invoke, checkAgent, runBrain, testChannel@voicelayer/sdk/testing

How to read an entry

  • Signature: the call as TypeScript prints it. A ? marks an optional parameter or field.
  • Required and Default: whether you must pass it, and what you get when you do not.
  • Nested fields appear indented under their parent with a dotted name, for example endCall.idleHangupMs.
  • Throws: the errors a call rejects with. Calls back to the platform reject with a HandlerContextError; branch on its code, never on its message.
  • Example: a small piece of code that works as written.

Next steps

On this page