MCPcopy Index your code
hub / github.com/google/adk-python / _enqueue_event

Method _enqueue_event

src/google/adk/workflow/_node_runner.py:319–339  ·  view source on GitHub ↗

Enrich and enqueue event to the session. Suppresses output if output is delegated via use_as_output (since the child already emitted it), but preserves other event details. Pending deltas stay in ctx for _flush_output_and_deltas.

(self, event: Event, ctx: Context)

Source from the content-addressed store, hash-verified

317 _validate_state_entry(ctx.state._schema, key, value)
318
319 async def _enqueue_event(self, event: Event, ctx: Context) -> None:
320 """Enrich and enqueue event to the session.
321
322 Suppresses output if output is delegated via use_as_output (since the child
323 already emitted it), but preserves other event details. Pending deltas stay
324 in ctx for _flush_output_and_deltas.
325 """
326 if event.output is not None and ctx._output_delegated:
327 if not _has_non_output_content(event):
328 return
329 event = event.model_copy(update={"output": None})
330
331 self._enrich_event(event, ctx)
332 if not event.partial:
333 self._flush_deltas(event, ctx)
334 await ctx._invocation_context._enqueue_event(event)
335
336 if event.output is not None:
337 ctx._output_emitted = True
338 if event.node_info.message_as_output:
339 ctx._output_delegated = True
340
341 async def _flush_output_and_deltas(self, ctx: Context) -> None:
342 """Emit deferred output and/or unflushed state/artifact deltas."""

Calls 4

_enrich_eventMethod · 0.95
_flush_deltasMethod · 0.95
_has_non_output_contentFunction · 0.85
model_copyMethod · 0.45