Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
This example demonstrates how to create an agent that can handle multi-turn audio conversations, maintaining context between audio interactions while generating both text and audio responses.
Code
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.utils.audio import write_audio_to_file
from rich.pretty import pprint
agent = Agent(
model=OpenAIChat(
id="gpt-5-mini-audio-preview",
modalities=["text", "audio"],
audio={"voice": "sage", "format": "wav"},
),
add_history_to_context=True,
db=SqliteDb(
session_table="audio_multi_turn_sessions", db_file="tmp/audio_multi_turn.db"
),
)
run_response = agent.run("Is a golden retriever a good family dog?")
pprint(run_response.content)
if run_response.response_audio is not None:
write_audio_to_file(
audio=run_response.response_audio.content, filename="tmp/answer_1.wav"
)
run_response = agent.run("What breed are we talking about?")
pprint(run_response.content)
if run_response.response_audio is not None:
write_audio_to_file(
audio=run_response.response_audio.content, filename="tmp/answer_2.wav"
)
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Install libraries
pip install -U openai agno
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
Create a Python file
Create a Python file and add the above code.touch audio_multi_turn.py
Run Agent
python audio_multi_turn.py
Find All Cookbooks
Explore all the available cookbooks in the Agno repository. Click the link below to view the code on GitHub:Agno Cookbooks on GitHub