Documentation Index
Fetch the complete documentation index at: https://agno-v2-shaloo-ai-support-link.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Use Cartesia with Agno Agents for generating text-to-speech and audio.
Prerequisites
from agno.agent import Agent
from agno.tools.cartesia import CartesiaTools
from agno.utils.audio import write_audio_to_file
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Initialize Agent with Cartesia tools
agent = Agent(
name="Cartesia TTS Agent",
description="An agent that uses Cartesia for text-to-speech.",
tools=[CartesiaTools()],
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
response = agent.run(
"""Generate a simple greeting using Text-to-Speech:
Say "Welcome to Cartesia, the advanced speech synthesis platform. This speech is generated by an agent."
"""
)
# Save the generated audio
if response.audio:
write_audio_to_file(
audio=response.audio[0].content, filename="tmp/greeting.mp3"
)
Run the Example
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/91_tools
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
python cartesia_tools.py
For details, see Cartesia cookbook.