teff.stream¶
teff.stream
¶
Streaming events for graph execution.
Constitution Principle IX: observability is mandatory. graph.stream()
emits :class:StreamEvent objects as a run progresses, so callers can
render tokens, progress, and routing decisions before the run finishes —
instead of waiting for a fully materialised result from graph.run().
Classes:
| Name | Description |
|---|---|
StreamEvent |
A single event emitted while a graph streams. |
StreamEvent
dataclass
¶
A single event emitted while a graph streams.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
Event type — |
node_id |
str | None
|
Graph node id the event belongs to, if any. |
node_type |
str | None
|
Node type string, if any. |
data |
dict[str, Any]
|
Type-specific payload (token text, error, condition, etc.). |
Source code in teff/stream.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |