class Riffer::Agent::Response
Wraps an agent generation response. When a guardrail blocks execution, content is empty and tripwire carries the block details.
response = agent.generate("Hello") if response.blocked? puts "Blocked: #{response.tripwire.reason}" else puts response.content end
Attributes
The response content.
Call ids of tool_use blocks riffer filled with placeholder results this turn (when an interrupt left them unanswered and history healing is on).
The reason provided with the interrupt, if any.
The full message history from the agent conversation.
The modifications made by guardrails during processing.
The number of LLM calls made during this run (0 when a before-guardrail blocks before any call). Distinct from the session’s cumulative step count.
The parsed structured output, if structured output was configured.
The aggregate token usage across this run’s LLM calls, if any was reported.
The tripwire if execution was blocked.
Public Class Methods
Source
# File lib/riffer/agent/response.rb, line 47 def initialize(content, tripwire: nil, modifications: [], interrupted: false, interrupt_reason: nil, structured_output: nil, messages: [], healed_tool_call_ids: [], token_usage: nil, steps: 0) @content = content @tripwire = tripwire @modifications = modifications @interrupted = interrupted @interrupt_reason = interrupt_reason @structured_output = structured_output @messages = messages @healed_tool_call_ids = healed_tool_call_ids @token_usage = token_usage @steps = steps end
Public Instance Methods
Source
# File lib/riffer/agent/response.rb, line 64 def blocked? !tripwire.nil? end
Returns true if the response was blocked by a guardrail.
Source
# File lib/riffer/agent/response.rb, line 81 def interrupted? @interrupted end
Returns true if the agent loop was interrupted by a callback via throw :riffer_interrupt.
Source
# File lib/riffer/agent/response.rb, line 72 def modified? modifications.any? end
Returns true if any guardrail modified data during processing.