1515 */
1616package com .google .adk .events ;
1717
18+ import com .fasterxml .jackson .annotation .JsonInclude ;
1819import com .fasterxml .jackson .annotation .JsonProperty ;
1920import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
21+ import com .google .adk .agents .BaseAgentState ;
2022import com .google .errorprone .annotations .CanIgnoreReturnValue ;
2123import com .google .genai .types .Part ;
2224import java .util .Objects ;
@@ -37,8 +39,11 @@ public class EventActions {
3739 private Optional <Boolean > escalate ;
3840 private ConcurrentMap <String , ConcurrentMap <String , Object >> requestedAuthConfigs ;
3941 private ConcurrentMap <String , ToolConfirmation > requestedToolConfirmations ;
42+ private boolean endOfAgent ;
43+ private ConcurrentMap <String , BaseAgentState > agentState ;
4044 private Optional <Boolean > endInvocation ;
4145 private Optional <EventCompaction > compaction ;
46+ private Optional <String > rewindBeforeInvocationId ;
4247
4348 /** Default constructor for Jackson. */
4449 public EventActions () {
@@ -49,8 +54,11 @@ public EventActions() {
4954 this .escalate = Optional .empty ();
5055 this .requestedAuthConfigs = new ConcurrentHashMap <>();
5156 this .requestedToolConfirmations = new ConcurrentHashMap <>();
57+ this .endOfAgent = false ;
5258 this .endInvocation = Optional .empty ();
5359 this .compaction = Optional .empty ();
60+ this .agentState = new ConcurrentHashMap <>();
61+ this .rewindBeforeInvocationId = Optional .empty ();
5462 }
5563
5664 private EventActions (Builder builder ) {
@@ -61,8 +69,11 @@ private EventActions(Builder builder) {
6169 this .escalate = builder .escalate ;
6270 this .requestedAuthConfigs = builder .requestedAuthConfigs ;
6371 this .requestedToolConfirmations = builder .requestedToolConfirmations ;
72+ this .endOfAgent = builder .endOfAgent ;
6473 this .endInvocation = builder .endInvocation ;
6574 this .compaction = builder .compaction ;
75+ this .agentState = builder .agentState ;
76+ this .rewindBeforeInvocationId = builder .rewindBeforeInvocationId ;
6677 }
6778
6879 @ JsonProperty ("skipSummarization" )
@@ -146,6 +157,16 @@ public void setRequestedToolConfirmations(
146157 this .requestedToolConfirmations = requestedToolConfirmations ;
147158 }
148159
160+ @ JsonProperty ("endOfAgent" )
161+ @ JsonInclude (JsonInclude .Include .NON_DEFAULT )
162+ public boolean endOfAgent () {
163+ return endOfAgent ;
164+ }
165+
166+ public void setEndOfAgent (boolean endOfAgent ) {
167+ this .endOfAgent = endOfAgent ;
168+ }
169+
149170 @ JsonProperty ("endInvocation" )
150171 public Optional <Boolean > endInvocation () {
151172 return endInvocation ;
@@ -168,6 +189,25 @@ public void setCompaction(Optional<EventCompaction> compaction) {
168189 this .compaction = compaction ;
169190 }
170191
192+ @ JsonProperty ("agentState" )
193+ @ JsonInclude (JsonInclude .Include .NON_EMPTY )
194+ public ConcurrentMap <String , BaseAgentState > agentState () {
195+ return agentState ;
196+ }
197+
198+ public void setAgentState (ConcurrentMap <String , BaseAgentState > agentState ) {
199+ this .agentState = agentState ;
200+ }
201+
202+ @ JsonProperty ("rewindBeforeInvocationId" )
203+ public Optional <String > rewindBeforeInvocationId () {
204+ return rewindBeforeInvocationId ;
205+ }
206+
207+ public void setRewindBeforeInvocationId (@ Nullable String rewindBeforeInvocationId ) {
208+ this .rewindBeforeInvocationId = Optional .ofNullable (rewindBeforeInvocationId );
209+ }
210+
171211 public static Builder builder () {
172212 return new Builder ();
173213 }
@@ -191,8 +231,11 @@ public boolean equals(Object o) {
191231 && Objects .equals (escalate , that .escalate )
192232 && Objects .equals (requestedAuthConfigs , that .requestedAuthConfigs )
193233 && Objects .equals (requestedToolConfirmations , that .requestedToolConfirmations )
234+ && (endOfAgent == that .endOfAgent )
194235 && Objects .equals (endInvocation , that .endInvocation )
195- && Objects .equals (compaction , that .compaction );
236+ && Objects .equals (compaction , that .compaction )
237+ && Objects .equals (agentState , that .agentState )
238+ && Objects .equals (rewindBeforeInvocationId , that .rewindBeforeInvocationId );
196239 }
197240
198241 @ Override
@@ -205,8 +248,11 @@ public int hashCode() {
205248 escalate ,
206249 requestedAuthConfigs ,
207250 requestedToolConfirmations ,
251+ endOfAgent ,
208252 endInvocation ,
209- compaction );
253+ compaction ,
254+ agentState ,
255+ rewindBeforeInvocationId );
210256 }
211257
212258 /** Builder for {@link EventActions}. */
@@ -218,8 +264,11 @@ public static class Builder {
218264 private Optional <Boolean > escalate ;
219265 private ConcurrentMap <String , ConcurrentMap <String , Object >> requestedAuthConfigs ;
220266 private ConcurrentMap <String , ToolConfirmation > requestedToolConfirmations ;
267+ private boolean endOfAgent = false ;
221268 private Optional <Boolean > endInvocation ;
222269 private Optional <EventCompaction > compaction ;
270+ private ConcurrentMap <String , BaseAgentState > agentState ;
271+ private Optional <String > rewindBeforeInvocationId ;
223272
224273 public Builder () {
225274 this .skipSummarization = Optional .empty ();
@@ -231,6 +280,8 @@ public Builder() {
231280 this .requestedToolConfirmations = new ConcurrentHashMap <>();
232281 this .endInvocation = Optional .empty ();
233282 this .compaction = Optional .empty ();
283+ this .agentState = new ConcurrentHashMap <>();
284+ this .rewindBeforeInvocationId = Optional .empty ();
234285 }
235286
236287 private Builder (EventActions eventActions ) {
@@ -242,8 +293,11 @@ private Builder(EventActions eventActions) {
242293 this .requestedAuthConfigs = new ConcurrentHashMap <>(eventActions .requestedAuthConfigs ());
243294 this .requestedToolConfirmations =
244295 new ConcurrentHashMap <>(eventActions .requestedToolConfirmations ());
296+ this .endOfAgent = eventActions .endOfAgent ();
245297 this .endInvocation = eventActions .endInvocation ();
246298 this .compaction = eventActions .compaction ();
299+ this .agentState = new ConcurrentHashMap <>(eventActions .agentState ());
300+ this .rewindBeforeInvocationId = eventActions .rewindBeforeInvocationId ();
247301 }
248302
249303 @ CanIgnoreReturnValue
@@ -296,6 +350,13 @@ public Builder requestedToolConfirmations(ConcurrentMap<String, ToolConfirmation
296350 return this ;
297351 }
298352
353+ @ CanIgnoreReturnValue
354+ @ JsonProperty ("endOfAgent" )
355+ public Builder endOfAgent (boolean endOfAgent ) {
356+ this .endOfAgent = endOfAgent ;
357+ return this ;
358+ }
359+
299360 @ CanIgnoreReturnValue
300361 @ JsonProperty ("endInvocation" )
301362 public Builder endInvocation (boolean endInvocation ) {
@@ -310,6 +371,20 @@ public Builder compaction(EventCompaction value) {
310371 return this ;
311372 }
312373
374+ @ CanIgnoreReturnValue
375+ @ JsonProperty ("agentState" )
376+ public Builder agentState (ConcurrentMap <String , BaseAgentState > agentState ) {
377+ this .agentState = agentState ;
378+ return this ;
379+ }
380+
381+ @ CanIgnoreReturnValue
382+ @ JsonProperty ("rewindBeforeInvocationId" )
383+ public Builder rewindBeforeInvocationId (String rewindBeforeInvocationId ) {
384+ this .rewindBeforeInvocationId = Optional .ofNullable (rewindBeforeInvocationId );
385+ return this ;
386+ }
387+
313388 @ CanIgnoreReturnValue
314389 public Builder merge (EventActions other ) {
315390 other .skipSummarization ().ifPresent (this ::skipSummarization );
@@ -319,8 +394,11 @@ public Builder merge(EventActions other) {
319394 other .escalate ().ifPresent (this ::escalate );
320395 this .requestedAuthConfigs .putAll (other .requestedAuthConfigs ());
321396 this .requestedToolConfirmations .putAll (other .requestedToolConfirmations ());
397+ this .endOfAgent = other .endOfAgent ();
322398 other .endInvocation ().ifPresent (this ::endInvocation );
323399 other .compaction ().ifPresent (this ::compaction );
400+ this .agentState .putAll (other .agentState ());
401+ other .rewindBeforeInvocationId ().ifPresent (this ::rewindBeforeInvocationId );
324402 return this ;
325403 }
326404
0 commit comments