Skip to content

Role tests

A Role test file holds the eval cases a Role's agent must pass, and autonomy climbs per Verb on its results.

A file named [role].test.ts beside a Role holds the eval cases its agent must pass. Autonomy climbs per Verb, from assist to full, on these results.

  • agents/customer/
  • success-manager.mdx
  • success-manager.test.ts

Reference

TypeScript with test, expect and run from startup-builder/test. run drives the Role with recorded model output, so CI makes no model call.

ExportTypeHolds
test(name, fn)functionOne case
run(task, stubs)functionGives the Role one Task and returns { result, calls }
expect(value)functionAssertions, and toPass(evaluator) to grade with an Evaluator

Examples

Minimal

agents/customer/success-manager.test.ts
import { expect, run, test } from 'startup-builder/test'

test('sends the notice', async () => {
  const { calls } = await run({ lease: 'lease_1', daysLeft: 60 })
  expect(calls).toContain('Lease.notify')
})

Leaseline

agents/customer/success-manager.test.ts
import { expect, run, test } from 'startup-builder/test'

test('never quotes a rent the manager has not set', async () => {
  const { result } = await run({ question: 'Can you do $1,700 instead?', lease: 'lease_1' })
  expect(result.reply).toPass('evaluators/notice-tone')
  expect(result.calls).not.toContain('Lease.renew')
})

What it builds

The StartupBuilder runs the cases on every preview of the Role.

  • a verdict per case on the Change
  • the Role's autonomy per Verb: assist, supervised or full
  • a failing case demotes the Verb one level until it passes

Good to know

  • Autonomy is per Verb, not per agent: one agent may send notices alone and still ask before renewing.