Get the most recent script trace
automations_get_last_script_traceFetch the most recent trace for a script to debug unexpected behavior, or get the most recent failed run by setting failed_only. Returns the full step-by-step trace.
Instructions
Fetch the most recent (or most recent failed) trace for a script.
Calls trace/list for script_id, then picks a run_id (the most
recent overall, or with failed_only=True the most recent whose
script_execution isn't 'finished') and calls trace/get for it.
Use when: debugging why a script didn't behave as expected without
first listing traces and picking a run_id by hand.
Returns: dict with the full step-by-step trace for the picked run.
Errors: returns {"error": "no_traces"|"no_failed_traces", "script_id": sid} when no matching run exists.
Limits: blocks for two sequential WebSocket round trips.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script_id | Yes | Script id to fetch the latest trace for, bare or prefixed ('script.<id>'). | |
| failed_only | No | If True, pick the most recent run that did not finish cleanly instead of the most recent run overall. Defaults to False. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||