Class: ClaudeAgentSDK::ResultMessage
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Result message with cost and usage information
Instance Attribute Summary collapse
-
#api_error_status ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#deferred_tool_use ⇒ Object
DeferredToolUse, populated when a PreToolUse hook deferred.
-
#duration_api_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#duration_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#errors ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#fast_mode_state ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#is_error ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#model_usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#num_turns ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#origin ⇒ Hash{Symbol => Object}?
Provenance of the user message that triggered this turn —
nilwhen the CLI did not attribute it. -
#permission_denials ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#result ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#session_id ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#stop_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#structured_output ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#subtype ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#terminal_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#total_cost_usd ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
-
#uuid ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
Method Summary
Methods inherited from Type
#[], #[]=, from_hash, #initialize, #to_h, wrap
Constructor Details
This class inherits a constructor from ClaudeAgentSDK::Type
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ClaudeAgentSDK::Type
Instance Attribute Details
#api_error_status ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def api_error_status @api_error_status end |
#deferred_tool_use ⇒ Object
DeferredToolUse, populated when a PreToolUse hook deferred
498 499 500 |
# File 'lib/claude_agent_sdk/types.rb', line 498 def deferred_tool_use @deferred_tool_use end |
#duration_api_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def duration_api_ms @duration_api_ms end |
#duration_ms ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def duration_ms @duration_ms end |
#errors ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def errors @errors end |
#fast_mode_state ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def fast_mode_state @fast_mode_state end |
#is_error ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def is_error @is_error end |
#model_usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def model_usage @model_usage end |
#num_turns ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def num_turns @num_turns end |
#origin ⇒ Hash{Symbol => Object}?
Provenance of the user message that triggered this turn — nil when the
CLI did not attribute it. Lets a streaming-input consumer distinguish the
result of its own prompt from the result of a turn the session injected
on its own:
if result.origin.nil? || result.origin[:kind] == 'human'
# a turn this application submitted
elsif result.origin[:kind] == 'task-notification'
# follow-up turn driven by a background task
end
Key form. A plain Hash passed through from the CLI untouched, so its
keys are Symbols with the wire spelling preserved — camelCase stays
camelCase (origin[:kind], origin[:fromSession],
origin[:verifiedPeerPid]), unlike the snake_case attributes elsewhere
in this SDK and unlike the Python SDK's string keys. Indexing with
origin["kind"] silently returns nil and makes every attributed turn
look unattributed.
See UserMessage#origin for the full list of known :kind values and
their per-kind keys.
528 529 530 |
# File 'lib/claude_agent_sdk/types.rb', line 528 def origin @origin end |
#permission_denials ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def @permission_denials end |
#result ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def result @result end |
#session_id ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def session_id @session_id end |
#stop_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def stop_reason @stop_reason end |
#structured_output ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def structured_output @structured_output end |
#subtype ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def subtype @subtype end |
#terminal_reason ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def terminal_reason @terminal_reason end |
#total_cost_usd ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def total_cost_usd @total_cost_usd end |
#usage ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def usage @usage end |
#uuid ⇒ Object
model_usage maps model name => per-model usage Hash, passed through verbatim from the CLI's modelUsage field, so its keys are camelCase (matches the TypeScript/Python SDKs' ModelUsage shape): inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens, webSearchRequests, costUSD, contextWindow, maxOutputTokens, plus optional canonicalModel (canonical id used for the pricing lookup — may differ from the raw model-string key for provider-specific ids/aliases) and provider ('firstParty', 'bedrock', 'vertex', ...).
terminal_reason says why the query loop ended ("completed", "max_turns", "aborted_streaming", ...). "aborted_streaming" / "aborted_tools" mean the turn was cancelled via Client#interrupt (an interrupt control request). nil when the CLI did not report one (older CLI versions, or a result that bypassed the query loop such as a local slash command).
487 488 489 |
# File 'lib/claude_agent_sdk/types.rb', line 487 def uuid @uuid end |