You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff2aa23
Browse filesBrowse the repository at this point in the historyBrowse files
feat(webapp,sdk,core,cli): replay a run with overrides from the API, SDK and MCP
Replay a run with a different payload, metadata or trigger options from
the API, the SDK and the MCP server. The replay endpoint takes an
optional body using the same option names as `trigger()`; an empty body
replays the run unchanged, so existing clients keep working.
```ts
import { runs } from "@trigger.dev/sdk";
const { id } = await runs.replay("run_1234", {
payload: { userId: "user_456" },
metadata: { source: "replay" },
tags: ["replayed"],
machine: "large-1x",
version: "20250101.1",
delay: "10m",
});
```
Supported overrides: `payload`, `metadata`, `tags`, `queue`,
`concurrencyKey`, `machine`, `version`, `region`, `delay`, `ttl`,
`idempotencyKey`, `idempotencyKeyTTL`, `maxAttempts`, `maxDuration` and
`priority`. The SDK serializes a payload override like `trigger()` does,
so `Date`, `BigInt`, `Map` and `Set` values keep their types; raw HTTP
callers send plain JSON, or a SuperJSON string with `payloadType:
"application/super+json"`. The replay stays in the original run's
environment.
- The MCP server has a new `replay_run` tool with the same overrides. It
is hidden in `--readonly` mode.
- The replay endpoint accepts public access tokens. Every replay needs
permission to trigger the run's task as well as write access to the run,
the same as the trigger API.
- Replay reports why it failed: an unknown queue, an undeployed version
or an invalid option returns its message instead of "Failed to create
new run", and an unknown field in the body is rejected.
- A payload override now applies to runs whose payload was offloaded to
object storage.
- Replaying from the dashboard keeps the original payload for runs whose
payload can't be edited there, instead of sending an empty object.
- Triggering with an unknown `lockToVersion` returns a 4xx with a
message instead of a 500.
Mono-RevId: 889adbbf384910d821b41d74c75e02675c145a00
Add a `replay_run` tool to the MCP server, so your AI assistant can replay a run, optionally with a new payload, metadata, tags, machine, version, delay or other trigger options. It is hidden in `--readonly` mode.
`runs.replay()` now takes options, so you can replay a run with a different payload, metadata, tags, queue, machine, version, delay and other trigger options. Anything you leave out comes from the original run, as before, and the payload is serialized like `trigger()`, so values like `Date` and `BigInt` keep their types.
Copy file name to clipboardExpand all lines: docs/mcp-tools.mdx
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,20 @@ Cancel a running or queued run.
102
102
-`"Cancel run run_abc123"`
103
103
-`"Stop that task"`
104
104
105
+
### replay_run
106
+
107
+
Replay a run as a new run of the same task, in the same environment. The new run reuses the original run's payload, metadata, tags, queue, concurrency key, and machine unless you override them. See [Replaying](/replaying) for how each option falls back.
108
+
109
+
**Parameters:**
110
+
-`runId` (required): The run to replay, starting with `run_`
111
+
-`payload`, `metadata`, `tags` (optional): Replace the original run's values
112
+
-`queue`, `concurrencyKey`, `machine`, `version`, `region`, `delay`, `ttl`, `idempotencyKey`, `maxAttempts`, `maxDuration`, `priority` (optional): Override the trigger options for the new run
113
+
114
+
**Example usage:**
115
+
-`"Replay run run_abc123"`
116
+
-`"Replay that failed run with userId set to user_456"`
117
+
-`"Replay run run_abc123 on a large-1x machine in 10 minutes"`
118
+
105
119
## Deployment Tools
106
120
107
121
### deploy
@@ -225,7 +239,7 @@ Check the status of the dev server and view recent output. Shows whether it is s
225
239
-`"Are there any build errors?"`
226
240
227
241
<Callouttype="warning">
228
-
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, and cancel_run.
242
+
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, cancel_run, and replay_run.
0 commit comments