Code
blog_to_podcast.py
import base64
from uuid import uuid4
from agno.agent import Agent, RunOutput
from agno.models.openai import OpenAIResponses
from agno.tools.eleven_labs import ElevenLabsTools
from agno.tools.firecrawl import FirecrawlTools
from agno.utils.media import save_base64_data
url = "https://www.bcg.com/capabilities/artificial-intelligence/ai-agents"
blog_to_podcast_agent = Agent(
name="Blog to Podcast Agent",
id="blog_to_podcast_agent",
model=OpenAIResponses(id="gpt-5.2"),
tools=[
ElevenLabsTools(
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_multilingual_v2",
target_directory="audio_generations",
),
FirecrawlTools(),
],
description="You are an AI agent that can generate audio using the ElevenLabs API.",
instructions=[
"When the user provides a blog URL:",
"1. Use FirecrawlTools to scrape the blog content",
"2. Create a concise summary of the blog content that is NO MORE than 2000 characters long",
"3. The summary should capture the main points while being engaging and conversational",
"4. Use the ElevenLabsTools to convert the summary to audio",
"You don't need to find the appropriate voice first, I already specified the voice to user",
"Ensure the summary is within the 2000 character limit to avoid ElevenLabs API limits",
],
markdown=True,
debug_mode=True,
)
podcast: RunOutput = blog_to_podcast_agent.run(
f"Convert the blog content to a podcast: {url}"
)
save_dir = "audio_generations"
if podcast.audio is not None and len(podcast.audio) > 0:
try:
filename = f"{save_dir}/sample_podcast_{uuid4()}.mp3"
base64_audio = base64.b64encode(podcast.audio[0].content).decode("utf-8")
save_base64_data(base64_audio, filename)
print(f"Audio saved successfully to: {filename}")
except Exception as e:
print(f"Error saving audio file: {e}")
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Set your API key
export OPENAI_API_KEY=xxx
export ELEVEN_LABS_API_KEY=xxx
export FIRECRAWL_API_KEY=xxx