ElevenLabsTools enable an Agent to perform audio generation tasks using ElevenLabs

Prerequisites

You need to install the elevenlabs library and an API key which can be obtained from Eleven Labs

pip install elevenlabs

Set the ELEVEN_LABS_API_KEY environment variable.

export ELEVEN_LABS_API_KEY=****

Example

The following agent will use Eleven Labs to generate audio based on a user prompt.

cookbook/tools/eleven_labs_tools.py
from agno.agent import Agent
from agno.tools.eleven_labs import ElevenLabsTools

# Create an Agent with the ElevenLabs tool
agent = Agent(tools=[
    ElevenLabsTools(
        voice_id="JBFqnCBsd6RMkjVDRZzb", model_id="eleven_multilingual_v2", target_directory="audio_generations"
    )
], name="ElevenLabs Agent")

agent.print_response("Generate a audio summary of the big bang theory", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
api_keystrNoneThe Eleven Labs API key for authentication
voice_idstrJBFqnCBsd6RMkjVDRZzbThe voice ID to use for the audio generation
target_directoryOptional[str]NoneThe directory to save the audio file
model_idstreleven_multilingual_v2The model’s id to use for the audio generation
output_formatstrmp3_44100_64The output format to use for the audio generation (check out the docs for more information)

Toolkit Functions

FunctionDescription
text_to_speechConvert text to speech
generate_sound_effectGenerate sound effect audio from a text prompt.
get_voicesGet the list of voices available

Developer Resources