> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sense-lab.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Routing

> Decide which model answers which call, with rules that run top to bottom.

Routing decides where each call for `Sensei` goes. With no rules, Sensei answers every call. With rules, you can send some calls to a model on your own provider key, split calls between two models, cap spend, or refuse calls of a certain kind.

Whichever model answers, the call starts with what Sensei has learned on the project. See [Learnings on routed calls](#learnings-on-routed-calls).

Routing rules are on every plan. Spend caps on a rule need the Team plan. Only an account admin can change routing, and everyone on the account can read it.

## How a call is routed

1. Rules run top to bottom. The first enabled rule whose conditions all hold decides.
2. If no rule matches, the call goes to **Everything else**, the default. Sensei alone is the usual default.
3. The rule names one model or a split. A session keeps the model it drew on its first call, so a conversation does not change model part way.
4. If the chosen model cannot answer, for example because a provider key was rejected, the call moves to the rule's other models, then to the rule's fallback, then to Sensei. A call fails for a routing reason only when a rule in force refuses it.

Two kinds of call skip the rules. A call that names a provider model directly, such as `openai/gpt-5`, is served by that model. A call with the header `x-senselab-route: direct` is answered by Sensei.

Every call is recorded with the rule that decided it and the model that answered. A rule's **Evidence** tab compares its models on your own results and opens any task step by step, each call on the **Sessions** page has a routing badge, and every response carries an `x-senselab-route` header. See [Evidence and traces](https://docs.sense-lab.ai/sensei/routing/evidence.md).

## Runs follow the same rules

The model calls of a [run](https://docs.sense-lab.ai/sensei/runs/overview.md) are routed like any other call. A rule on **API key** matches the runs started with that key, and a rule on **Project** matches the runs on that project. So you can keep one rule, with a key of its own, for each way you want runs done, such as one key for runs on GPT and another for a split. See [Choose the model](https://docs.sense-lab.ai/sensei/runs/models.md).

## Learnings on routed calls

Sensei's [Learnings](https://docs.sense-lab.ai/sensei/learnings.md) belong to the project, and the model that answers a call does not change which ones it gets. A call that a rule sends to a model on your own provider key starts with the same Learnings as a call Sensei answers. Its turn gets an outcome and a summary in the same way, and the next turn on the project reads that summary, whichever model serves it. The same holds for a call that names a provider model directly.

With a split between Sensei and another model, both halves of your team's work feed one set of Learnings. A correction made in a session Sensei answered reaches the sessions the other model answers, and a fix the other model found reaches Sensei.

The **Recalled** card of a session lists what its calls started with. To send a call without Learnings, add the header `x-senselab-learnings: off`, as on any call.

Two things stay with the calls Sensei answers. The version of Sensei trained on your project serves only those calls, and the content of calls on your own keys is never kept as training material. See [Your model](https://docs.sense-lab.ai/sensei/your-model.md) and [Provider keys](https://docs.sense-lab.ai/sensei/routing/providers.md#data). A model on your key is also sent the conversation as your tool sent it, with the Learnings added. Sensei shortens a long conversation only for itself.

## What a routed model gains

A model that starts from Learnings does not have to carry its team's history in every call to know what the team already worked out. In October 2026 we measured this on a team of ten agents working 300 support and CI repair tasks whose rules changed partway through. The same frontier model ran three ways: on its own, with 20,000 tokens of the team's history in every call, and working from the learning that is built into Sensei.

| How the model ran | Tokens per task | List cost per task | Solved within three tries |
| - | - | - | - |
| On its own | 3,618 | \$0.0151 | 80% |
| Carrying the team's history | 47,675 | \$0.1908 | 99% |
| Working from what the team had learned | 7,012 | \$0.0186 | 99% |

Across ten repetitions of the test, on the tasks whose rule had changed, the model was right on the first try 0% of the time on its own, 94% of the time carrying history and 96% of the time working from what the team had learned. Token use was within 1% of the table's.

So the model reached the result of carrying its full history on about a seventh of the tokens and a tenth of the cost. Compared with the model on its own, it used about twice the tokens and solved 99% of tasks where it had solved 80%. Token counts include the calls made to keep the learning up to date.

Read these figures with three things in mind:

* The test gave the model the team's learning directly. It did not go through a routing rule, and we have not yet run the same test through one.
* The tasks were short, so expect the ratios to carry over better than the dollar amounts.
* Sensei adds Learnings to a routed call and removes nothing from it. The token saving arrives when your agents stop carrying history, rules files or notes of their own to stay consistent, and as fewer retries.

Requests answered by a model on your key are free for the first 1,000 a month, then \$1 per 1,000, on top of what the provider bills. See [Usage and cost](https://docs.sense-lab.ai/sensei/usage-and-cost.md).

## Observe before you enforce

The switch at the top of the page has two positions.

| Mode | Effect |
| - | - |
| Observe | Every call takes the default. Each rule records what it would have done. |
| Enforce | Rules route |

Start in **Observe**, read the table for a few days, then switch to **Enforce** when the would-be decisions look right.

## Start from a template

**Start from a pattern** offers rules to start from. The model names are filled in from your provider keys. Until a provider key is connected, only the two that keep calls on Sensei are offered.

| Template | What it does |
| - | - |
| Start Sensei at 10% and ramp on results | Sends 10% of sessions to Sensei and the rest to another model, and moves the split toward Sensei each day while results hold |
| Plan on another model, execute on Sensei | The first step of every task goes to the other model. The tool loop that follows runs on Sensei. |
| Escalate after a failed check | When a task's last test or type check failed and Sensei is retrying, hands the retry to the other model |
| Cap a model at \$20 a day | Routes to the model until the day's spend on the rule reaches \$20, then sends the rest to Sensei |
| Keep a project on Sensei | Every call from one project stays on Sensei, whatever the rules below say |
| Regulated data never leaves Sensei | Projects marked as regulated are served by Sensei only |

![The Start from a pattern dialog, with the rules an account without a provider key can start from](https://mintcdn.com/senselab/7GJRxwA5n_G2FDq5/images/sensei/routing-patterns.png?fit=max\&auto=format\&n=7GJRxwA5n_G2FDq5\&q=85\&s=e2018ba62ec8b6c5860c9bc235e6e616)

[Rules](https://docs.sense-lab.ai/sensei/routing/rules.md) describes every part of a rule.

## The tabs

| Tab | Content |
| - | - |
| Rules | The ordered list, with each rule's success rate by model and its calls in the last 7 days. Reorder rules, switch one on or off, or click one to edit it and to read its [evidence](https://docs.sense-lab.ai/sensei/routing/evidence.md). |
| Activity | Automatic moves: ramps, rollbacks, holds and caps, each with the numbers that caused it |
| Versions | Every save of the policy. You can compare two versions and restore one. |
| Providers | Your own provider keys. See [Provider keys](https://docs.sense-lab.ai/sensei/routing/providers.md). |
| Settings | Project data, notifications, and export, import and API access |

The four figures above the tabs cover the last 7 days: calls the rules saw, the share decided by a rule, rules switched on, and automatic moves.

![The Routing page: Observe and Enforce, four figures, the five tabs and the list of rules ending in Everything else](https://mintcdn.com/senselab/7GJRxwA5n_G2FDq5/images/sensei/routing.png?fit=max\&auto=format\&n=7GJRxwA5n_G2FDq5\&q=85\&s=055ecf8bd6e0774d3219debc8a62466d)

## Versions

Every save is a new version of the policy, and so is every automatic move. The **Versions** tab lists them with who or what made each one. Restoring an old version creates a new one with the old configuration, for example "Created v12 using the configuration from v9".

## Settings

![The Settings tab of Routing: project data, notifications, and export, import and API access](https://mintcdn.com/senselab/7GJRxwA5n_G2FDq5/images/sensei/routing-settings.png?fit=max\&auto=format\&n=7GJRxwA5n_G2FDq5\&q=85\&s=e8f0ab39159a8ff9391252d611dc44cd)

**Project data** declares what each project's traffic may contain: internal, customer or regulated. A rule with the **Project data** condition reads this. Nothing is inspected.

**Notifications** chooses where you hear about a split that ramps up, a split that rolls back and a spend cap that is reached: in the app, by email, or at a signed webhook. You can send a sample event to a saved webhook URL.

**Export, import, API** gives you the policy as one JSON document. You can download it, paste one in, or read and write it over the API.

```bash theme={null}
curl https://models.sense-lab.ai/v1/routing/policy \
  -H "Authorization: Bearer $SENSEI_API_KEY"
```

Reading works with any key of the account. Saving with `PUT` needs a key created by an admin. A policy that is pasted or sent is saved as a new version once it validates against your provider keys, and nothing changes until then.

## Limits

A policy can have 50 rules, fewer if your plan says so. A split can name 6 models, and its shares add up to 100.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.