Represents an event in a conversation between agents and users. It is used to store the content of the conversation, as well as the actions taken by the agents like function calls, etc.
| 89 | |
| 90 | |
| 91 | class Event(LlmResponse): |
| 92 | """Represents an event in a conversation between agents and users. |
| 93 | |
| 94 | It is used to store the content of the conversation, as well as the actions |
| 95 | taken by the agents like function calls, etc. |
| 96 | """ |
| 97 | |
| 98 | model_config = ConfigDict( |
| 99 | extra='ignore', |
| 100 | ser_json_bytes='base64', |
| 101 | val_json_bytes='base64', |
| 102 | alias_generator=alias_generators.to_camel, |
| 103 | populate_by_name=True, |
| 104 | ) |
| 105 | """The pydantic model config.""" |
| 106 | |
| 107 | invocation_id: str = '' |
| 108 | """The invocation ID of the event. Should be non-empty before appending to a session.""" |
| 109 | author: str = '' |
| 110 | """'user' or the name of the agent, indicating who appended the event to the |
| 111 | session.""" |
| 112 | actions: EventActions = Field(default_factory=EventActions) |
| 113 | """The actions taken by the agent.""" |
| 114 | |
| 115 | output: Any | None = None |
| 116 | """Generic data output from a workflow node.""" |
| 117 | |
| 118 | node_info: NodeInfo = Field(default_factory=NodeInfo) |
| 119 | """Workflow node metadata (path, run_id, etc.).""" |
| 120 | |
| 121 | long_running_tool_ids: set[str] | None = None |
| 122 | """Set of ids of the long running function calls. |
| 123 | Agent client will know from this field about which function call is long running. |
| 124 | only valid for function call event |
| 125 | """ |
| 126 | branch: str | None = None |
| 127 | """The branch of the event. |
| 128 | |
| 129 | The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of |
| 130 | agent_2, and agent_2 is the parent of agent_3. |
| 131 | |
| 132 | Branch is used when multiple sub-agent shouldn't see their peer agents' |
| 133 | conversation history. |
| 134 | """ |
| 135 | isolation_scope: str | None = None |
| 136 | """Scope tag indicating which logical context this event belongs to. |
| 137 | |
| 138 | When set, the LLM content-builder restricts session events visible to |
| 139 | an agent to those whose ``isolation_scope`` matches the agent's own |
| 140 | scope. One usage today is the Task API: a delegated task agent is |
| 141 | scoped under the originating function-call id (``<fc_id>``) so it |
| 142 | sees only its own task's events, isolated from the chat |
| 143 | coordinator's broader conversation. |
| 144 | |
| 145 | ⚠️ DO NOT USE THIS FIELD DIRECTLY. It is an internal mechanism that |
| 146 | may change without notice. External code should not read, write, or |
| 147 | rely on its semantics. |
| 148 | """ |