schainks

schainks

Hello everyone :waving_hand:

I’d like to introduce SystemOneClient, an Elixir client for System One decision models: TypeSafe’s Jev, Cloudflare’s Clef, the OpenRouter decisions endpoint, and anything self-hosted that serves the same /v1/systemone wire format.

A System One model doesn’t generate text. You give it some state (any JSON) and a map of typed questions, and it returns a probability for every allowed answer:

  • noul: the probability that a condition holds
  • choice: a probability for each option
  • score: a probability-weighted position on an ordered scale

That makes them a good fit for the decisions code usually hands to an LLM and then parses: routing, gating, classification, picking a tool (btw, you can save actual :money_with_wings: using a System One model to do tool selection!).

Usage

questions = %{
  "tool" => %{    "type" => "choice",
    "instructions" => "Which action should run next to make progress on `request`?",
    "criteria" => %{"add" => "Adds two numbers", "gcd" => "Greatest common divisor", "none" => "No action fits"}  },
  "needs_tool" => %{
    "type" => "noul",
    "instructions" => "Does the next step need one of the actions in `available_actions`?"
  }
}

{:ok, answers, meta} =
  SystemOneClient.evaluate(%{request: "gcd of 1071 and 462", available_actions: ["add", "gcd"]}, questions)

answers["tool"].probabilities   #=> %{"gcd" => 0.97, "add" => 0.02, "none" => 0.01}
answers["needs_tool"].noul      #=> 0.96

Answers come back as Choice, Noul and Score structs with the full probability distribution, so you can take the top-k, apply a threshold, or cut
on a confidence level yourself. Nothing is collapsed to a single pick.

Providers

One provider: option, with url: and model: always able to override:

  • :typesafe (default): Jev at api.typesafe.ai
  • :cloudflare: Clef and Clef-flash on Workers AI. It builds the account-scoped URL and unwraps Cloudflare’s result envelope for you.
  • :openrouter: OpenRouter’s decisions endpoint
  • :compatible: any /v1/systemone URL, with or without a key, for self-hosted models

What else is in it

  • A SystemOneClient behaviour plus SystemOneClient.Stub, so your tests need no network. HTTP tests work with Req.Test through a plug: option.
  • Retries on 429, 529, 502, 503 and 504, and on transport errors, honouring Retry-After.
  • Tagged error tuples at the boundary; it never raises for network conditions.
  • :telemetry span [:system_one_client, :request, *] that never includes state, question text, or keys.
  • Depends only on req, jason and telemetry. Apache 2.0, Elixir 1.18+.

Using it in Jido

The reason this library exists is a contribution that was just merged into jido_ai and will ship in its next release: a ReAct request transformer that asks a System One model, before each LLM turn, which tools the next step needs. The model then sees only those tools, or none when it can answer directly. It can optionally pick a model tier by how much reasoning the request needs. jido_ai defines a small client behaviour and adds no dependency, and SystemOneClient satisfies it as-is:

defmodule MyApp.ToolRouter do
  use Jido.AI.Reasoning.ReAct.Transformers.SystemOne,
    client: SystemOneClient,
    client_opts: [provider: :typesafe],
    top_k: 3
end

use Jido.AI.Agent, name: "support", tools: [...], request_transformer: MyApp.ToolRouter

Every tool schema rides along on every LLM turn, so this adds up. In a benchmark with a live Jido.AI.Agent, 24 tools and 30 graded tasks, gating with Jev cut input tokens per task from about 5,600 to about 900 (6.2x) at the same pass rate as Claude Haiku 4.5 with all tools, for about a third of the cost. Each decision call adds roughly 100 ms per turn. Routing between model tiers didn’t pay off on that task set, so it’s off by default. The scripts, raw results and caveats are in the experiment linked below. It’s a small, hand-built benchmark, so please measure on your own traffic before trusting thresholds.

Status

0.1.0 is on Hex. Several community TypeSafe clients appeared around Jev’s launch, and they’re worth a look too. This one’s focus is the full distributions, the offline stub, and covering Clef and self-hosted endpoints behind the same interface. Feedback, issues and provider additions are very welcome.

Showing Posts 1 to 4

alvinkatojr

alvinkatojr

Nice! There have been a couple of Elixir clients and bindings released for System One this past month, but I believe that you are NOT late to the party.

Good work with this!

schainks

schainks OP

:person_bowing: Thank you! Just pushed v0.2.0 with OpenAI support, too. Trying to make this library the most useful offering possible for Elixir Devs everywhere.

mikehostetler

mikehostetler

Amazing work @schainks !!! Thank you so much for the PR’s and helping land this!

schainks

schainks OP

Thank you @mikehostetler ! Here’s to more collaboration and adventures with Jido :rocket:

— All posts loaded —

Where Next? Top

Trending in Announcing Top

restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 12366 136
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
ausimian
Castle is a package I put together to assist with building Elixir releases capable of being live-upgraded via the ‘official’ release hand...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
drozdzynski
Storex is a frontend store with state management handled on the backend. It allows you to update the store state both from the frontend a...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews