Ruby SDK

Ruby SDK

The scute gem verifies access tokens, manages users and sessions, runs authorization checks and guards the agents you build.

The scute gem is for your Ruby backend. It verifies the access tokens your frontend sends, manages the app's users and sessions with the app's secret key, asks Scute's engine whether a user may do something, and wraps your agents' tool calls in guards.

What it covers#

AreaEntry point
Token verification (local, RS256, the app's JWKS)scute.tokens.verify
Users, support access, previous accountsscute.users
Sessions: current user, refresh, sign out, list, revokescute.sessions
Checks, batch checks, permissions, data filters, step-up, the signed policy snapshot, access requestsscute.authz
Agent registration and tasksscute.agents
Guards around an agent's tool callsScute::Harness, Scute::Guards
Controller concerns for Rails or any Rack appScute::Authentication, Scute::Authorization
The end user's IP address on secret-key callsScute::ClientIP, Scute::ClientIP::Middleware
RubyLLM toolsrun.ruby_llm, run.ruby_llm_human_tools

Requirements#

  • Ruby 3.2 or later (CI runs 3.2, 3.3 and 3.4).
  • No runtime dependencies. The gem uses net/http, json and openssl from the standard library.
  • Rails is optional. The concerns work with any object that has a request method returning a Rails or Rack request.
  • The RubyLLM adapter does not depend on the ruby_llm gem. Only run.ruby_llm_human_tools needs ruby_llm loaded.

Install#

The gem is not published on RubyGems. Install it from GitHub:

Gemfileruby
gem "scute", git: "https://github.com/scuteai/scute-ruby", branch: "main"
bundle install

The current version is 0.3.0 (Scute::VERSION).

Configure#

Set the app's credentials on the server. Never send SCUTE_SECRET to a browser or a mobile app.

.envbash
SCUTE_APP_ID=app_xxxSCUTE_SECRET=your_app_secret
require "scute"scute = Scute::Client.new # reads SCUTE_APP_ID, SCUTE_SECRET and SCUTE_BASE_URLsession = scute.tokens.verify(token)session.user_id

SCUTE_BASE_URL is optional and defaults to https://api.scute.io. See Configuration for every option.

Next#

Quickstart
Protect a Rails controller with a Scute session.
Verify tokens
What tokens.verify checks and how it fails.
Authorization
Checks, permissions and data filters.
Harness
Guards around your agent's tool calls.