ec2b666284
Continuous Integration / Pre-commit Linter (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.10) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.11) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.12) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.10) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.11) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.12) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.14) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Waiting to run
Copybara PR Handler / close-imported-pr (push) Waiting to run
1.9 KiB
1.9 KiB
Event
The Event class represents a single event in the conversation history or workflow execution in the ADK. It is the core data structure used for state reconstruction, communication, and persistence.
Purpose
- Stores conversation content between users and agents.
- Captures actions taken by agents (e.g., function calls, function responses, state updates).
- Holds metadata for workflow nodes, such as execution paths and run IDs.
Key Fields
invocation_id: The ID of the invocation this event belongs to. Non-empty before appending to a session.author: 'user' or the name of the agent, indicating who created the event.content: The actual content of the message (text, parts, etc.), inheriting fromLlmResponse.actions:EventActionscontaining function calls, responses, or state changes.output: Generic data output from a workflow node.node_info:NodeInfocontaining the execution path in the workflow (e.g., "A/B").branch: Used for branch-aware isolation when peer sub-agents shouldn't see each other's history.id: Unique identifier for the event.timestamp: The timestamp of the event.
Methods of Interest
get_function_calls(): Returns function calls in the event.get_function_responses(): Returns function responses in the event.is_final_response(): Returns whether the event is the final response of an agent.
State Lifecycle & Immutability
- Event Immutability: Event history is immutable. Never assume that events are mutated or cleared after they are saved to a session.
- Signal & Action Persistence: When checking if a signal or action is "pending" versus "resolved", do not rely on events being modified in place.
- Compaction Side-Effects: Be aware that storing stateful flags on events (such as requested actions or transient status) can have permanent unintended effects on background compaction when those events age but remain in history.