RealtimeSalesAgent (agent.py)

CallAgent · ai, realtime-voice, voice-activity-detection, audio-processing, agent-orchestration, voice

Runs real-time voice sales conversations with configurable voice activity detection, multi-format audio support, and tool-enabled interactions.

# Source: https://github.com/Shehan-Wences/CallAgent | License: MIT | Copyright 2026 Shehan Wences
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations
import asyncio
import os
from typing import Awaitable, Callable
from agents.realtime import RealtimeAgent, RealtimeRunner

GREETING_TRIGGER = (
    "The call has just connected. Greet the person now by delivering your "
    "opening line, then continue the conversation naturally."
)

SessionFactory = Callable[[str, str, str, list], Awaitable[object]]


def _turn_detection() -> dict:
    """Voice-activity detection tuned to avoid interrupting on slight sounds.

    Server VAD with a raised threshold + longer trailing silence is far less
    twitchy than the default. Tunable at runtime via env wit

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key