Attach a small amount of data to a run and update it as the run progresses.
trigger function:
metadata.get() or metadata.current() (only inside a run):
metadata.current() or metadata.get() outside of the run function will always return
undefined.trigger.config.ts file.
flush and stream) are synchronous and will not block the run function. We periodically flush metadata to the database in the background, so you can safely update the metadata inside a run as often as you need to, without worrying about impacting the run’s performance.
metadata.stream accepts any AsyncIterable or ReadableStream object. The stream will be captured and made available in the Realtime API. So for example, you could pass the body of a fetch response to metadata.stream to capture the response body and make it available in Realtime:
metadata.parent accessor:
metadata.parent and metadata.root:
metadata.get() or
metadata.current(), you will get a string back. You will need to deserialize it back to a Date
object if you need to use it as a Date.
runs.retrieve() SDK function to get the metadata for a run:
TASK_RUN_METADATA_MAXIMUM_SIZE environment variable. For example, to increase the limit to 16KB, you would set TASK_RUN_METADATA_MAXIMUM_SIZE=16384.