MCPcopy Create free account
hub / github.com/google/adk-python / _flush_deltas

Method _flush_deltas

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

Move pending state/artifact deltas from ctx onto the event. TODO: Handle non-persisted states (e.g. `temp:` prefixed keys) that should flow through ctx but not be written to session events.

(self, event: Event, ctx: Context)

Source from the content-addressed store, hash-verified

379 ctx._route_emitted = True
380
381 def _flush_deltas(self, event: Event, ctx: Context) -> None:
382 """Move pending state/artifact deltas from ctx onto the event.
383
384 TODO: Handle non-persisted states (e.g. `temp:` prefixed keys)
385 that should flow through ctx but not be written to session events.
386 """
387 from ..events.event_actions import EventActions
388
389 state_delta = ctx.actions.state_delta
390 artifact_delta = ctx.actions.artifact_delta
391 if not state_delta and not artifact_delta:
392 return
393
394 if not event.actions:
395 event.actions = EventActions()
396 if state_delta:
397 event.actions.state_delta.update(state_delta)
398 state_delta.clear()
399 if artifact_delta:
400 event.actions.artifact_delta.update(artifact_delta)
401 artifact_delta.clear()
402
403 def _enrich_event(self, event: Event, ctx: Context) -> None:
404 """Set author, node_info, invocation_id on the event."""

Callers 1

_enqueue_eventMethod · 0.95

Calls 3

EventActionsClass · 0.85
updateMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected