Skip to main content
This guide walks you through building your first voice agent in under 10 minutes. You will create a web page with a single button that starts a conversation, shows the agent’s status, and displays the transcript in real time.

What you will build

A web page with:
  • A Start button that requests microphone permission and connects to Lokutor
  • A status indicator that shows whether the agent is listening, thinking, or speaking
  • A transcript panel that displays what the user said and what the agent replied

Prerequisites

  • An API key from app.lokutor.com
  • A modern browser with microphone support (Chrome, Firefox, Edge, Safari)
  • Node.js 22 or later

Step 1: Create the project

The API key never goes into the page. A small backend exchanges it for a short-lived ticket, and the page asks the backend for one each time it connects (Secure browser setup). Create server.mjs next to package.json:
Create vite.config.ts so the page can reach it during development:

Step 2: Write the HTML

Replace index.html with:

Step 3: Write the agent logic

Replace src/main.ts with:

Step 4: Run it

In one terminal:
In another:
Open http://localhost:5173 in your browser, click Start Conversation, and speak into your microphone.

How it works

  1. startManaged() requests microphone permission, calls getTicket(), and opens a WebSocket to Lokutor with the ticket
  2. The SDK sends your configuration (prompt, voice, language) to the server
  3. When you speak, the SDK streams microphone audio to the server
  4. The server cleans the audio, detects the end of your turn, transcribes it, asks the language model, and streams the spoken reply back
  5. The SDK plays the audio and emits events for transcription, response, and status

Next steps

  • Run an agent you built in the dashboard instead: replace prompt, voice and language with agentId: 'your-agent-id'. See Voice Agent.
  • Give your agent tools so it can fetch data from your systems. See Tool Calling.
  • Handle interruptions. See Handling Interruptions.
  • Put the agent on a phone number. See Phone agent quickstart.
  • Understand where the latency goes. See Latency.
More examples are in the SDK repository: github.com/lokutor-ai/lokutor-sdk (js/examples).