Hecttor logo
Hecttor SDK Docs
IntegrationsLiveKit

LiveKit Integration — Examples

Voice agent with enhanced input

A complete LiveKit Agents worker that enhances the participant's audio before it reaches STT.

from livekit.agents import Agent, AgentSession, JobContext, WorkerOptions, cli, room_io
from livekit.plugins import hecttor, openai, silero


async def entrypoint(ctx: JobContext) -> None:
    await ctx.connect()

    session = AgentSession(
        stt=openai.STT(),
        llm=openai.LLM(),
        tts=openai.TTS(),
        vad=silero.VAD.load(),
    )

    await session.start(
        agent=Agent(instructions="You are a helpful voice assistant."),
        room=ctx.room,
        room_options=room_io.RoomOptions(
            audio_input=room_io.AudioInputOptions(
                noise_cancellation=hecttor.noise_suppression(),
            ),
        ),
    )


if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
import { type JobContext, WorkerOptions, cli, defineAgent, voice } from '@livekit/agents';
import * as openai from '@livekit/agents-plugin-openai';
import * as silero from '@livekit/agents-plugin-silero';
import { noiseSuppression } from '@hecttor/livekit-noise-cancellation';
import { fileURLToPath } from 'node:url';

export default defineAgent({
  entry: async (ctx: JobContext) => {
    await ctx.connect();

    const session = new voice.AgentSession({
      stt: new openai.STT(),
      llm: new openai.LLM(),
      tts: new openai.TTS(),
      vad: await silero.VAD.load(),
    });

    await session.start({
      agent: new voice.Agent({ instructions: 'You are a helpful voice assistant.' }),
      room: ctx.room,
      inputOptions: {
        noiseCancellation: noiseSuppression(),
      },
    });
  },
});

cli.runApp(new WorkerOptions({ agent: fileURLToPath(import.meta.url) }));

Tuning the enhancer

The defaults (ASR mode, voice isolation, model-default weight) are the right starting point for transcription pipelines. Two knobs are worth trying:

  • Model — the default is a voice-isolation model, which isolates the primary speaker in addition to removing noise. If you want all voices to come through (multi-speaker rooms, side-conversations that should be transcribed), switch to a pure noise-cancellation model. Available models use different architectures — try them to find which gives the best transcription results for your audio.
  • Enhancer weight — the wet/dry blend. Lower it if enhancement sounds too aggressive for your input; at 1.0 the output is fully enhanced.
noise_cancellation=hecttor.noise_suppression(
    model="your_model",      # pure noise cancellation, keep all speakers
    enhancer_weight=0.8,     # blend 20% of the original signal back in
)
noiseCancellation: noiseSuppression({
  model: 'your_model',       // pure noise cancellation, keep all speakers
  enhancerWeight: 0.8,       // blend 20% of the original signal back in
}),

Model names and their default blend weights are provided during onboarding. Compare candidates with the protocol in Evaluations rather than by ear — see Orpheus Overview for why.

For audio heard by people rather than STT (call recording, listen-in), use the perceptual mode: hecttor.human_noise_suppression() / humanNoiseSuppression(). It requires a Call Enhancement key and additionally supports voice_boost.

Enabling and disabling at runtime

Enhancement can be bypassed mid-session without tearing down the pipeline — useful for A/B listening or a user-facing toggle. Disabling passes frames through untouched; re-enabling resets the model state so it starts cleanly.

suppressor = hecttor.noise_suppression()
# ... attach to the session via AudioInputOptions(noise_cancellation=suppressor)

suppressor.enabled = False   # bypass (raw passthrough)
suppressor.enabled = True    # re-enable (model caches reset automatically)
const suppressor = noiseSuppression();
// ... attach to the session via inputOptions.noiseCancellation

suppressor.setEnabled(false); // bypass (raw passthrough)
suppressor.setEnabled(true);  // re-enable (model caches reset automatically)