react-ai-voice-agent-sdk
v1.0.0
Published
Site-agnostic AI voice agent for React apps
Readme
react-ai-voice-agent-sdk
Site-agnostic AI voice agent SDK for React apps (client-side).
This SDK scans actionable DOM elements, listens to voice (Web Speech API), sends transcript + DOM snapshot to your backend /intent endpoint, and executes the returned action safely.
Install
npm i react-ai-voice-agent-sdkUsage (React)
import React from "react";
import { useVoiceAgent, VoiceAgentOverlay } from "react-ai-voice-agent-sdk";
export default function App() {
const { agent, state } = useVoiceAgent({
intentEndpoint: "http://localhost:4000/intent",
wakeWord: "hey assistant",
permissions: {
allowNavigation: false,
requireConfirmFor: ["delete", "logout", "pay", "checkout"]
}
});
return (
<>
<YourApp />
<VoiceAgentOverlay agent={agent} state={state} />
</>
);
}Backend contract
POST /intent
{
"text": "hey assistant click login",
"domSnapshot": [{ "id":"el-1", "role":"button", "label":"Login", "selector":"#login" }]
}Returns:
{
"action": "click",
"targetId": "el-1",
"value": null,
"confidence": 0.72
}