Build a custom agent
Give a Role an agent of your own, with its instructions, its tools, the cases it must pass and a graded run before it takes the seat.
To build a custom Agent, write the Function it runs, the Role it fills and the cases it must pass. Leaseline seats the Success Manager agent this way in its Success Manager Role.
Prerequisites
- A Startup in test, such as Leaseline from learn.
- The Role's contract in
agents/, from seating the agent.customer/ success-manager.mdx
Steps
-
To give the agent its work, write an agentic Function for the Verb it owns, as in function kinds.
-
To seat it, name it in the Role file with
worker:. The file body is its instructions.{ agent: Rae } -
To hold it to the contract, write the Role's cases:
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_4loEed1JG4' }) expect(result.reply).toPass('evaluators/ notice-tone') expect(result.calls).not.toContain('Lease.renew') }) -
To grade an agent you run yourself against a fresh test Startup, use
eval:Terminal npx startup-builder eval --scenario first-renewal --agent "node agent.js" -
To ship it, review and merge the Change that holds the files.
Result
The agent fills the seat within the Role's Limits, and every action class the founder approves waits for the founder. The cases replay recorded model output, so CI makes no model call.
Next steps
- How approvals work: the five action classes the founder approves, each by an Approval.
- Role tests: the full contract.