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
feat(sdk,webapp): add tags.delete() to remove tags from a run
Adds a per-run tag removal path, mirroring the existing tags.add() flow end
to end:
- `tags.delete(tag | tags)` in the SDK, plus JSDoc on both `add` and `delete`
- `DELETE /api/v1/runs/:runId/tags` as a method branch on the existing route
- `RemoveTagsRequestBody` and `ApiClient#removeTags` in core
- `RunStore#removeTags`, a single-statement UPDATE so there is no
read-modify-write window racing a concurrent pushTags
- a `remove_tags` snapshot patch for runs still in the buffer
Removing a tag only affects the run it's called from. Removing a tag the run
doesn't have, or an empty list, is an idempotent success.
Also fixes the `add` span name, which was hardcoded to "tags.set()", and an
OpenAPI code sample advertising a `runs.addTags(...)` function that doesn't
exist.
Co-Authored-By: Claude <noreply@anthropic.com>
You can now remove tags from a run while it's running with `tags.delete("my-tag")` (or an array of tags). It only affects that run — every other run keeps the tag, and the tag stays available to filter by.
Copy file name to clipboardExpand all lines: docs/tags.mdx
+33-1Lines changed: 33 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,11 +18,13 @@ We don't enforce prefixes but if you use them you'll find it easier to filter an
18
18
19
19
## How to add tags
20
20
21
-
There are two ways to add tags to a run:
21
+
You can add tags to a run in two ways:
22
22
23
23
1. When triggering the run.
24
24
2. Inside the `run` function, using `tags.add()`.
25
25
26
+
You can also [remove tags](#removing-tags) from a run while it's running.
27
+
26
28
### 1. Adding tags when triggering the run
27
29
28
30
You can add tags when triggering a run using the `tags` option. All the different [trigger](/triggering) methods support this.
@@ -96,6 +98,36 @@ export const myTask = task({
96
98
});
97
99
```
98
100
101
+
## Removing tags
102
+
103
+
Use the `tags.delete()` function to remove tags from inside the `run` function. It takes a single string or an array of strings, just like `tags.add()`:
description: Removes one or more tags from a run. Only this run is affected — the tag is left on any other run that has it. Tags the run doesn't have are ignored, so the request is idempotent.
449
+
requestBody:
450
+
required: true
451
+
content:
452
+
application/json:
453
+
schema:
454
+
type: object
455
+
required:
456
+
- tags
457
+
properties:
458
+
tags:
459
+
$ref: "#/components/schemas/RunTags"
460
+
responses:
461
+
"200":
462
+
description: Successful request
463
+
content:
464
+
application/json:
465
+
schema:
466
+
type: object
467
+
properties:
468
+
message:
469
+
type: string
470
+
example: "Successfully removed 2 tags."
471
+
"400":
472
+
description: Invalid request
473
+
content:
474
+
application/json:
475
+
schema:
476
+
type: object
477
+
properties:
478
+
error:
479
+
type: string
480
+
"401":
481
+
description: Unauthorized request
482
+
content:
483
+
application/json:
484
+
schema:
485
+
type: object
486
+
properties:
487
+
error:
488
+
type: string
489
+
enum:
490
+
- Invalid or Missing API Key
491
+
"404":
492
+
description: Run not found
493
+
content:
494
+
application/json:
495
+
schema:
496
+
type: object
497
+
properties:
498
+
error:
499
+
type: string
500
+
enum:
501
+
- Run not found
502
+
tags:
503
+
- runs
504
+
security:
505
+
- secretKey: []
506
+
x-codeSamples:
507
+
- lang: typescript
508
+
label: SDK
509
+
source: |-
510
+
import { tags } from "@trigger.dev/sdk";
511
+
512
+
// Called from inside a run — applies to the current run
0 commit comments