List job / workflow run completion events is a feed of your jobs and workflow runs as they stop: completed, error or failed, cancelled, and (for runs) paused. Use it instead of polling many status endpoints.
Reading the feed
- Events come oldest first. Each response has a
next_cursor; pass it back asafterto get only newer events. wait(up to 25 seconds) holds the request open until an event arrives, so you learn about a finished job within moments without busy polling.- Filter with
kind(joborworkflow_run) andsubject_id(one job or run). - Events are kept for 7 days.
Events are short: an id, what changed, and its new status. Re-read Get job status or Get a workflow run for details.
Delivery is at least once and never skips: the same event can arrive twice, so ignore an event_id you've already handled.
With the Python SDK
from cognichem_client import CogniChem
client = CogniChem.from_env()
for event in client.events.listen(kind="workflow_run"):
run = client.workflows.runs.get(event.subject_id)
print(run.run_name, run.status)listen long-polls and drops repeated events for you.