do_action
Signature:
BoosterRobot.do_action(
action_id: str,
*,
on_done: Callable[[TaskHandle[None]], None] | None = None,
on_status_change: Callable[[TaskHandle[None]], None] | None = None,
) -> TaskHandle[None]
Description:
Asynchronously executes a predefined action and returns a TaskHandle. Use list_actions() to retrieve supported action_id values before calling.
Parameters:
Parameter | Type | Default | Description |
|---|---|---|---|
|
| Required | Predefined action ID. |
|
|
| Callback invoked when the task enters a terminal state. |
|
|
| Callback invoked when the task status changes. |
Returns:
TaskHandle[None], see "Tasks and Subscriptions / TaskHandle"
Raises:
ValueError: action_id does not exist or is not supported in the current version.
RuntimeError: A task in the same group is already running, the robot is executing another action, or action startup failed.
Example:
import time
from boosteros.robots.booster import BoosterRobot
robot = BoosterRobot()
handle = robot.do_action("hand_wave")
time.sleep(10.0)
handle.cancel()
status = handle.wait(timeout=5.0)
print(status)
# Example output: 'CANCELLED'