---
id: "concept-structured-streaming-events"
type: "concept"
source_timestamps: ["00:13:56"]
tags: ["observability", "llm-streaming"]
related: ["concept-dual-logging-system-events", "contrarian-streaming-is-state"]
definition: "Using LLM streaming to emit typed, structured data events that reveal the agent's internal state and tool usage in real-time."
sources: ["s46-anthropic-25b-leak"]
sourceVaultSlug: "s46-anthropic-25b-leak"
originDay: 46
---
# Structured Streaming Events

## Definition
Using LLM streaming to emit **typed, structured data events** that reveal the agent's internal state and tool usage in real-time — not just printed text.

## The Conventional View vs. The Production View
The conventional view of LLM streaming is simply printing text to a UI as it generates (the typewriter effect). Nate argues this is **insufficient for agents**.

[[entity-claude-code-d46|Claude Code]] uses streaming to emit **structured, typed events** that communicate the model's internal state. Every streaming event is an opportunity to understand:

- **what tools** the model is considering
- **how many tokens** it has consumed
- **whether it is wrapping up**

## Example Event Types
- `message_start`
- `command_match`
- `tool_match`

## Why It Matters
By emitting these typed events, the backend can monitor the agent's chain of thought in real time. Developers can:

- intervene if the model goes off track
- inject corrective messages
- halt execution based on real-time state rather than waiting for the final output

## Contrarian Framing
Fully developed in [[contrarian-streaming-is-state]] — *streaming is for state, not just text.*

## Pairs With
[[concept-dual-logging-system-events]] — streaming events capture model thought; system event logs capture operational reality. Together they form two-channel ground truth.

## Validation (Enrichment)
Strongly validated. Guardrails AI rebuilt streaming around structured validation events (e.g., per-chunk PII checks). Counter-perspective: structured streaming adds backend complexity and can introduce >20ms state-sync overhead, so trade-offs exist.
