mirror of
https://github.com/Bijit-Mondal/VoiceAgent.git
synced 2026-03-02 10:36:37 +00:00
c1cd705d490b03aa0b88c20da3b2c4037d471270
voice-agent-ai-sdk
Minimal voice/text agent SDK built on AI SDK with optional WebSocket transport.
Current status
- Text flow works via
sendText()(no WebSocket required). - WebSocket flow works when
connect()is used with a running WS endpoint. - Voice streaming is not implemented yet.
Prerequisites
- Node.js 20+
- pnpm
- OpenAI API key
Setup
-
Install dependencies:
pnpm install
-
Configure environment variables in
.env:OPENAI_API_KEY=your_openai_api_key VOICE_WS_ENDPOINT=ws://localhost:8080
Run (text-only check)
This validates model + tool calls without requiring WebSocket:
pnpm demo
Expected logs include text events and optional tool_start.
Run (WebSocket check)
-
Start local WS server:
pnpm ws:server
-
In another terminal, run demo:
pnpm demo
The demo will:
- run
sendText()first (text-only sanity check), then - connect to
VOICE_WS_ENDPOINTif provided.
Scripts
pnpm build– build TypeScriptpnpm dev– watch TypeScriptpnpm demo– run demo clientpnpm ws:server– run local test WebSocket server
Notes
- If
VOICE_WS_ENDPOINTis empty, WebSocket connect is skipped. - The sample WS server sends a mock
transcriptmessage for end-to-end testing.
Languages
TypeScript
69.5%
HTML
30%
JavaScript
0.3%
Shell
0.2%