# TypeSafe

> Typed decision from TypeSafe's System One model: calibrated probabilities, single-choice routing, and graded scores. Uses a configured TypeSafe, OpenRouter, OpenAI, or Microsoft Foundry account.

Source: <https://everruns.com/docs/integrations/typesafe/>

> **Status:** Experimental. Available to every organisation; adding the capability and a TypeSafe connection is the opt-in.

Everruns integrates with [TypeSafe](https://typesafe.ai) so agents can ask for a **judgment** rather than an opinion. TypeSafe’s System One model answers typed questions about content and returns numbers your agent — and your code — can act on directly: the probability that something is true, which option out of a set applies, or where something falls on a scale you define.

It does not write prose. That is the point: there is no answer to interpret, and no JSON to parse out of a paragraph.

## What You Get

* **Yes/no with a probability**: “Is a refund being requested?” → `0.97`, not “Yes, it appears so.”
* **Single choice with a distribution**: pick one option and see how close the runners-up were
* **Graded scores**: rate against ordered levels you write, with the probability of each level
* **Confidence**: how concentrated the answer is, so the agent can escalate instead of guessing
* **One call, many questions**: every question in a call is answered together over the same content

## Use an existing OpenRouter account

In **Models**, add or enable a **Decisions** model under your OpenRouter provider. Choose the **Jev 1.13** profile and the provider’s model ID `typesafe/jev-1.13`. The same saved OpenRouter credential serves both chat and decisions. Direct TypeSafe uses `jev-1.13.0`.

## Use an existing OpenAI account

OpenAI’s [Decisions API](https://developers.openai.com/api/docs/guides/decisions) answers the same calibrated questions on GPT-6 Luna. In **Models**, enable the **GPT-6 Luna Decisions** model under your OpenAI provider (model ID `gpt-6-luna-decisions`, sent to OpenAI as `gpt-6-luna`). It sits next to the `gpt-6-luna` chat model and uses the same saved OpenAI key. OpenAI bills input tokens only, at $0.10 per million.

## Use an existing Microsoft Foundry account

[Microsoft-Decision-1](https://ai.azure.com/catalog/models/microsoft-decision-1) answers the same questions on Microsoft Foundry. Deploy it in the Foundry portal, then, in **Models**, add a **Decisions** model under your Microsoft MAI provider whose model ID is the deployment name. Foundry routes calls by deployment, so a deployment named `Decision-1` is model ID `Decision-1`. The names `Microsoft-Decision-1` and `Decision-1` pick the **Microsoft Decision 1** profile on their own; another name needs that profile chosen by hand. The provider’s saved Foundry API key and resource endpoint serve both chat and decisions. Microsoft bills input tokens only, at $0.042 per million, and a request (content plus questions) fits in 32,768 tokens.

Set the organization decision default in Models, or select an exact model in the **Jev Decisions** capability settings. The tool uses that model’s account. A disabled model or missing credential requires repairing the selection; it does not switch to another account. Decision calls honor session network restrictions and budgets, and appear in session usage.

The model service filter keeps decisions out of chat selectors. Model profile details show calibrated primitives and serving limits. Existing TypeSafe connections and session secrets continue to work when no catalog selection or decision default is configured.

## Quick Start

### 1. Get Your API Key

1. Sign in at [typesafe.ai](https://typesafe.ai)
2. Create an **API key** in the dashboard
3. Copy it

### 2. Connect in Everruns

1. Go to **Settings** > **Connections**
2. Find **TypeSafe** in the available providers
3. Click **Connect** and paste your API key

Once connected, the TypeSafe capability is available in agent sessions.

### 3. Use in Sessions

Agents with the TypeSafe capability get one tool:

| Tool           | Description                                                  |
| -------------- | ------------------------------------------------------------ |
| `jev_decision` | Ask typed questions about content and get calibrated answers |

A call gives it the content plus the questions to ask about it:

```json
{
  "state": "Why did the chicken cross the road? To get to the other side.",
  "questions": [
    {
      "id": "is_funny",
      "type": "noul",
      "instructions": "Would a general audience laugh at this?"
    },
    {
      "id": "humor",
      "type": "score",
      "instructions": "How funny is this joke?",
      "levels": ["Not funny at all", "Mildly amusing", "Genuinely funny", "Hilarious"]
    }
  ]
}
```

And gets back numbers, not a review:

```json
{
  "model": "jev-1.13.0",
  "answers": {
    "is_funny": { "type": "noul", "probability_yes": 0.43 },
    "humor": {
      "type": "score",
      "score": 0.58,
      "normalized": 0.19,
      "level": 1,
      "label": "Mildly amusing",
      "probabilities": { "0": 0.44, "1": 0.55, "2": 0.01, "3": 0.0 },
      "confidence": 0.57
    }
  }
}
```

## Question Types

| Type                                                   | Ask it when                             | You get                                                                            |
| ------------------------------------------------------ | --------------------------------------- | ---------------------------------------------------------------------------------- |
| [`noul`](https://docs.typesafe.ai/primitives/noul)     | A condition either holds or it doesn’t  | The probability of yes, from 0 to 1                                                |
| [`choice`](https://docs.typesafe.ai/primitives/choice) | Exactly one option out of a set applies | The selected option, every option’s probability, and a confidence                  |
| [`score`](https://docs.typesafe.ai/primitives/score)   | Something falls somewhere on a scale    | A weighted position across your levels, each level’s probability, and a confidence |

These are System One’s own primitives, kept under the same names here; TypeSafe documents them in full under [Primitives](https://docs.typesafe.ai/primitives).

Two things worth knowing when you write the questions:

* A `noul` near **0.5** means yes and no are roughly equally likely. It does not mean “somewhat” — for degree, use a `score`.
* `choice` options and `score` levels must each describe a concrete situation and stand on their own. The question id is never shown to the model, so the instructions have to carry the whole meaning.

The `confidence` on a `choice` or `score` is a second axis, not a restatement of the probability: the answer tells you *what*, confidence tells you *whether to act*. See [Confidence](https://docs.typesafe.ai/confidence), and [confidence-gated routing](https://docs.typesafe.ai/patterns/confidence-routing) for the pattern it enables.

## Good Fits

* **Verification**: does this answer actually follow from the source it cites?
* **Rating**: how severe is this report, how good is this draft, how funny is this joke
* **Routing**: which handler, team, or tool should take this — with a confidence to gate on
* **Screening**: does this content match a policy, and how clearly

## Embedding the Framework

Running the Everruns Framework in your own application rather than on the platform? The same capability attaches to an agent you build yourself, and the decision tool is also callable directly with no agent at all. See [Direct decision](https://everruns.com/docs/framework/direct-model-calls/#decisions).

## Guardrails

The same model backs Everruns [guardrails](https://everruns.com/docs/capabilities/guardrails/) when a `llm_judge` or `moderation` check sets `"engine": "jev"`. Instead of asking the utility model to write a verdict, the check gets a calibrated probability and your configured `threshold` decides — and every check on a stage is answered in a single call. That path uses a deployment-owned key (`UTILITY_TYPESAFE_API_KEY`), not your personal connection.

## Security

* The API key is stored as a user connection and never exposed to the agent or written into session transcripts.
* Content passed to `jev_decision` leaves the platform for TypeSafe, like any other integration that inspects content. Calls are capped at 20 questions and 32 KiB of content.
* The content being judged is sent as **data**, and every question states so — a document that tries to instruct the model is being rated, not obeyed.

## Learn more

The model and its concepts are TypeSafe’s, and their documentation is the reference for both:

* [System One](https://docs.typesafe.ai/concepts/system-one) — the class of model, and how it differs from an LLM
* [Primitives](https://docs.typesafe.ai/primitives) — [Noul](https://docs.typesafe.ai/primitives/noul), [Choice](https://docs.typesafe.ai/primitives/choice), [Score](https://docs.typesafe.ai/primitives/score), and [structured criteria](https://docs.typesafe.ai/primitives/advanced)
* [State](https://docs.typesafe.ai/concepts/state) — what to send as the thing being judged
* [Confidence](https://docs.typesafe.ai/confidence) — certainty as a second axis, distinct from the probability
* [Patterns](https://docs.typesafe.ai/patterns) — including [speculative fan-out](https://docs.typesafe.ai/patterns/fan-out) and [confidence-gated routing](https://docs.typesafe.ai/patterns/confidence-routing)