Skip to main content
Routing Studio lets you bias Theo’s routing engine for your domain. The SDK exposes three namespaces:
  • theo.routingPreferences — shared preference objects (one rule set, many keys).
  • theo.routingRules — per-key rule editing without an explicit preference object.
  • theo.keys.getRoutingPreference / setRoutingPreference — bind a shared preference to a key.
See the Routing Studio guide for the full ContractIQ walkthrough and the API reference for the underlying HTTP shapes.

Shared preferences

List

Get

Create

scope: "team" requires an active org and the team-config permission. Idempotent via the Idempotency-Key header.

Update

Sending rules or examples replaces the entire collection.

Delete

Cascade-removes every key binding pointing at the preference.

Test (replay against the routing engine)

Replays a prompt twice — once without the preference (baseline) and once applied — so you can render a side-by-side diff.
Both blobs match the routing telemetry your callers receive on a real completion.

Per-key routing rules

The preference-free shortcut: the server find-or-creates a hidden per-key preference under the hood and ensures the binding row points at it. Reach for this when you’re tuning a single key.

Get

Effective

The snapshot that will actually drive completions for the key right now, plus a source enum so you can render inherited context.

Set

Replaces the per-key rules / examples / overrides and ensures the binding points at the hidden row.

Clear

Drops the binding (the key falls back to org default → user default → none) and deletes the hidden preference row. Existing bindings to a shared preference are left alone.

Key bindings (shared preferences)

Bind an existing shared preference to a key, or clear the binding.

Types

The SDK exports first-class types for every shape — switch and if blocks narrow without as any:
  • RoutingPreferenceSummary — full preference row.
  • RoutingRuleInput — single keyword/regex rule (pattern, target_mode, optional target_engine, confidence, optional description).
  • RoutingExampleInput — few-shot example (prompt, expected_mode, optional expected_engine).
  • RoutingPreferenceTestResult{ baseline, with_preference } envelope returned by test.
  • KeyRoutingRulesSnapshot — per-key snapshot with active + shared_binding.
  • KeyEffectiveRouting — effective routing snapshot with the source enum.

Telemetry

When a preference contributes to a completion’s routing decision, the meta and done SSE events surface a customer_preference block:
Point your SDK at the meta event’s routing field to render the same affordance in your product.