Class: ClaudeAgentSDK::ResultMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_agent_sdk/types.rb

Overview

Result message with cost and usage information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subtype:, duration_ms:, duration_api_ms:, is_error:, num_turns:, session_id:, stop_reason: nil, total_cost_usd: nil, usage: nil, result: nil, structured_output: nil, model_usage: nil, permission_denials: nil, errors: nil, uuid: nil, fast_mode_state: nil) ⇒ ResultMessage

Returns a new instance of ResultMessage.



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/claude_agent_sdk/types.rb', line 450

def initialize(subtype:, duration_ms:, duration_api_ms:, is_error:,
               num_turns:, session_id:, stop_reason: nil, total_cost_usd: nil,
               usage: nil, result: nil, structured_output: nil,
               model_usage: nil, permission_denials: nil, errors: nil,
               uuid: nil, fast_mode_state: nil)
  @subtype = subtype
  @duration_ms = duration_ms
  @duration_api_ms = duration_api_ms
  @is_error = is_error
  @num_turns = num_turns
  @session_id = session_id
  @stop_reason = stop_reason
  @total_cost_usd = total_cost_usd
  @usage = usage
  @result = result
  @structured_output = structured_output
  @model_usage = model_usage # Hash of { model_name => usage_data }
  @permission_denials = permission_denials # Array of { tool_name:, tool_use_id:, tool_input: }
  @errors = errors # Array of error strings (present on error subtypes)
  @uuid = uuid
  @fast_mode_state = fast_mode_state # "off", "cooldown", or "on"
end

Instance Attribute Details

#duration_api_msObject

Returns the value of attribute duration_api_ms.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def duration_api_ms
  @duration_api_ms
end

#duration_msObject

Returns the value of attribute duration_ms.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def duration_ms
  @duration_ms
end

#errorsObject

Returns the value of attribute errors.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def errors
  @errors
end

#fast_mode_stateObject

Returns the value of attribute fast_mode_state.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def fast_mode_state
  @fast_mode_state
end

#is_errorObject

Returns the value of attribute is_error.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def is_error
  @is_error
end

#model_usageObject

Returns the value of attribute model_usage.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def model_usage
  @model_usage
end

#num_turnsObject

Returns the value of attribute num_turns.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def num_turns
  @num_turns
end

#permission_denialsObject

Returns the value of attribute permission_denials.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def permission_denials
  @permission_denials
end

#resultObject

Returns the value of attribute result.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def result
  @result
end

#session_idObject

Returns the value of attribute session_id.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def session_id
  @session_id
end

#stop_reasonObject

Returns the value of attribute stop_reason.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def stop_reason
  @stop_reason
end

#structured_outputObject

Returns the value of attribute structured_output.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def structured_output
  @structured_output
end

#subtypeObject

Returns the value of attribute subtype.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def subtype
  @subtype
end

#total_cost_usdObject

Returns the value of attribute total_cost_usd.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def total_cost_usd
  @total_cost_usd
end

#usageObject

Returns the value of attribute usage.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def usage
  @usage
end

#uuidObject

Returns the value of attribute uuid.



445
446
447
# File 'lib/claude_agent_sdk/types.rb', line 445

def uuid
  @uuid
end