Server-Side SDKs
Client-Side SDK
Atoms Multimodal SDK
A TypeScript/JavaScript SDK for real-time voice and text communication with AI agents using WebRTC technology. Built on Atoms’ proprietary real-time communication infrastructure for robust, low-latency audio streaming and real-time data exchange.Web Integration: Voice and Text Chat
The Atoms Multimodal SDK enables you to integrate both voice and text-based AI agent interactions directly into your web applications. Whether you need voice calls or text chat, this single SDK handles both modes seamlessly.Important Security Note: Your client code should call your server endpoint
which internally calls
conversation/chat
or conversation/webcall
to get
the access token and other details for the session. The endpoints require
using your Atoms API Key, which is the reason why you need to call the
endpoint from your server instead of client to protect the key from exposing.
You simply pass the agentId
to these endpoints, and they handle all the
setup internally. The access token and connection details obtained will be
used in your frontend client code to start the session.Token Flow Diagram
Installation
Quick Start - Voice Mode
Quick Start - Text Mode
Key Features
Voice Mode (webcall)
- Real-time voice communication with AI agents
- Low-latency audio streaming using WebRTC
- Automatic audio processing (echo cancellation, noise suppression)
- Device selection for microphone and speakers
- Raw audio access for advanced processing
- Voice activity detection for agent talking states
Text Mode (chat)
- Real-time text messaging with AI agents
- Instant responses through WebSocket data channels
- No audio permissions required
- Lightweight and fast for text-only interactions
Common Features
- Event-driven architecture for real-time updates
- Automatic session management and cleanup
- Error handling with detailed error events
- Permission management for microphone access
- Cross-browser compatibility
Configuration Options
StartSessionConfig Interface
Event System
The SDK emits various events for real-time updates:Session Events
session_started
- Session successfully initiatedsession_ended
- Session terminatederror
- Error occurred during session
Permission Events (Voice Mode)
microphone_permission_granted
- Microphone access grantedmicrophone_permission_error
- Permission issuesmicrophone_access_failed
- Access failed during session start
Agent Events
agent_connected
- AI agent joined the sessionagent_start_talking
- Agent began speaking (voice mode)agent_stop_talking
- Agent stopped speaking (voice mode)
Communication Events
transcript
- Text message from agent (both modes)
API Methods
Core Methods
startSession(config)
- Initialize communication sessionstopSession()
- End session and cleanup resourcesstartAudioPlayback()
- Enable audio (required after user interaction)
Voice Mode Methods
mute()
- Mute microphoneunmute()
- Unmute microphonecheckMicrophonePermissions()
- Check mic permissions
Text Mode Methods
sendTextMessage(message)
- Send text to agent
Properties
isConnected
- Connection statuscurrentMode
- Current session moderoomName
- Session room nameisAgentTalking
- Agent speaking status (voice mode)
Example: Complete Implementation
Getting Your Access Token
To use the SDK, you’ll need to call our backend API from your server to get the access token and connection details. Your backend should:- Have an existing agent created using the Atoms API
- Call
POST atoms-api.smallest.ai/api/v1/conversation/chat
orPOST atoms-api.smallest.ai/api/v1/conversation/webcall
with theagentId
- Return the token, host, and other session details to your frontend
- Your frontend uses these details in the
startSession()
call
Learn More
For complete documentation, advanced examples, and troubleshooting:- NPM Package - Install and view package details
- GitHub Repository - Full source code, examples, and documentation