Flutter
For real-time voice on iOS and Android, the Flutter SDK (sarvamconv_ai_sdk) wraps the WebSocket interface in SamvaadAgent, with DefaultAudioInterface for microphone capture and playback.
Install
Add the SDK to pubspec.yaml:
iOS. Add microphone permission to ios/Runner/Info.plist:
Android. Add permissions to android/app/src/main/AndroidManifest.xml:
Start a voice session
DefaultAudioInterface captures the microphone and plays agent audio (16-bit PCM mono at 8 kHz, 16 kHz, or 48 kHz). start() fetches a signed WebSocket URL and begins streaming.
InteractionConfig
Callbacks
Pass any of these to SamvaadAgent to react to what happens during the call:
DefaultAudioInterface
To bring your own I/O, implement AudioInterface:
Session methods
Call await agent.stop() in dispose() so the WebSocket and audio interface are cleaned up. Reconnection is not supported: each WebSocket URL is single-use. If the connection drops, call stop() and create a new SamvaadAgent.
Stop the agent when the app goes to the background:
Troubleshooting
Microphone permission denied. Request the microphone before starting:
No audio output. Check device volume, that DefaultAudioInterface is initialized, and that sampleRate matches the session config.
Connection timeout. Check connectivity, API key, orgId / workspaceId / appId, and that the agent has a committed version.
Never embed your API key in the app binary. Omit apiKey, set baseUrl to a backend you control, and pass your app auth in headers: