Skip to content
Blog

The Event Object Explained: Parts, Actions, State Delta, and Metadata

A field-by-field tour of google.adk.events.Event: content parts, EventActions with state and artifact deltas, control signals, metadata, and is_final_response().

Published on • November 24, 2026

AI Assistant

Every message, tool call, tool result, state change, and control signal that moves through Google’s Agent Development Kit travels as one thing: an Event. If you can read an event stream, you can debug any ADK application — the session’s events list is the complete chronological record of an interaction, and the Runner you consume from run_async yields nothing else.

Technically an event is an instance of google.adk.events.Event, which builds on the basic LlmResponse structure by adding ADK-specific metadata and an actions payload. This post breaks that object into its four jobs: carrying content parts, signaling side effects through actions, persisting state via deltas, and identifying itself with metadata.

Anatomy of an Event

# Conceptual structure of an Event (Python)
# from google.adk.events import Event, EventActions
# from google.genai import types

# class Event(LlmResponse):            # Simplified view
#     content: Optional[types.Content]  # Parts: text, function_call, function_response
#     partial: Optional[bool]           # Is this a streaming chunk?
#     turn_complete: Optional[bool]     # Is the turn finished?
#
#     author: str                       # 'user' or an agent name
#     invocation_id: str                # ID for the whole interaction run
#     id: str                           # Unique ID for this specific event
#     timestamp: float                  # Creation time
#     actions: EventActions             # Side effects and control flow
#     branch: Optional[str]             # Hierarchy path in multi-agent trees
#     long_running_tool_ids: list[str]  # IDs of tools running in the background
#     # ... plus error_code / error_message inherited from LlmResponse

The split matters: content is what happened, actions is what should change, and the metadata is where it fits in history.

Parts: text, function calls, and results

event.content.parts holds google.genai.types.Part entries. ADK provides typed accessors so you do not dig through the structure by hand:

if event.content and event.content.parts:
    if event.get_function_calls():          # LLM wants tools executed
        for call in event.get_function_calls():
            print(f"  Tool: {call.name}, Args: {call.args}")
    elif event.get_function_responses():    # Tool results fed back to the LLM
        for resp in event.get_function_responses():
            print(f"  Result: {resp.name} -> {resp.response}")
    elif event.content.parts[0].text:       # Plain conversational text
        ...

One authorship subtlety trips people up: a tool-result event’s author is the agent that requested the call, while the role inside content is 'user' — that is the role the LLM sees in its history.

Actions: state, artifacts, and control flow

event.actions (an EventActions object) carries three kinds of signal:

FieldTypeMeaning
state_deltadict of {key: value}Session state changed by this step
artifact_deltadict of {filename: version}Artifacts saved and their new versions
transfer_to_agentstringControl passes to the named agent
escalateboolA loop should terminate
skip_summarizationboolDo not summarize this tool result for the LLM
if event.actions:
    if event.actions.state_delta:
        print(f"  State changes: {event.actions.state_delta}")
    if event.actions.transfer_to_agent:
        print(f"  Signal: transfer to {event.actions.transfer_to_agent}")
    if event.actions.escalate:
        print("  Signal: escalate (terminate loop)")

How a state change becomes persisted

When you mutate state through CallbackContext or ToolContext, nothing is written to storage at that moment. Instead the change populates state_delta inside EventActions, and that object attaches to the next event generated after the change. The SessionService.append_event method then reads the deltas from the incoming event and applies them to session.state — so every mutation is chronologically tied to an event.

That also explains the runtime’s commitment rule: code that runs after resuming from a yield can safely assume the delta on the yielded event was committed, while earlier reads in the same invocation may be “dirty reads.” In Python, temp:-prefixed keys are additionally scoped to a single invocation and discarded afterwards.

Metadata: correlating the stream

  • event.id — unique ID for this specific event instance.
  • event.invocation_id — ID for the entire user-request-to-final-response cycle; use it to correlate every event produced by one query.
  • event.timestamp — creation time (set when the event is constructed in Python).
  • event.branch — hierarchy path for nested multi-agent trees.
  • event.error_code / event.error_message — set when the event represents an error, e.g. "SAFETY_FILTER_TRIGGERED".

Knowing when a turn is complete

Do not hand-roll this logic: event.is_final_response() returns True when any of these hold — the skip_summarization action is set, long_running_tool_ids is non-empty (a is_long_running=True tool was called), or all of the following are true: no function calls, no function responses, partial is not True, and the event does not end with a code-execution result.

async for event in runner.run_async(user_id=..., session_id=..., new_message=...):
    if event.partial and event.content and event.content.parts:
        live_buffer += event.content.parts[0].text      # streaming chunk
    if event.is_final_response():
        print(f"Display: {event.content.parts[0].text}")

Pitfalls

  • Never treat a partial event as final. partial=True means more text follows; only the non-partial event completes the response — the mechanics are covered in streaming-tool-results-agent-loop.md.
  • Check before you index. Always test event.content and event.content.parts before reading parts[0].text; state-only events have content: null.
  • after_agent-style consumers should filter, not mutate. The framework owns authorship and IDs; custom BaseAgent subclasses should yield Event(author=self.name, ...).
  • Deltas are not idempotent by default. Re-processing a stored event re-applies its state_delta, so dedupe on event.id if your pipeline replays history.

Takeaway: An ADK Event is a small, disciplined envelope — content.parts for text and tool traffic, actions.state_delta/artifact_delta for side effects, transfer_to_agent/escalate/skip_summarization for control flow, and id/invocation_id/timestamp/branch for correlation — and once you internalize that content says what happened while actions says what changes, plus is_final_response() for the finish line, you can read any session history and know exactly what the agent did and why.

Sources