stream_events
Internal stream-control events shared by orchestration strategies and interfaces.
These sentinels are empty strings so they can pass through existing text stream paths without emitting user-visible content. Metadata attributes carry control instructions to consumers that understand MADA's internal stream protocol.
InternalError
Bases: str
Empty stream chunk that signals an internal terminal error condition.
Source code in src/mada/core/orchestration/stream_events.py
InternalResponseReplacement
Bases: str
Empty stream chunk that replaces previously collected response text.
Source code in src/mada/core/orchestration/stream_events.py
InternalToolCallSignal
Bases: str
Empty stream chunk that carries background-detach metadata.
Source code in src/mada/core/orchestration/stream_events.py
apply_text_control(chunks, chunk)
Apply replacement/error controls to a text accumulator.
Returns:
| Type | Description |
|---|---|
bool
|
A pair of booleans: whether the chunk was a control chunk, and whether |
bool
|
collection should stop because the control chunk was terminal. |
Source code in src/mada/core/orchestration/stream_events.py
error_message(chunk)
Return terminal error text carried by a stream chunk, if present.
response_replacement(chunk)
Return replacement text carried by a stream chunk, if present.
Source code in src/mada/core/orchestration/stream_events.py
tool_call_name(chunk)
Return the internal tool-call name carried by a stream chunk, if present.