NAME

Claude::Agent::Message::Result - Result message type

DESCRIPTION

Represents the final result of a turn.

ATTRIBUTES

type

Always result.

subtype

success, error_max_turns, error_during_execution, error_max_budget_usd or error_max_structured_output_retries.

result

The final result text (success).

is_error

True for an error result. A JSON boolean decodes to a JSON::PP::Boolean, so test it for truth.

duration_ms

Total duration in milliseconds.

duration_api_ms

Time spent in API calls, in milliseconds.

num_turns

Number of conversation turns.

total_cost_usd

Estimated cost in USD.

usage

Token usage statistics for the main conversation.

model_usage

Per-model usage breakdown, sent by the CLI as modelUsage.

permission_denials

Array of the tool uses that were denied during the turn.

structured_output

Parsed structured output when output_format was given.

tool_use_result

Tool use result data.

stop_reason

The API stop reason of the last assistant message.

errors

Array of error strings (error subtypes).

terminal_reason

Why the turn ended, when the CLI says (for example after an interrupt).

api_error_status

HTTP status of a failing API call.

user_message_uuid

The uuid of the prompt this result answers; the value rewind_files takes.

uuid, session_id, parent_tool_use_id, agent_id, raw

See Claude::Agent::Message::Base.

METHODS

new

Takes a flat list of name/value pairs. Unknown names are ignored.

is_success

if ($result->is_success) { ... }

True when the subtype is success.

error_text

my $why = $result->error_text;

The errors joined with ; , else the result text, else the subtype.

AUTHOR

LNATION, <email at lnation.org>

LICENSE

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under The Artistic License 2.0 (GPL Compatible).