Ruby SDK

Reference

Every public class and method in the scute gem, with signatures and defaults.

Methods marked "secret key" need SCUTE_SECRET. Hash answers are the API's JSON with string keys.

Scute::Client#

Scute::Client.new(app_id: ENV["SCUTE_APP_ID"], secret: ENV["SCUTE_SECRET"], base_url: ENV["SCUTE_BASE_URL"],                  transport: nil, client_ip: nil, open_timeout: 5, read_timeout: 10, retries: 1)
MemberReturns
app_id, client_ip, httpReaders
secret?true when a secret is set
with_client_ip(client_ip)A copy with another client IP
tokensScute::Tokens
usersScute::Users::API
sessionsScute::Sessions::API
authzScute::Authz::API
agentsScute::Agents::API

Scute::Tokens#

MethodReturns
verify(token, remote: false)Scute::Session; raises Scute::InvalidToken
public_app_idThe app's public id (app_...)

Constants: KEYS_TTL = 600, REFETCH_AFTER = 60, LEEWAY = 30, ALGORITHMS = %w[RS256].

Scute::Session#

Data with user_id, app_id, workspace_id, expires_at, actor, claims. Methods: impersonated?, authz_context.

Scute::Users::API (secret key)#

MethodReturns
list(**params)Hash
get(id)Hash
find_by_identifier(identifier)Hash or nil
create(identifier, meta: nil)Hash
invite(identifier, meta: nil)Hash
update(id, **attributes)Hash
activate(id), deactivate(id), delete(id)Hash
previous_accounts(id)Array
merge(id, from:)Hash
impersonate(id, reason:, minutes: nil, actor_user_id: nil, actor: nil, challenge: nil, approval: nil)Hash
impersonations(id)Array
stop_impersonating(id, session_id: nil)Hash

Scute::Sessions::API#

MethodCredential
current_user(access_token)user's token
refresh(refresh_token)user's refresh token
sign_out(access_token)user's token
list(user_id)secret key
revoke(user_id, session_id)secret key

Scute::Authz::API (secret key)#

MethodReturns
check(user_id:, action:, resource: nil, context: nil, challenge: nil, approval: nil)Scute::Authz::Decision
check_batch(checks)Array of decisions (at most BATCH_LIMIT = 100)
permissions(user_id, resource: nil)Hash
authorized_users(action:, resource: nil, limit: nil, offset: nil)Hash
filter(user_id:, action:, resource_type:, context: nil)Hash with filter
start_step_up(user_id:, decision: nil, permission: nil, method: nil)The challenge Hash
snapshotHash with token, jwks, version
requests(status: nil, user_id: nil)Array
create_request(user_id, role: nil, action: nil, resource: nil, duration: nil, reason: nil)Hash
decide_request(id, verdict, reviewer_id: nil, note: nil)Hash

Scute::Authz::Decision#

Data with decision, reason, permission, roles, path, conditions, step_up, approval, agent, explanation, say. Predicates: allowed?, denied?, step_up?, needs_approval?. Decision.from_api(hash) builds one from an API answer.

Scute::Agents::API (secret key)#

MethodReturns
listArray
get(slug)Hash
create(slug:, owner_user_id:, name: nil, description: nil, roles: nil, team_role: nil, settings: nil)Hash
update(slug, **attrs)Hash
delete(slug)Hash
suspend(slug), resume(slug)Hash
tasks(slug, status: nil)Array
start_task(slug, acts_for: nil, actions: nil, resources: nil, requester: nil, ttl: nil, ref: nil, parent_task_id: nil)Hash with token
complete_task(slug, id), revoke_task(slug, id)Hash
assertion(slug, id)Hash with assertion

Scute::Authentication#

scute_authenticate!(remote: false), scute_session, scute_signed_in?, scute_user_id, scute_access_token, scute_client, scute_client_ip.

Scute::Authorization#

scute_authorize!(action, resource = nil, context: nil, challenge: nil, approval: nil), scute_can?(action, resource = nil, context: nil), scute_user_id, scute_client, scute_client_ip.

Scute::ClientIP#

HEADER, parse(value), parse!(value), with(value) { }, current, from_request(request), from_env(env), and Scute::ClientIP::Middleware.new(app).

Scute::Harness#

Scute::Harness.new(agent:, guards: nil, tools: {}, mode: :enforce, default_tier: :low, store: nil, client: nil,                   on_decision: nil, on_alert: nil, **client_options)
MemberReturns
agent, mode, guards, store, clientReaders
run(id: nil, acts_for: nil, task: {}, requester: nil, parent: nil, token: nil, session: {}, context: {})Scute::Harness::Run
spec(tool)Scute::Harness::ToolSpec

Stores: Scute::Harness::MemoryStore.new, Scute::Harness::CacheStore.new(cache). Both have get(key) and set(key, value, ttl = nil).

Scute::Harness::Run#

MethodReturns
id, harness, tool_namesReaders
token, task_id, whoamiThe task token, task id, task details
check(tool, args = {}, id: nil, messages: [], approved_by_user: false)Verdict (kind, decision, args, message, say, results, call_id, tool, runs?)
after(tool, args, result, id: nil, messages: [])What the model should see
wrap(tool, &block)A lambda that checks, runs the block with the arguments, and returns the result or a message
ruby_llm(tool, chat: nil)The guarded tool instance
ruby_llm_human_tools(methods: HumanTools::METHODS)Array of RubyLLM::Tool
human_tools(methods: HumanTools::METHODS)Hash of callables
start_verification(verdict: nil, method: nil, permission: nil)Hash
submit_code(code, challenge_token = nil)Hash
verification_status(challenge_token = nil)Hash
complete_verification(challenge_token = nil)Records a finished verification
approval_status(id)Hash
confirm(tool, args)Records the person's confirmation
request_plan(calls, reason: nil), plan_statusHash
preview(tool, args = {})Scute::Authz::Decision
report_tools(definitions)Hash with known, new, changed
property(name)The secret's value
sign(name, claims: nil, data: nil)Hash with jws or signature
session, verified_atThe run's session id, last verification time
ground(*values), identify(*values), identities, grounded_valuesGrounding and requester values
record_usage(usd: 0), budget_exhausted?, allowed_tools(names = tool_names)Budgets and tools
snapshotWhat the run remembers, tokens masked
complete!, revoke!Ends the task

Scute::Harness::HumanTools::METHODS is %w[email_otp sms_otp totp entra_push].

Scute::Guards#

permissions(**), verify_person(**), approval(**), requester_only(**), grounding(**), args(rules, **), budget(**), content(**), decoy(tools, **), define(name, mode: nil, after: nil, &before). Keyword arguments are on Harness.

Errors#

Scute::Error, Scute::APIError, Scute::ConnectionError, Scute::ConfigurationError, Scute::InvalidToken, Scute::Unauthenticated, Scute::Forbidden. See Errors.