Skip to main content

Configuration

Complete reference for the EstuaryConfig interface, which controls all client behavior.

EstuaryConfig

import type { EstuaryConfig } from '@estuary-ai/sdk';

Required Fields

FieldTypeDescription
serverUrlstringBase URL of the Estuary server (e.g., "https://api.estuary-ai.com")
apiKeystringYour API key (starts with est_)
characterIdstringUUID of the AI character to connect to
playerIdstringUnique identifier for the end user

Optional Fields

FieldTypeDefaultDescription
voiceTransport'websocket' | 'livekit' | 'auto''auto'Voice transport to use. 'auto' prefers LiveKit if livekit-client is installed.
audioSampleRatenumber16000Audio sample rate in Hz for microphone capture
autoReconnectbooleantrueAutomatically reconnect on disconnect
maxReconnectAttemptsnumber5Maximum number of reconnection attempts before giving up
reconnectDelayMsnumber2000Base delay in milliseconds between reconnect attempts. Actual delay increases with each attempt (delay * attemptNumber).
debugbooleanfalseEnable debug logging to the console
realtimeMemorybooleanfalseEnable memoryUpdated events after each response for live memory extraction notifications
suppressMicDuringPlaybackbooleanfalseMute microphone during TTS playback (software AEC fallback). Disables barge-in.
autoInterruptOnSpeechbooleantrueAutomatically interrupt bot audio when user starts speaking

Example Configurations

Minimal

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
});

Text-Only (No Voice)

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
});

// Use sendText with textOnly=true to suppress voice responses
await client.connect();
client.sendText('Hello!', true);

WebSocket Voice

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
voiceTransport: 'websocket',
audioSampleRate: 16000,
});

LiveKit Voice

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
voiceTransport: 'livekit',
});

Aggressive Reconnection

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
autoReconnect: true,
maxReconnectAttempts: 10,
reconnectDelayMs: 1000,
});

No Reconnection

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
autoReconnect: false,
});

Debug Mode

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
debug: true,
});

When debug is true, the SDK logs detailed information to the console including connection state changes, events sent and received, and internal operations.

Real-Time Memory Events

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
realtimeMemory: true,
});

client.on('memoryUpdated', (event) => {
console.log(`Extracted ${event.memoriesExtracted} memories`);
});

Suppress Mic During Playback

const client = new EstuaryClient({
serverUrl: 'https://api.estuary-ai.com',
apiKey: 'est_your_api_key',
characterId: 'your-character-uuid',
playerId: 'user-123',
suppressMicDuringPlayback: true, // Mute mic while bot speaks
autoInterruptOnSpeech: false, // Disable auto-interrupt
});

Use suppressMicDuringPlayback as a software echo cancellation fallback on devices without hardware AEC. Note that this disables barge-in (the user cannot interrupt the bot by speaking).

Environment Tips

Browser

In browser environments, the SDK works out of the box. The AudioPlayer uses the Web Audio API (AudioContext) for playback, and getUserMedia for microphone access.

// Browser: just construct and connect
const client = new EstuaryClient({ /* ... */ });
await client.connect();
await client.startVoice(); // Prompts for microphone permission

Node.js

In Node.js, WebSocket and REST features (text chat, memory API) work. Voice features require a browser environment with getUserMedia and AudioContext support.

// Node.js: text chat and memory work
const client = new EstuaryClient({ /* ... */ });
await client.connect();
client.sendText('Hello!', true);

const facts = await client.memory.getCoreFacts();