Ruby SDK

RubyLLM adapter

Guard RubyLLM tools with a harness run and give the model tools to verify the person and check approvals.

The adapter guards a RubyLLM tool's execute. It has no dependency on the ruby_llm gem: any object with execute(**args) works.

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:)    Billing.refund(invoice_id: invoice_id, amount: amount)  endendrun = harness.run(id: conversation.id, acts_for: user.scute_id)chat = RubyLLM.chatchat.with_tool(run.ruby_llm(RefundInvoice, chat: chat))chat.ask("Refund INV-1 for 90")

run.ruby_llm#

run.ruby_llm(tool, chat: nil) takes a tool class or instance and returns the instance with a guarded execute:

  1. The guards check the call (run.check) with the chat's messages.
  2. When the call may not run, execute returns { error: message } for the model and your code is not called.
  3. When it runs, your execute gets the arguments after any guard's transform, and the result passes through the after-guards (run.after), which can redact it.
ArgumentMeaning
toolA class (instantiated with new) or an instance.
chat:The RubyLLM chat. Pass it so Scute::Guards.grounding sees the conversation (chat.messages).

The tool name is the instance's name when it has one, otherwise the class name in snake case (Tools::RefundInvoice becomes refund_invoice). The name decides the permission: refund_invoice needs invoice:refund.

run.ruby_llm_human_tools#

run.ruby_llm_human_tools(methods: %w[email_otp sms_otp totp entra_push]) returns RubyLLM::Tool instances that let the model bring the person in. It needs the ruby_llm gem loaded; without it, it raises Scute::ConfigurationError.

chat.with_tools(*run.ruby_llm_human_tools)
ToolParametersDoes
scute_verify_personmethod (optional, one of methods)Sends the person a code or a request.
scute_submit_codecode (required)Passes on the code the person read out.
scute_check_verificationnoneChecks a push or a link.
scute_approval_statusid (required)Checks a reviewer approval.
scute_whoaminoneWho the task is for, what it allows, how long it has left.

Every answer has a say line the agent can speak as is.

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

Tool drift#

Report the tools the model sees so Scute notices when one changes:

tools = [RefundInvoice.new]run.report_tools(tools.map { |t| { name: t.name, description: t.description, input_schema: t.params_schema } })

Only a SHA-256 hash of each definition leaves your process. The first report is the baseline. The answer has known, new and changed.