TEN-framework: Simplifying Real-Time Voice AI Agents


TEN-framework: Simplifying Real-Time Voice AI Agents

TEN-framework/ten-framework

2025-09-19

The TEN-framework is a powerful tool for engineers who want to build real-time conversational voice AI agents. It simplifies the complex process of creating these applications by providing a pre-built structure. This means you don't have to start from scratch, saving a huge amount of development time. It's particularly useful for

Prototyping
Quickly build and test new ideas for AI voice agents.

Reduced Complexity
It handles the difficult parts like real-time audio processing, synchronization, and integrating different AI models (like speech-to-text, LLMs, and text-to-speech).

Modular Design
The framework's modular nature allows you to easily swap out components. For example, if you want to use a different speech-to-text service, you can do it without overhauling your entire application.

Focus on Core Logic
You can focus on building the unique business logic of your application instead of worrying about low-level infrastructure.

Getting the framework up and running is pretty straightforward. You'll need to have Python and pip installed. The best way to install it is using pip.

First, you need to clone the repository from GitHub

git clone https://github.com/TEN-framework/ten-framework.git
cd ten-framework

Next, you can install the necessary packages. It's a good practice to use a virtual environment to manage dependencies.

python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt

After installation, you'll need to configure your API keys for the different services you want to use, such as OpenAI, ElevenLabs, etc. You can do this by setting them as environment variables.

export OPENAI_API_KEY="your-api-key"
export ELEVENLABS_API_KEY="your-api-key"

Here’s a simple example of how you can use the TEN-framework to create a basic conversational AI agent. This code will set up a listener for a wake word, and when detected, it will start a conversation.

import asyncio
from ten_framework.core.pipeline import Pipeline
from ten_framework.components.input.mic import MicInput
from ten_framework.components.stt.whisper import WhisperSTT
from ten_framework.components.llm.openai import OpenAILLM
from ten_framework.components.tts.elevenlabs import ElevenLabsTTS
from ten_framework.components.output.speaker import SpeakerOutput

async def main():
    # Set up the pipeline components
    mic_input = MicInput(
        wake_word="hey framework",
        wake_word_threshold=0.5
    )
    stt = WhisperSTT()
    llm = OpenAILLM(
        model_name="gpt-4o",
        system_prompt="You are a helpful conversational AI assistant."
    )
    tts = ElevenLabsTTS()
    speaker_output = SpeakerOutput()

    # Build the pipeline
    pipeline = Pipeline(
        input_component=mic_input,
        stt_component=stt,
        llm_component=llm,
        tts_component=tts,
        output_component=speaker_output
    )

    # Start the conversation loop
    print("Agent is listening...")
    await pipeline.run()

if __name__ == "__main__":
    asyncio.run(main())

Imports
We import the necessary classes from the framework, such as Pipeline, and the specific components for input, STT (Speech-to-Text), LLM (Large Language Model), TTS (Text-to-Speech), and output.

Component Initialization
We create instances of each component. For example, MicInput is set up to listen for the wake word "hey framework."

Pipeline Assembly
The Pipeline class acts as the orchestrator. We pass the initialized components to it in the correct order
input -> stt -> llm -> tts -> output.

Running the Pipeline
The pipeline.run() method starts the main loop. The framework takes care of passing the data (audio, text, etc.) between the components in real-time.


TEN-framework/ten-framework




The Developer’s Blueprint for Multimodal AI Agents with LiveKit

Think of this framework as the "connective tissue" between high-end AI brains (like LLMs) and the real-world plumbing of low-latency video and audio


The Edge-Native Architect: Deploying Stateful AI Agents on Cloudflare

Traditionally, we’ve built APIs that wait for a request and send a response. With Cloudflare Agents (often paired with Workflows), we're moving toward autonomous


Integrating Daytona SDKs for Trustworthy AI Code Execution

Here's a friendly, detailed breakdown of how Daytona can be incredibly useful to a software engineer, along with installation and code examples


Beyond Prompts: How garak Helps Engineers Test LLM Security

Imagine you've built a powerful LLM-powered application. You've trained it, fine-tuned it, and it's doing an amazing job


Open WebUI: Unifying OpenAI, Local Models, and Tool-Calling in One Self-Hosted Platform

Think of Open WebUI as the "Ultimate Dashboard" for your AI workflows. It’s a self-hosted, extensible interface that feels as smooth as ChatGPT but gives you total control over your backend


The Architecture of Smart Web Automation: Understanding microsoft/magentic-ui

This project is a fascinating research prototype for a human-centered web agent, and it offers a new way to build powerful


From Noise to Knowledge: An Engineer's Guide to the 'summarize' CLI

Here is a breakdown of why this tool is a gem for engineers and how you can get it running.In our world, we are constantly bombarded with documentation


Developer's Guide to the AI Cookbook

As software engineers, we're constantly looking for ways to efficiently integrate powerful new technologies into our projects


LiveKit: Simplifying WebRTC for Humans and AI

Hey there! Let's talk about livekit/livekit, a cool open-source project that's super useful for building real-time communication apps


Rowboat Deep Dive: Architecture, Implementation, and AI Memory

Think of it as moving from a "stateless" chat (where you're constantly copy-pasting context) to a "stateful" collaborator that understands your codebase and project history