Skip to content

Event streams

Use this reference with the complete developer tour and Python types. The example at the end runs after the tour setup.

Consume authorized canonical events with reconnect and a sequence checkpoint.

events(self, **options: Any)
Parameter Type and default Usage
**options keyword fields (default optional) Optional fields supported by this operation, listed in the linked HTTP input. Unknown fields are not a supported extension mechanism.

Returns: Python iterator or TypeScript async iterator of events; Go callback with error return.

Permissions, lifecycle and errors: Persist a checkpoint after applying each event. Go options add conversation filtering; Python supports conversation_id; TypeScript EventOptions exposes after, summary and signal. Summary streams omit full bodies. A denial stops reconnecting.

Working Python example. Input/output fields are in the types reference.

Run this region after the shared setup. Assertions check the returned data; the full tour is a runnable program.

stream = billing.events()
try:
for event in stream:
if event['kind'] == 'message.created' and event.get('conversation_id') == sent['conversation_id']:
checkpoint = event['sequence'] # Persist after your application applies this event.
assert checkpoint > 0
break
finally:
stream.close()

Read this page as Markdown