Kallglot does not currently provide official SDKs. The helper functions in this guide, such as createKallglotSession(...), are placeholders for direct HTTP requests to the API.
Copy
Ask AI
const session = await createKallglotSession({ mode: 'ai_agent', source_language: 'en', target_language: 'en', ai_agent: { // Custom system prompt system_prompt: `You are a helpful customer service agent for Acme Corp.You assist customers with order inquiries, returns, and general questions.Be friendly, professional, and concise.If you cannot help with something, offer to transfer to a human agent.`, // Voice selection voice: 'alloy', // Temperature for response generation temperature: 0.7, // Knowledge base for context knowledge_base_id: 'kb_01ABC123', // Function calling tools: [ { name: 'lookup_order', description: 'Look up an order by order number or customer email', parameters: { type: 'object', properties: { order_number: { type: 'string', description: 'The order number (e.g., ORD-12345)' }, email: { type: 'string', description: 'Customer email address' } } } }, { name: 'initiate_return', description: 'Start a return process for an order', parameters: { type: 'object', properties: { order_number: { type: 'string' }, reason: { type: 'string' }, items: { type: 'array', items: { type: 'string' } } }, required: ['order_number', 'reason'] } }, { name: 'transfer_to_human', description: 'Transfer the call to a human agent', parameters: { type: 'object', properties: { reason: { type: 'string' }, department: { type: 'string', enum: ['support', 'sales', 'billing'] } } } } ] }});
You are [Role] for [Company].## Your Capabilities- [Capability 1]- [Capability 2]## Guidelines- Be [tone] and [style]- [Specific instruction]- [Boundary]## EscalationTransfer to a human agent when:- [Condition 1]- [Condition 2]
You are a customer support agent for TechGadgets, an electronics retailer.## Your Capabilities- Look up order status and tracking information- Process returns and exchanges for orders within 30 days- Answer questions about products and warranties- Help with account issues## Guidelines- Be friendly and empathetic- Keep responses concise (2-3 sentences when possible)- Always verify the customer's identity before discussing order details- Never share personal information from other customers## EscalationTransfer to a human agent when:- Customer requests to speak with a person- Issue involves a refund over $500- Customer is upset or frustrated after 2 failed resolution attempts- Technical issues you cannot resolve
AI agents can handle conversations in multiple languages:
Copy
Ask AI
const session = await createKallglotSession({ mode: 'ai_agent', source_language: 'auto', // Detect customer's language target_language: 'auto', // Respond in same language ai_agent: { system_prompt: `You are a multilingual support agent.Respond in the same language the customer uses.You are fluent in English, German, French, and Spanish.`, // Voice that works well for multiple languages voice: 'alloy', multilingual: { enabled: true, supported_languages: ['en', 'de', 'fr', 'es'], fallback_language: 'en' } }});
session.on('error', async (error) => { console.error('Agent error:', error); if (error.code === 'llm_timeout') { // LLM took too long - provide fallback response await session.speak("I'm sorry, I'm having trouble processing that. Let me transfer you to a colleague."); await transferToHuman(session.id, { reason: 'technical_issue' }); }});session.on('no_match', async (data) => { // Agent couldn't understand the customer if (data.consecutive_failures >= 3) { await session.speak("I'm having trouble understanding. Would you like to speak with a person?"); }});