Zelto
Agent Chat SDK

Configuration

Configure the Agent Chat SDK with init options and context.

Init options

Pass configuration to init() when initializing the SDK:

import { init } from '@zelto/agent-chat-sdk';

init({
  apiKey: 'your-api-key',
  userId: 'user-123',
  baseUrl: 'https://api.zelto.ai',
  agentId: 'agent-456',
  articlesUrl: 'https://help.example.com',
  theme: {
    primaryColor: '#7c3aed',
    borderRadius: 'rounded',
  },
  personalization: {
    language: 'en',
    greeting: 'Hi there! How can I help?',
    title: 'Support',
    companyName: 'Acme Inc',
    logoUrl: 'https://example.com/logo.png',
    agentAvatarUrl: 'https://example.com/avatar.png',
  },
});

AgentChatInitOptions

interface AgentChatInitOptions {
  apiKey: string;
  userId: string;
  baseUrl?: string;
  agentId?: string;
  articlesUrl?: string;
  theme?: AgentChatThemeOptions;
  personalization?: AgentChatPersonalizationOptions;
}

Setting context

Use setContext() to pass contextual information to the agent. This data is sent along with messages so the agent can tailor its responses.

import { setContext } from '@zelto/agent-chat-sdk';

setContext({
  page: '/pricing',
  plan: 'pro',
  custom: {
    trialDaysLeft: 5,
  },
});

AgentChatContext

The context object can include any key-value pairs relevant to your application. Common fields:

FieldTypeDescription
pagestringThe current page or route.
planstringThe user's subscription plan.
customobjectAny additional data for the agent.

Context can be updated at any time — for example, when the user navigates to a different page.

On this page