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 parsed structured output, if structured output was configured.
The tripwire if execution was blocked.
Public Class Methods
Source
# File lib/riffer/agent/response.rb, line 40 def initialize(content, tripwire: nil, modifications: [], interrupted: false, interrupt_reason: nil, structured_output: nil, messages: [], healed_tool_call_ids: []) @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 end
Public Instance Methods
Source
# File lib/riffer/agent/response.rb, line 55 def blocked? !tripwire.nil? end
Returns true if the response was blocked by a guardrail.
Source
# File lib/riffer/agent/response.rb, line 72 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 63 def modified? modifications.any? end
Returns true if any guardrail modified data during processing.