API Reference
Complete reference for all types, interfaces, and exports in thepatter package.
Patter Class
Constructor
Instance Methods
| Method | Signature | Description |
|---|---|---|
agent | (opts: AgentOptions) => AgentOptions | Validates and returns an agent configuration. |
serve | (opts: ServeOptions) => Promise<void> | Starts the embedded server (local mode only). |
call | (opts: LocalCallOptions) => Promise<void> | Makes an outbound call. |
test | (agent: AgentOptions, opts?: TestOptions) => Promise<void> | Starts an interactive terminal test session (local mode only). See Test Mode. |
Static Methods
| Method | Signature | Description |
|---|---|---|
Patter.deepgram | (opts: { apiKey: string; language?: string }) => STTConfig | Creates a Deepgram STT config. |
Patter.whisper | (opts: { apiKey: string; language?: string }) => STTConfig | Creates a Whisper STT config. |
Patter.elevenlabs | (opts: { apiKey: string; voice?: string }) => TTSConfig | Creates an ElevenLabs TTS config. |
Patter.openaiTts | (opts: { apiKey: string; voice?: string }) => TTSConfig | Creates an OpenAI TTS config. |
Patter.guardrail | (opts: { name: string; blockedTerms?: string[]; check?: (text: string) => boolean; replacement?: string }) => Guardrail | Creates a guardrail config. |
Patter.tool | (opts: { name: string; description?: string; parameters?: object; handler?: Function; webhookUrl?: string }) => ToolDefinition | Creates a tool definition. Requires either handler or webhookUrl. |
Interfaces
LocalOptions
AgentOptions
ServeOptions
LocalCallOptions
ToolDefinition
Guardrail
STTConfig
TTSConfig
IncomingMessage
CallControl
onMessage handlers. Allows dynamic call management during a conversation.
CallMetrics
CostBreakdown
LatencyBreakdown
TurnMetrics
ProviderPricing
Type Aliases
Error Classes
All errors extendPatterError, which extends the native Error class.
| Class | Description |
|---|---|
PatterError | Base error class for all SDK errors. |
PatterConnectionError | WebSocket connection failures or disconnection errors. |

