typesafe-ai-rails
Community Rails integration for System One with configuration, persisted usage and cost telemetry, and fail-closed confidence policies.
Overview
typesafe-ai-rails adds Rails conventions on top of the community typesafe-sdk Ruby gem. It provides configuration through Rails credentials, a generator and migration, persisted usage and cost telemetry, and an opt-in confidence policy system for Choice and Score answers. ask sends all questions about one state in a single System One call, following TypeSafe's advice to batch questions that share state.
The policy feature stores thresholds and fallbacks per decision type and answer key, with wildcard rows. Result#act! runs a side effect only if the answer's confidence meets the active policy, otherwise it runs the fallback, and it raises if no policy exists, so it fails closed. The README notes that Noul has no separate confidence value. It is MIT licensed and unofficial.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Choice | Which team should handle this? | billing · technical · sales |
| Yes / no | Is this time-sensitive? | yes · no |
| Score | How frustrated is the customer? | Calm · Frustrated but civil · Very angry |
How it works
- Install the gem, run the generator and migrate.
- Call Typesafe::Rails.client.ask with a decision type, state and questions.
- Create DecisionPolicy rows with thresholds and fallbacks.
- Use result.act! to run side effects only above threshold.
Strengths
- Fail-closed policy helper prevents unguarded side effects.
- Persisted usage and cost telemetry.
- Batches questions into one call.
Caveats
- Depends on a community SDK gem.
- Unofficial package.
Getting started
bundle add typesafe-ai-rails && bin/rails generate typesafe:rails:install && bin/rails db:migrateAt a glance
- Type
- Library
- Status
- beta
- Language
- Ruby
- Runtime
- Rails gem
- Has code
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
Unofficial Rails integration on the community `typesafe-sdk` Ruby gem: configuration, usage/cost telemetry, and opt-in confidence policies
AnotiaWang/awesome-decision-modelsRuby on Rails integration gem for TypeSafe AI and Jev, providing model-level classification and decision policy patterns.
logicrw/awesome-jev-projectsCommunity Rails integration on the typesafe-sdk gem: configuration, persisted usage and cost telemetry, and opt-in confidence policies.
hellogumbo/awesome-jev
Frequently asked questions
What does act! do?
Runs a side effect only if the answer meets its stored confidence policy, otherwise the fallback; it raises if no policy exists.
Does Noul have a confidence?
No; the noul value is itself the probability of yes.
Is it official?
No, it is a community integration.
Related projects
Open-source workspace for building, deploying and monitoring AI agents and workflows, listed as integrating TypeSafe System One.
ProjectproductionTypeScriptRecords the full distribution of every Jev answer by state, question and model, so thresholds can move over history with no new calls.
LibrarybetaPythonMonitoring proxy and client that records Jev answer probabilities and alerts on version changes, drift, edge crowding or accuracy drops.
ProxybetaPythonPython library to batch, gate, trace and calibrate thousands of typed Jev decisions, maximising questions per call.
ProjectprototypePythonEffect library turning Jev Choice, Noul and Score answers into typed branches with a compiler-enforced Uncertain case.
LibrarybetaTypeScriptEducational site with six bounded recipes and a custom builder for AI SDK Choice, Score and Boolean evaluations, exportable as TypeScript.
ServiceTypeScript