Interface primitives enable agents to communicate through various channels - from chat interfaces to voice calls to custom UI components - providing flexible ways for users to interact with agent capabilities.
Overview
The Interface primitive provides the building blocks for creating rich, interactive user experiences with agents. Whether you’re building a chat application, voice assistant, embedded widget, or custom dashboard, interfaces make agent capabilities accessible through the channels your users prefer. Interfaces are essential for:- Multi-Channel Communication: Deploy agents across chat, voice, email, and more
- Custom UI Components: Build branded agent experiences
- Real-Time Interaction: Stream responses and provide instant feedback
- Rich Media: Support images, files, buttons, and interactive elements
- Accessibility: Ensure agents work across devices and abilities
- White-Label Solutions: Customize interface to match your brand
Chat Interface
Rich chat experiences with streaming, typing indicators, and media
Voice Interface
Voice-based interactions with speech-to-text and text-to-speech
Widget Embed
Embeddable components for websites and applications
Custom UI
Full control over design and user experience
How Interfaces Work
When you implement an interface:- Channel Selection: Choose communication channel (chat, voice, email, etc.)
- UI Components: Configure interactive elements and styling
- Message Handling: Process user inputs and route to agents
- Response Rendering: Display agent responses with appropriate formatting
- State Management: Maintain conversation state and context
- Event Handling: React to user actions and system events
Streaming Support: All interfaces support real-time response streaming for immediate user feedback.
Interface Types
Chat Interface
Voice Interface
Email Interface
Custom Widget
Code Examples
Basic Chat Interface
Streaming Chat Responses
Embeddable Chat Widget
Voice Interface
Email Interface
Rich Interactive Messages
Custom React Component
Multi-Channel Interface
Use Cases
1. Customer Support Chat
Build comprehensive support chat:2. Sales Assistant
Interactive sales chat:3. Voice Assistant
Phone support with voice:4. Email Automation
Automated email responses:5. In-App Assistant
Contextual help within application:6. WhatsApp Business
WhatsApp integration:Best Practices
User Experience
Provide Immediate Feedback
Provide Immediate Feedback
Handle Errors Gracefully
Handle Errors Gracefully
Support Mobile
Support Mobile
Accessibility
Accessibility
Performance
Enable Streaming
Enable Streaming
Lazy Loading
Lazy Loading
Caching
Caching
Security
Input Validation
Input Validation
Authentication
Authentication
Content Filtering
Content Filtering
Integration with Other Primitives
With Memory
Maintain conversation context:With Skills
Apply specialized skills:With Authentication
Secure interfaces:Performance Considerations
Response Times
- Text Chat: < 100ms to first token
- Voice: < 200ms to speech start
- Email: < 1s for simple responses
- Streaming: 20-50 tokens/second
Scalability
- Concurrent Users: Thousands per interface
- Message Throughput: Millions per day
- Global Distribution: CDN-cached widgets
Troubleshooting
Widget Not Loading
Widget Not Loading
Problem: Chat widget doesn’t appearSolutions:
- Check widget script is loaded
- Verify interfaceId is correct
- Check for JavaScript console errors
- Ensure no CSP blocking
- Verify domain is whitelisted
Messages Not Sending
Messages Not Sending
Problem: User messages fail to sendSolutions:
- Check network connectivity
- Verify session is active
- Check rate limits
- Review authentication
- Inspect browser console
Streaming Issues
Streaming Issues
Problem: Responses not streaming smoothlySolutions:
- Check network connection quality
- Verify streaming is enabled
- Reduce chunk size
- Check for proxy/firewall issues
- Use WebSocket instead of SSE
Related Primitives
Voice
Advanced voice capabilities
Memory
Conversation context and history
Authentication
Secure user access
Email-based interactions
Additional Resources
API Reference
Complete interface API docs
UI Components
Pre-built UI component library
Design Guide
Interface design best practices