Class: Google::ADK::EventActions

Inherits:
Object
  • Object
show all
Defined in:
lib/google/adk/events.rb

Overview

Manages agent actions and state changes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state_delta: {}, agent_state: nil, artifact_delta: {}, transfer_to_agent: nil, escalate: false, skip_summarization: false, end_of_agent: false, requested_auth_configs: nil, requested_tool_confirmations: nil, rewind_before_invocation_id: nil, compaction: nil) ⇒ EventActions

Initialize event actions

Parameters:

  • state_delta (Hash) (defaults to: {})

    State changes (optional)

  • agent_state (Hash) (defaults to: nil)

    Agent-specific state (optional)

  • artifact_delta (Hash) (defaults to: {})

    Artifact changes (optional)

  • transfer_to_agent (String) (defaults to: nil)

    Agent to transfer to (optional)

  • escalate (Boolean) (defaults to: false)

    Whether to escalate to parent (optional)

  • skip_summarization (Boolean) (defaults to: false)

    Skip LLM summarization (optional)

  • end_of_agent (Boolean) (defaults to: false)

    End agent lifecycle (optional)



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/google/adk/events.rb', line 83

def initialize(state_delta: {}, agent_state: nil, artifact_delta: {},
               transfer_to_agent: nil, escalate: false,
               skip_summarization: false, end_of_agent: false,
               requested_auth_configs: nil, requested_tool_confirmations: nil,
               rewind_before_invocation_id: nil, compaction: nil)
  @state_delta = state_delta
  @agent_state = agent_state
  @artifact_delta = artifact_delta
  @transfer_to_agent = transfer_to_agent
  @escalate = escalate
  @skip_summarization = skip_summarization
  @end_of_agent = end_of_agent
  @requested_auth_configs = requested_auth_configs
  @requested_tool_confirmations = requested_tool_confirmations
  @rewind_before_invocation_id = rewind_before_invocation_id
  @compaction = compaction
end

Instance Attribute Details

#agent_stateObject

Returns the value of attribute agent_state.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def agent_state
  @agent_state
end

#artifact_deltaObject

Returns the value of attribute artifact_delta.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def artifact_delta
  @artifact_delta
end

#compactionObject

Returns the value of attribute compaction.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def compaction
  @compaction
end

#end_of_agentObject

Returns the value of attribute end_of_agent.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def end_of_agent
  @end_of_agent
end

#escalateObject

Returns the value of attribute escalate.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def escalate
  @escalate
end

#requested_auth_configsObject

Returns the value of attribute requested_auth_configs.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def requested_auth_configs
  @requested_auth_configs
end

#requested_tool_confirmationsObject

Returns the value of attribute requested_tool_confirmations.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def requested_tool_confirmations
  @requested_tool_confirmations
end

#rewind_before_invocation_idObject

Returns the value of attribute rewind_before_invocation_id.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def rewind_before_invocation_id
  @rewind_before_invocation_id
end

#skip_summarizationObject

Returns the value of attribute skip_summarization.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def skip_summarization
  @skip_summarization
end

#state_deltaObject

Returns the value of attribute state_delta.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def state_delta
  @state_delta
end

#transfer_to_agentObject

Returns the value of attribute transfer_to_agent.



68
69
70
# File 'lib/google/adk/events.rb', line 68

def transfer_to_agent
  @transfer_to_agent
end

Instance Method Details

#to_hHash

Convert to hash, excluding nil and empty values

Returns:

  • (Hash)

    Hash representation



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/google/adk/events.rb', line 104

def to_h
  result = {}
  result[:state_delta] = @state_delta unless @state_delta.empty?
  result[:agent_state] = @agent_state unless @agent_state.nil?
  result[:artifact_delta] = @artifact_delta unless @artifact_delta.empty?
  result[:transfer_to_agent] = @transfer_to_agent unless @transfer_to_agent.nil?
  result[:escalate] = @escalate if @escalate
  result[:skip_summarization] = @skip_summarization if @skip_summarization
  result[:end_of_agent] = @end_of_agent if @end_of_agent
  result[:requested_auth_configs] = @requested_auth_configs unless @requested_auth_configs.nil?
  result[:requested_tool_confirmations] = @requested_tool_confirmations unless @requested_tool_confirmations.nil?
  result[:rewind_before_invocation_id] = @rewind_before_invocation_id unless @rewind_before_invocation_id.nil?
  result[:compaction] = @compaction unless @compaction.nil?
  result
end