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#
| Area | Entry point |
|---|---|
| Token verification (local, RS256, the app's JWKS) | scute.tokens.verify |
| Users, support access, previous accounts | scute.users |
| Sessions: current user, refresh, sign out, list, revoke | scute.sessions |
| Checks, batch checks, permissions, data filters, step-up, the signed policy snapshot, access requests | scute.authz |
| Agent registration and tasks | scute.agents |
| Guards around an agent's tool calls | Scute::Harness, Scute::Guards |
| Controller concerns for Rails or any Rack app | Scute::Authentication, Scute::Authorization |
| The end user's IP address on secret-key calls | Scute::ClientIP, Scute::ClientIP::Middleware |
| RubyLLM tools | run.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 installThe 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_secretrequire "scute"scute = Scute::Client.new # reads SCUTE_APP_ID, SCUTE_SECRET and SCUTE_BASE_URLsession = scute.tokens.verify(token)session.user_idSCUTE_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.