MCPcopy Index your code
hub / github.com/langchain-ai/deepagents / StreamState

Class StreamState

libs/code/deepagents_code/non_interactive.py:234–282  ·  view source on GitHub ↗

Mutable state accumulated while iterating over the agent stream.

Source from the content-addressed store, hash-verified

232
233@dataclass
234class StreamState:
235 """Mutable state accumulated while iterating over the agent stream."""
236
237 quiet: bool = False
238 """When `True`, stream-time diagnostics (the tool-call and file-operation
239 notifications, plus the stdout separator newline preceding a tool call) are
240 suppressed, so stdout carries only agent response text."""
241
242 stream: bool = True
243 """When `True` (default), text chunks are written to stdout as they arrive.
244
245 When `False`, text is buffered in `full_response` and flushed after the
246 agent finishes.
247 """
248
249 full_response: list[str] = field(default_factory=list)
250 """Accumulated text fragments from the AI message stream."""
251
252 tool_call_buffers: dict[int | str, dict[str, str | None]] = field(
253 default_factory=dict
254 )
255 """Maps a tool-call index or ID to its name/ID metadata for in-progress
256 tool calls."""
257
258 pending_interrupts: dict[str, HITLRequest] = field(default_factory=dict)
259 """Maps interrupt IDs to their validated HITL requests that are awaiting
260 decisions."""
261
262 hitl_response: dict[str, dict[str, list[dict[str, str]]]] = field(
263 default_factory=dict
264 )
265 """Maps interrupt IDs to dicts containing a `'decisions'` key with a list of
266 decision dicts (each having a `'type'` key of `'approve'` or `'reject'`).
267
268 Used to resume the agent after HITL processing.
269 """
270
271 interrupt_occurred: bool = False
272 """Flag indicating whether any HITL interrupt was received during the
273 current stream pass."""
274
275 stats: SessionStats = field(default_factory=SessionStats)
276 """Accumulated model usage stats for this stream."""
277
278 spinner: _ConsoleSpinner | None = None
279 """Optional animated spinner shown during agent work in verbose mode."""
280
281 show_rubric_iterations: bool = False
282 """Whether rubric lifecycle messages should include iteration numbers."""
283
284
285@dataclass

Callers 5

_runMethod · 0.90
_render_eventFunction · 0.90
_run_agent_loopFunction · 0.85

Calls

no outgoing calls

Tested by 4

_runMethod · 0.72
_render_eventFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…