Harness

RubyLLM

Guard RubyLLM tools with run.ruby_llm and give the model the human tools as RubyLLM tool classes.

Ruby only. The adapter guards a tool's execute. It has no runtime dependency on the ruby_llm gem: anything with execute(**args) works.

app/agents/support_agent.rbruby
class RefundInvoice < RubyLLM::Tool  description "Refund an invoice"  param :invoice_id, desc: "The invoice id"  param :amount, type: "number", desc: "Amount to refund"  def execute(invoice_id:, amount:)    { refunded: invoice_id, amount: amount }  endendharness = Scute::Harness.new(  agent: "support-bot",  guards: [Scute::Guards.approval, Scute::Guards.grounding, Scute::Guards.permissions],  tools: { refund_invoice: { tier: :high } })run = harness.run(id: conversation.id, acts_for: user.scute_id, task: { actions: %w[invoice:read invoice:refund] })chat = RubyLLM.chatchat.with_tool(run.ruby_llm(RefundInvoice, chat: chat))chat.with_tools(*run.ruby_llm_human_tools)chat.ask("Refund INV-1, 90 dollars")

run.ruby_llm(tool, chat: nil)#

Takes a tool class (instantiated with new) or an instance, and returns the instance with its execute guarded:

  • The tool name is the instance's name, or the class name in snake case (RefundInvoice becomes refund_invoice). It maps to a permission like any other tool name.
  • Each call is checked with run.check. Pass chat: so grounding reads chat.messages.
  • When the call does not run, execute returns { error: verdict.message } to the model.
  • When it runs, the original execute gets the arguments after any transform, and the result goes through the after-guards.
  • The name is added to run.tool_names, which run.allowed_tools uses.

run.ruby_llm_human_tools(methods:)#

Returns scute_verify_person, scute_submit_code, scute_check_verification, scute_approval_status and scute_whoami as RubyLLM::Tool instances. It raises Scute::ConfigurationError when ruby_llm is not loaded. methods: sets the verification methods the model may pick (default email_otp, sms_otp, totp, entra_push). See human tools.

For other Ruby frameworks, run.human_tools returns the same tools as plain data: { name => { description:, parameters:, call: ->(args) } }.