Package: bolna
End-to-end open-source voice agents platform: Quickly build LLM based voice driven conversational applicationsDiscord|Docs|WebsiteIntroductionBolnais the end--to-end open source production ready framework for quickly building LLM based voice driven conversational applications.Demohttps://github.com/bolna-ai/bolna/assets/1313096/2237f64f-1c5b-4723-b7e7-d11466e9b226ComponentsBolna helps you create AI Voice Agents which can be instructed to do tasks beginning with:Initiating a phone call using telephony providers likeTwilio, etc.Transcribing the conversations usingDeepgram, etc.Using LLMs likeOpenAI, etc to handle conversationsSynthesizing LLM responses back to telephony usingAWS Polly,XTTS, etc.Instructing the Agent to perform tasks like sending emails, text messages, booking calendar after the conversation has endedRefer to thedocsfor a deepdive into all supported providers.AgentsThis repo contains the following types of agents in theagents/agent_typesdirectory which can be used to create conversational applications:contextual_conversational_agent: LLM-based free flow agentgraph_based_conversational_agent: LLM-based agent with classificationextraction_agent: Currently WIP.Feel free to contribute and open a PRLocal setupA basic local setup uses Twilio for telephony. We have dockerized the setup inlocal_setup/. One will need to populate an environment.envfile from.env.sample.The setup consists of four containers:Twilio web server: for initiating the calls one will need to set up aTwilio accountBolna server: for creating and handling agentsngrok: for tunneling. One will need to add theauthtokentongrok-config.ymlredis: for persisting agents & users contextual dataRunningdocker-compose up --buildwill use the.envas the environment file and theagent_datato start all containers.Once the docker containers are up, you can now start to create your agents and instruct them to initiate calls.Agent ExamplesThe repo contains examples as a reference for creating for application agents in theagent_datadirectory:airbnb_job: Astreamingconversationagent where the agent screens potential candidates for a job at AirBnBsorting_hat: Apreprocessedconversationagent which acts as a Sorting Hat for Hogwartsyc_screening: Astreamingconversationagent which acts as a Y Combinator partner asking questions around the idea/startupindian_elections_vernacular: Astreamingconversationagent which asks people for their outlook towards Indian elections in Hindi languagesample_agent: A boilerplate sample agent to start building your own agent!Anatomy of an agentAll agents are read from theagent_datadirectory. We have provided some samples for getting started. There's a dashboard coming up [still in WIP] which will easily facilitate towards creating agents.General structure of the agents:your-awesome-agent-name
├── conversation_details.json         # Compiled prompt
└── users.json                        # List of users that the call would be made toAgent typestreamingagentpreprocessedagentIntroductionA streaming agent will work like a free-flow conversation following the promptApart from following the prompt, a preprocessed agent will have all responsesfrom the agent preprocessed in the form of audio which will be streamedas per the classification of human's responsePromptRequired (defined inconversation_details.json)Required (defined inconversation_details.json)PreprocessingNot requiredRequired (usingscripts/preprocessed.py)[!note]
Currently, theusers.jsonhas the following user attributes which gets substituted in the prompt to make it customized for the call. More to be added soon!first_namelast_namehonorificFor instance, in the case of a preprocessed agent, the initial intro could be customized to have the user's name.Even the prompt could be customized to fill in user contextual details from users.json. For example,{first_name} defined in promptandprompt introSetting up your agentCreate a directory underagent_datadirectory with the name for your agentCreate your prompt and save in a file calledconversation_details.jsonusing the example providedOptional: In case if you are creating apreprocessedagent, generate the audio data used by using the scriptscripts/preprocess.pyCreating your agent and invoking callsAt this point, the docker containers should be up and runningYour agent prompt should be defined in theagent_data/directory withconversation_details.jsonwith the user list inusers.jsonCreate your agent using theBolna Create Agent API. An agent will get created with anagent_idInstruct the agent to initiate call to users viascripts/initiate_agent_call.py <agent_name> <agent_id>Open-source v/s PaidThough the repository is completely open source, you can connect with us if interested in managed offerings or more customized solutions.ContributingWe love all types of contributions: whether big or small helping in improving this community resource.There are a number ofopen issues presentwhich can be good ones to start withIf 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 requestIf 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 issueopen 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