This README provides a comprehensive guide to building and integrating a custom AI Voice Agent using the MirrorFly AI-RAG platform.
Build and integrate fully customizable AI voice agents for the web using the MirrorFly AI-RAG dashboard and SDK. This solution supports real-time audio streaming, external knowledge base training (RAG), and a no-code workflow builder.
The implementation is divided into two primary phases:
-
Agent Creation: Configuring the agent's personality, training it with datasets, and designing conversational flows in the MirrorFly dashboard.
-
Agent Integration: Embedding the agent into your web application using the MirrorFly AI SDK.
-
Access: Obtain developer credentials from the MirrorFly team and log into the MirrorFly AI Dashboard.

-
Create Agent: Click 'Create Agents' and select 'Voice Agent'.
- Configuration: Provide an agent name, description, and define the initial System Prompt to set core behavior.
-
Personality: Set the welcome message, fallback responses, and adjust the formality and tone.
-
Model Selection: Choose from multiple available AI models to power your agent.
-
Datasets: Upload knowledge bases in PDF or CSV format (Max 5MB/10 files) to provide the agent with specific domain knowledge.
-
Website Sync: Alternatively, sync information directly from a URL to keep the agent updated with your website content.
Use the visual drag-and-drop canvas to define:
-
Conversational paths and decision logic.
-
API calls and form collection.
-
Email triggers and message nodes.
-
STT/TTS: Configure Speech-to-Text and Text-to-Speech providers (e.g., Deepgram, ElevenLabs) with your API keys.
-
Call Handling: Enable functions like Interruption Sensitivity, End Call, or Transfer to Human Agent (via SIP or Conference).
-
Valid Agent ID from the dashboard.
-
Website must run on HTTPS for microphone access.
-
Supported Browsers: Latest versions of Chrome, Edge, and Safari.
Add the SDK to your HTML file using a single script tag:
<script src="https://d1nzh49hhug3.cloudfront.net/aiVoiceScript/uat/mirrofly/mirror-fly-ai.v1.1.1.js"></script>Define a container element and initialize the SDK:
// HTML Container
<div id="widget"></div>
// Initialization
MirrorFlyAi.init({
container: "#widget",
agentId: "<YOUR_AGENT_ID>",
title: "Voice Assistant",
theme: "dark",
triggerStartCall: true,
transcriptionEnable: true,
transcriptionInUi: true,
chatEnable: true,
agentConnectionTimeout: 500
});Monitor the agent's status and capture transcriptions:
const callbacks = {
onTranscription: (data) => console.log("Transcription:", data),
onAgentConnectionState: (state) => console.log("Connection:", state),
onError: (error) => console.error("SDK Error:", error)
};If your platform uses multiple agents (e.g., Sales vs. Support), use the following to switch contexts:
function switchAgent(newAgentId) {
MirrorFlyAi.destroy();
document.querySelector("#widget").innerHTML = "";
MirrorFlyAi.init({
container: "#widget",
agentId: newAgentId,
triggerStartCall: true
});
}The browser will prompt the user for microphone permission upon initialization. Ensure you handle potential errors via the onError callback, such as permission denials or network issues.
- Conversational AI Agents
- White-label AI Voice agents
- Custom Chatbots
- 500+ AI Features
- Real-time Chat
- HD Video Call
- HQ Voice Call
MirrorFly offers full freedom with the hosting options:
Self-hosted: Deploy your client on your own data centers, private cloud or third-party servers.
Check out our multi-tenant cloud hosting
Cloud: Host your client on MirrorFly’s multi-tenant cloud servers.
Check out our multi-tenant cloud hosting
- MirrorFly AI Voice Agents
- MirrorFly AI Chatbots
- MirrorFly SDKs
- MirrorFly API Documentation
- Product Tutorials
- See who's using MirrorFly
Need a tech team to build your AI voice agents and chatbots? Hire a full team of experts. Let our team handle every step of the development process. Get a high-quality, fully-built Ai agents ready to launch, carefully built by industry experts
If you’d like to take help when working with our solution, feel free to contact our experts who will be available to help you anytime of the day or night.
We're always on the lookout for talented developers, support specialists, and product managers. Visit our careers page to explore current opportunities.



