Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.synthraai.dev/llms.txt

Use this file to discover all available pages before exploring further.

Synthra provides isolated conversation contexts called sessions. Each session maintains its own message history, context window, and token usage tracking.

Quick Start

const agent = new SynthraAgent({
  apiKey: process.env.SYNTHRA_API_KEY
});

// Create session
const session = agent.createSession('user_abc123def456');

// Send message
const response = await agent.sendMessage(
  session.id,
  'Hello, Synthra!'
);

// Delete session
await agent.deleteSession(session.id);

Session Limits

TierMax SessionsMax MessagesContext Window
Free101004,096 tokens
Pro1001,0008,192 tokens
EnterpriseUnlimitedUnlimited32,768 tokens

Lifecycle

Sessions automatically expire after 24 hours of inactivity. States: Created → Active → Idle → Expired

Configuration

const session = agent.createSession('user_abc123def456', {
  metadata: {
    source: 'web',
    language: 'en'
  },
  contextConfig: {
    maxTokens: 8192,
    compressionEnabled: true,
    retentionPolicy: 'semantic'
  }
});

Error Handling

try {
  const response = await agent.sendMessage(session.id, 'Hello!');
} catch (error) {
  if (error.code === 'session_not_found') {
    console.log('Session expired or deleted');
  }
}
Sessions are automatically compressed when approaching token limits.
Deleted sessions cannot be recovered. Use clearSession() to reset history while preserving the session.