Skip to content

Choose the models agents use

Name a model per task class, such as draft or review, with ranked fallbacks, in one Policy call.

For developers

Models are chosen by Policy per task class, never in code, so changing a model changes no Interface. One Policy names a model for each class, such as draft, classify or review, with ranked fallbacks.

For developers

What you get

  • 1model Policy: one model per task class, with ranked fallbacksPolicy
  • 1record of every model call, with its model, tokens and costAction

Your agent does

Policy.update
You, to your agent

Choose the models agents use.

Use a stronger model for reviews.

Switch drafting to a faster model.

# Policy.update
curl -X PATCH https://api.sb/leaseline.app/policies/policy_models \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rule":"draft: fast. review: strong, then fast."}'
import { $ } from 'startup-builder'

await $.Policy.update({ id: 'policy_models', rule: 'draft: fast. review: strong, then fast.' })
npx startup-builder do Policy.update --json '{"id":"policy_models","rule":"draft: fast. review: strong, then fast."}'
{
  "name": "do",
  "arguments": {
    "code": "return await $.Policy.update({ id: 'policy_models', rule: 'draft: fast. review: strong, then fast.' })"
  }
}

Change it

  • Use the strong model for every refund reply.
  • Show me how often the first choice fails.
  • Cap model spend at $200 a month.

Under the hood

Systems
Ledger
Nouns
Policy, Agent, Limit
Events
Policy.updated

When a model times out or refuses, the gateway tries the next in rank, and the fallback is an Event. AI models covers the gateway, cost and Limits.