***

title: play_background_file
slug: /reference/python/agents/skills/play-background-file
description: Control background file playback during calls.
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Control background file playback during calls. A single tool handles both starting and
stopping playback via an `action` parameter with dynamic enum values generated from the
configured file list. Supports audio and video files.

**Tools:** `play_background_file` (default, customizable via `tool_name`)

**Requirements:** None (files must be accessible via URL)

**Multi-instance:** Yes (use different `tool_name` per instance)

<ParamField path="files" type="list[dict]" required={true} toc={true}>
  Array of file configurations to make available for playback. Each object must include:

  * `key` (str, required) -- Unique identifier for the file (alphanumeric, underscores, hyphens).
  * `description` (str, required) -- Human-readable description of the file.
  * `url` (str, required) -- URL of the audio/video file to play.
  * `wait` (bool, optional, default `False`) -- Whether to wait for the file to finish playing.
</ParamField>

```python
from signalwire import AgentBase

class MyAgent(AgentBase):
    def __init__(self):
        super().__init__(name="assistant", route="/assistant")
        self.set_prompt_text("You are a helpful assistant.")
        self.add_skill("play_background_file", {
            "tool_name": "play_testimonial",
            "files": [
                {
                    "key": "massey",
                    "description": "Customer success story from Massey Energy",
                    "url": "https://example.com/massey.mp4",
                    "wait": True
                }
            ]
        })

agent = MyAgent()
agent.serve()
```