play_background_file

View as MarkdownOpen in Claude

Play an audio or video file in the background while the conversation continues.

Parameters

filename
strRequired

URL of the audio or video file to play (e.g., "https://example.com/hold-music.mp3").

wait
boolDefaults to False

When True, suppresses the agent’s attention-getting behavior during playback. The agent will not try to re-engage the user while the file is playing.

Returns

FunctionResult — self, for chaining.

Example

1from signalwire import AgentBase
2from signalwire import FunctionResult
3
4agent = AgentBase(name="my-agent", route="/agent")
5agent.set_prompt_text("You are a helpful assistant.")
6
7@agent.tool(name="play_hold_music", description="Play hold music in the background")
8def play_hold_music(args, raw_data):
9 return (
10 FunctionResult("Please hold.")
11 .play_background_file(
12 "https://example.com/hold-music.mp3",
13 wait=True
14 )
15 )
16
17agent.serve()