***

title: Actions
slug: /reference/python/relay/actions
description: Action classes returned from call control methods.
max-toc-depth: 3
---------------------

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

[play]: /docs/server-sdks/reference/python/relay/call/play

[record]: /docs/server-sdks/reference/python/relay/call/record

[detect]: /docs/server-sdks/reference/python/relay/call/detect

[call]: /docs/server-sdks/reference/python/relay/call

[relayevent]: /docs/server-sdks/reference/python/relay/events

[play-action]: /docs/server-sdks/reference/python/relay/actions/play-action

[record-action]: /docs/server-sdks/reference/python/relay/actions/record-action

[collect-action]: /docs/server-sdks/reference/python/relay/actions/collect-action

[detect-action]: /docs/server-sdks/reference/python/relay/actions/detect-action

[standalone-collect-action]: /docs/server-sdks/reference/python/relay/actions/standalone-collect-action

[fax-action]: /docs/server-sdks/reference/python/relay/actions/fax-action

[tap-action]: /docs/server-sdks/reference/python/relay/actions/tap-action

[stream-action]: /docs/server-sdks/reference/python/relay/actions/stream-action

[pay-action]: /docs/server-sdks/reference/python/relay/actions/pay-action

[transcribe-action]: /docs/server-sdks/reference/python/relay/actions/transcribe-action

[ai-action]: /docs/server-sdks/reference/python/relay/actions/ai-action

[ref-playaction]: /docs/server-sdks/reference/python/relay/actions/play-action

Action objects are returned from call control methods like
[`play()`][play],
[`record()`][record], and
[`detect()`][detect]. They provide a common
interface for tracking and controlling in-progress operations on a
[`Call`][call].

All action classes extend a shared base that provides `is_done`, `completed`,
`result`, `control_id`, and the `wait()` method. Specific action types add
methods relevant to their operation (e.g., `pause()` and `resume()` on
[`PlayAction`][ref-playaction]).

```python
from signalwire.relay import RelayClient

client = RelayClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
    contexts=["default"],
)

@client.on_call
async def on_call(call):
    await call.answer()
    play_action = await call.play([{"type": "tts", "text": "Hello!"}])

    # Control the in-progress operation
    await play_action.pause()
    await play_action.resume()

    # Wait for completion
    event = await play_action.wait()

client.run()
```

## Action (Base Interface)

All action classes share these properties and methods.

### Properties

<ParamField path="control_id" type="str" toc={true}>
  Unique identifier for this operation, used to correlate commands and events.
</ParamField>

<ParamField path="is_done" type="bool" toc={true}>
  `True` if the underlying future has resolved (the operation has reached a terminal state).
</ParamField>

<ParamField path="completed" type="bool" toc={true}>
  `True` once the action has finished and the terminal event has been processed.
</ParamField>

<ParamField path="result" type="Optional[RelayEvent]" toc={true}>
  The terminal [`RelayEvent`][relayevent] for this action,
  or `None` if the action has not yet completed.
</ParamField>

### Methods

#### wait

**wait**(`timeout=None`) -> [`RelayEvent`][relayevent]

Block until the action completes and return the terminal event.

<ParamField path="timeout" type="Optional[float]" toc={true}>
  Maximum seconds to wait. `None` waits indefinitely. Raises `asyncio.TimeoutError`
  if exceeded.
</ParamField>

## Subclasses

<CardGroup cols={2}>
  <Card title="PlayAction" href="/docs/server-sdks/reference/python/relay/actions/play-action">
    Tracks audio playback. Supports pause, resume, volume, and stop.
  </Card>

  <Card title="RecordAction" href="/docs/server-sdks/reference/python/relay/actions/record-action">
    Tracks recording. Supports pause, resume, and stop.
  </Card>

  <Card title="CollectAction" href="/docs/server-sdks/reference/python/relay/actions/collect-action">
    Tracks play-and-collect. Supports stop, volume, and input timers.
  </Card>

  <Card title="DetectAction" href="/docs/server-sdks/reference/python/relay/actions/detect-action">
    Tracks detection (answering machine, fax, digits). Stop only.
  </Card>

  <Card title="StandaloneCollectAction" href="/docs/server-sdks/reference/python/relay/actions/standalone-collect-action">
    Tracks standalone input collection. Stop and input timers.
  </Card>

  <Card title="FaxAction" href="/docs/server-sdks/reference/python/relay/actions/fax-action">
    Tracks fax send/receive. Stop only.
  </Card>

  <Card title="TapAction" href="/docs/server-sdks/reference/python/relay/actions/tap-action">
    Tracks media interception. Stop only.
  </Card>

  <Card title="StreamAction" href="/docs/server-sdks/reference/python/relay/actions/stream-action">
    Tracks audio streaming to WebSocket. Stop only.
  </Card>

  <Card title="PayAction" href="/docs/server-sdks/reference/python/relay/actions/pay-action">
    Tracks payment collection. Stop only.
  </Card>

  <Card title="TranscribeAction" href="/docs/server-sdks/reference/python/relay/actions/transcribe-action">
    Tracks transcription. Stop only.
  </Card>

  <Card title="AIAction" href="/docs/server-sdks/reference/python/relay/actions/ai-action">
    Tracks an AI agent session. Stop only.
  </Card>
</CardGroup>