runs.subscribeToRun
Subscribes to all changes to a specific run.Example
runs.subscribeToRunsWithTag
Subscribes to all changes to runs with a specific tag.Example
runs.subscribeToBatch
Subscribes to all changes for runs in a batch.Example
break
the loop when you want to stop listening for updates.
Authentication: This function supports both server-side and client-side authentication. For server-side authentication, use your API key. For client-side authentication, you must generate a public access token with read access to the specific batch. See our authentication guide for details.
Response: The AsyncIterator yields the run object.
Type safety
You can infer the types of the run’s payload and output by passing the type of the task to the subscribe functions:subscribeToRunsWithTag
, you can pass a union of task types:
Subscribe to metadata updates from your tasks
The metadata API allows you to update custom metadata on runs and receive real-time updates when metadata changes. This is useful for tracking progress, storing intermediate results, or adding custom status information that can be monitored in real-time.For frontend applications using React, see our React hooks metadata
documentation for
consuming metadata updates in your UI.
metadata.set()
, metadata.append()
, or other metadata methods, all subscribers to that run will automatically receive the updated run object containing the new metadata.
This makes metadata perfect for:
- Progress tracking
- Status updates
- Intermediate results
- Custom notifications