bolna

bolna-aiMIT活跃维护

用 Python 搭建语音对话 AI 代理的框架,整合 Deepgram、ElevenLabs 等语音服务与 GPT-4、DeepSeek 等大模型,支持函数调用,快速做出能打电话的智能体。

Conversational voice AI agents

0.11.32发布于 2026-11-06 12:37 UTC821star +1 / 7 天392fork同步于 2026-11-11 05:50 UTC

怎么上手

由 README 提炼,执行前请确认
cd local_setup && chmod +x start.sh && ./start.sh
硬件要求按 README 说明

README 未说明显存或 GPU 要求;本地示例通过 Docker Compose 运行,包含电话服务、Bolna 服务、ngrok 和 redis 四个容器。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

开源端到端语音 AI 智能体编排平台,用 JSON 快速搭建可打电话的对话助手

用 Python 搭建语音对话 AI 代理的框架,整合 Deepgram、ElevenLabs 等语音服务与 GPT-4、DeepSeek 等大模型,支持函数调用,快速做出能打电话的智能体。

核心能力

  • 通过 JSON 配置编排 ASR+LLM+TTS 语音对话流程
  • 基于 WebSocket 流式串联转写、大模型与语音合成
  • 支持 Twilio、Plivo 等电话线路发起真实通话
  • 接入 Deepgram、OpenAI、ElevenLabs 等多家供应商
  • 提供 Python Assistant API,可脱离电话环境直接跑通管道

容易踩的坑

需先按 .env.sample 填好 .env,否则缺少各供应商密钥无法运行;本地电话示例要自备 Twilio 或 Plivo 账号,并把 ngrok authtoken 写入 ngrok-config.yml;纯 Python 示例需先 export OPENAI_API_KEY、DEEPGRAM_AUTH_TOKEN、ELEVENLABS_API_KEY 等环境变量。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本0.11.32
  1. 0.11.32最新正式版2026-11-06 · 2026-11-06 12:37 UTC

    What's Changed

    Full Changelog: https://github.com/bolna-ai/bolna/compare/0.11.31...0.11.32

  2. 0.11.312026-11-05 · 2026-11-05 16:48 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/bolna-ai/bolna/compare/0.11.30...0.11.31

  3. 0.11.302026-11-05 · 2026-11-05 12:21 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/bolna-ai/bolna/compare/0.11.29...0.11.30

  4. 0.11.292026-11-05 · 2026-11-05 08:23 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/bolna-ai/bolna/compare/0.11.28...0.11.29

  5. 0.11.282026-11-05 · 2026-11-05 07:48 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/bolna-ai/bolna/compare/0.11.27...0.11.28

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    [!NOTE] We are actively looking for maintainers.

    Introduction

    Bolna is the end-to-end open source production ready framework for quickly building LLM based voice driven conversational applications.

    Demo

    https://github.com/bolna-ai/bolna/assets/1313096/2237f64f-1c5b-4723-b7e7-d11466e9b226

    What is this repository?

    This repository contains the entire orchestration platform to build voice AI applications. It technically orchestrates voice conversations using combination of different ASR+LLM+TTS providers and models over websockets.

    Components

    Bolna helps you create AI Voice Agents which can be instructed to do tasks beginning with:

    1. Orchestration platform (this open source repository)
    2. Hosted APIs (https://docs.bolna.ai/api-reference/introduction) built on top of this orchestration platform [currently closed source]
    3. No-code UI playground at https://platform.bolna.ai/ using the hosted APIs + tailwind CSS [currently closed source]

    Development philosophy

    1. Any integration, enhancement or feature initially lands on this open source package since it forms the backbone of our Hosted APIs and dashboard
    2. Post that we expose APIs or make changes to existing APIs as required for the same
    3. Thirdly, we push it to the UI dashboard
    graph LR;
        A[Bolna open source] -->B[Hosted APIs];
        B[Hosted APIs] --> C[Hosted Playground]
    

    Supported providers and models

    1. Initiating a phone call using telephony providers like Twilio, Plivo, Exotel (coming soon), Vonage (coming soon) etc.
    2. Transcribing the conversations using Deepgram, Azure etc.
    3. Using LLMs like OpenAI, DeepSeek, Llama, Cohere, Mistral, etc to handle conversations
    4. Synthesizing LLM responses back to telephony using AWS Polly, ElevenLabs, Deepgram, OpenAI, Azure, Cartesia, Smallest, Maya, Kalpa etc.

    Refer to the docs for a deepdive into all supported providers.

    Local example setup [will be moved to a different repository]

    A basic local setup includes usage of Twilio or Plivo for telephony. We have dockerized the setup in local_setup/. One will need to populate an environment .env file from .env.sample.

    The setup consists of four containers:

    1. Telephony web server:
      • Choosing Twilio: for initiating the calls one will need to set up a Twilio account
      • Choosing Plivo: for initiating the calls one will need to set up a Plivo account
    2. Bolna server: for creating and handling agents
    3. ngrok: for tunneling. One will need to add the authtoken to ngrok-config.yml
    4. redis: for persisting agents & prompt data

    Quick Start

    The easiest way to get started is to use the provided script:

    cd local_setup
    chmod +x start.sh
    ./start.sh
    

    This script will check for Docker dependencies, build all services with BuildKit enabled, and start them in detached mode.

    Manual Setup

    Alternatively, you can manually build and run the services:

    1. Make sure you have Docker with Docker Compose V2 installed
    2. Enable BuildKit for faster builds:
      export DOCKER_BUILDKIT=1
      export COMPOSE_DOCKER_CLI_BUILD=1
      
    3. Build the images:
      docker compose build
      
    4. Run the services:
      docker compose up -d
      

    To run specific services only:

    docker compose up -d bolna-app twilio-app
    # or
    docker compose up -d bolna-app plivo-app
    

    Once the docker containers are up, you can now start to create your agents and instruct them to initiate calls.

    Example agents to create, use and start making calls

    You may try out different agents from example.bolna.dev.

    Programmatic usage (minimal example)

    You can also build and run an agent directly in Python without the local telephony setup.

    Example script: examples/simple_assistant.py

    import asyncio
    from bolna.assistant import Assistant
    from bolna.models import (
        Transcriber,
        Synthesizer,
        ElevenLabsConfig,
        LlmAgent,
        SimpleLlmAgent,
    )
    
    
    async def main():
        assistant = Assistant(name="demo_agent")
    
        # Configure audio input (ASR)
        transcriber = Transcriber(provider="deepgram", model="nova-2", stream=True, language="en")
    
        # Configure LLM
        llm_agent = LlmAgent(
            agent_type="simple_llm_agent",
            agent_flow_type="streaming",
            llm_config=SimpleLlmAgent(
                provider="openai",
                model="gpt-4o-mini",
                temperature=0.3,
            ),
        )
    
        # Configure audio output (TTS)
        synthesizer = Synthesizer(
            provider="elevenlabs",
            provider_config=ElevenLabsConfig(voice="George", voice_id="JBFqnCBsd6RMkjVDRZzb", model="eleven_turbo_v2_5"),
            stream=True,
            audio_format="wav",
        )
    
        # Build a single coherent pipeline: transcriber -> llm -> synthesizer
        assistant.add_task(
            task_type="conversation",
            llm_agent=llm_agent,
            transcriber=transcriber,
            synthesizer=synthesizer,
            enable_textual_input=False,
        )
    
        # Stream results
        async for chunk in assistant.execute():
            print(chunk)
    
    
    if __name__ == "__main__":
        asyncio.run(main())
    

    How to run:

    export OPENAI_API_KEY=...
    export DEEPGRAM_AUTH_TOKEN=...
    export ELEVENLABS_API_KEY=...
    python examples/simple_assistant.py
    

    This demonstrates orchestration and streaming output. For telephony, use the services in local_setup/.

    Note: For REST-based usage (Agent CRUD over HTTP), see API.md in the repo root.

    Expected output shape: assistant.execute() is an async generator yielding per-task result dicts (event-like chunks). The exact keys depend on configured tools/providers; treat it as a stream and process incrementally.

    Text-only pipeline example

    If you want a text-only flow (no transcriber/synthesizer), you can enable a text-only pipeline:

    Example script: examples/text_only_assistant.py

    import asyncio
    from bolna.assistant import Assistant
    from bolna.models import LlmAgent, SimpleLlmAgent
    
    
    async def main():
        assistant = Assistant(name="text_only_agent")
    
        llm_agent = LlmAgent(
            agent_type="simple_llm_agent",
            agent_flow_type="streaming",
            llm_config=SimpleLlmAgent(
                provider="openai",
                model="gpt-4o-mini",
                temperature=0.2,
            ),
        )
    
        # No transcriber/synthesizer; enable a text-only pipeline
        assistant.add_task(
            task_type="conversation",
            llm_agent=llm_agent,
            enable_textual_input=True,
        )
    
        async for chunk in assistant.execute():
            print(chunk)
    
    
    if __name__ == "__main__":
        asyncio.run(main())
    

    How to run (text-only):

    export OPENAI_API_KEY=...
    python examples/text_only_assistant.py
    

    Expected output shape: assistant.execute() yields streaming dicts per task step; fields vary by configuration. Handle chunk-by-chunk.

    Using your own providers

    You can populate the .env file to use your own keys for providers.

    ProviderEnvironment variable to be added in .env file
    DeepgramDEEPGRAM_AUTH_TOKEN
    Bolna (self-hosted, OpenAI Realtime transcription protocol)REALTIME_TRANSCRIBER_URL ({model} is replaced by the model), REALTIME_TRANSCRIBER_KEY

    These are the current supported LLM Provider Family: https://github.com/bolna-ai/bolna/blob/10fa26e5985d342eedb5a8985642f12f1cf92a4b/bolna/providers.py#L30-L47

    For LiteLLM based LLMs, add either of the following to the .env file depending on your use-case: LITELLM_MODEL_API_KEY: API Key of the LLM LITELLM_MODEL_API_BASE: URL of the hosted LLM LITELLM_MODEL_API_VERSION: API VERSION for LLMs like Azure

    For LLMs hosted via VLLM, add the following to the .env file: VLLM_SERVER_BASE_URL: URL of the hosted LLM using VLLM

    ProviderEnvironment variable to be added in .env file
    AWS PollyAccessed from system wide credentials via ~/.aws
    ElevenlabsELEVENLABS_API_KEY
    OpenAIOPENAI_API_KEY
    DeepgramDEEPGRAM_AUTH_TOKEN
    CartesiaCARTESIA_API_KEY
    SmallestSMALLEST_API_KEY
    MayaMAYA_API_KEY
    KalpaKALPA_API_KEY
    NavanaNAVANA_API_KEY
    Custom (the customer's own server, OpenAI speech API)None: the platform injects the endpoint (synthesizer_base_url) and key (synthesizer_key) per call
    ProviderEnvironment variable to be added in .env file
    TwilioTWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_PHONE_NUMBER
    PlivoPLIVO_AUTH_ID, PLIVO_AUTH_TOKEN, PLIVO_PHONE_NUMBER

    Open-source v/s Hosted APIs

    We have in the past tried to maintain both the open source and the hosted solution (via APIs and a UI dashboard).

    We have fluctuated b/w maintaining this repository purely from a point of time crunch and not interest.

    Currently, we are continuing to maintain it for the community and improving the adoption of Voice AI.

    Though the repository is completely open source, you can connect with us if interested in managed hosted offerings or more customized solutions.

    Extending with other Telephony Providers

    In case you wish to extend and add some other Telephony like Vonage, Telnyx, etc. following the guidelines below:

    1. Make sure bi-directional streaming is supported by the Telephony provider
    2. Add the telephony-specific input handler file in input_handlers/telephony_providers writing custom functions extending from the telephony.py class
      1. This file will mainly contain how different types of event packets are being ingested from the telephony provider
    3. Add telephony-specific output handler file in output_handlers/telephony_providers writing custom functions extending from the telephony.py class
      1. This mainly concerns converting audio from the synthesizer class to a supported audio format and streaming it over the websocket provided by the telephony provider
    4. Lastly, you'll have to write a dedicated server like the example twilio_api_server.py provided in local_setup to initiate calls over websockets.

    Security Acknowledgments

    We would like to thank the following individuals for responsibly disclosing security vulnerabilities and helping us keep this project safe:

    Contributing

    We love all types of contributions: whether big or small helping in improving this community resource.

    1. There are a number of open issues present which can be good ones to start with
    2. If you have suggestions for enhancements, wish to contribute a simple fix such as correcting a typo, or want to address an apparent bug, please feel free to initiate a new issue or submit a pull request
    3. If you're contemplating a larger change or addition to this repository, be it in terms of its structure or the features, kindly begin by creating a new issue open a new issue :octocat: and outline your proposed changes. This will allow us to engage in a discussion before you dedicate a significant amount of time or effort. Your cooperation and understanding are appreciated