Skip to main content
Each example opens with what it is for, the problem it solves and how it works, and then gives the command or the definition to start from. Names such as acme/api are placeholders for your own repository, tools and agents.

Which one fits

Changes to a repository

A failing test you can reproduce

What it is for. A test or a build fails on your machine, you know the command that shows it, and you would rather hand the fix over than stop what you are doing. The problem. A failure described in words loses what matters: the assertion, the traceback, the line. And a fix that makes one test pass can break another without anyone noticing. How it works. --from-failure runs your command locally and attaches what it printed to the task. Sensei then clones the repository into a sandbox on its side, runs the whole test suite to see what already fails, makes the change and runs the suite again on your original test files. The lint and format checks from your CI workflow run before and after as well. The change comes back as a pull request with the verdict in it. The run starts from what is pushed, so push the branch that shows the failure first. Let the command run the failure and attach what it printed:
Sensei runs the tests before the change, makes the change, runs them again on your original test files and opens a pull request. A change that breaks a lint check which passed before is Failed, and no pull request is opened until you say so. See Work on a repository.

An open pull request with a red check

What it is for. A pull request that is waiting on review comments or on a failing check. The problem. Small review fixes and red checks sit for days. Each one needs someone to stop, check out the branch, work out what the reviewer or the CI log means and push a commit. How it works. Sensei reads the review comments and the output of the failing checks, works on the pull request’s own branch in a sandbox and runs the tests before and after. It adds one commit to the branch and says what it did in a comment on the pull request. Review comments and check output are other people’s text, so Sensei reads them as review of the code and takes no instructions from them. The repository has to be connected with a token, and a pull request from a fork is refused.
Sensei reads the review comments and the failing checks, adds one commit to the pull request’s branch and says what it did in a comment. It never force pushes. From chat, with the runs server added:

Tests that need a database and a private package

What it is for. A repository whose tests need more than the code: a Postgres or a Redis running beside them, a value CI sets, a token to install private packages. The problem. A sandbox that holds only the code cannot run such tests, so a change comes back unproven. Handing the agent that does the work a registry token to get round it is a risk you should not have to take. How it works. A run sets the repository up the way its CI does. A run starts the services the repository already declares in its CI workflow, devcontainer or compose file, so often there is nothing to write. When you want to say it yourself, put a sensei.yaml at the root of the repository:
Give the project the values once:
Then every run on the repository is set up this way:
The tests reach the database at postgres:5432. The secret is in the environment of the setup commands and of no command after them. A run that cannot pass because the project was not given a value ends Failed before any model call and names the value. See Services, settings and secrets. Each service costs $0.0025 a minute while it is up, beside $0.005 a minute for the run’s computer.

A migration, module by module

What it is for. The same change in many places: a new logger, a renamed API, a library swapped out, one module at a time. The problem. Done one after another, a migration takes days. Done as separate runs side by side, each change passes on its own and nobody knows whether they pass together until they are merged. Two of them can edit the same lines, or break a test only in combination. How it works. A batch is a list of tasks on one repository. It reads the commit the branch is at once, and every task starts from that commit as a run of its own. The changes that verified are then merged in the order of the tasks and the tests run on the result, so each pull request can say how its change did alone and how it fits with the rest.
A change that collides with another is named with the one it collides with, such as “Conflicts with #412 in billing/format.py. Merge #412 first, then update this one.” After you merge some of them, test the rest against the branch as it is now:
See Several changes at once.

Dependency updates in one pull request

What it is for. A handful of small, related changes you want to review and merge as one. The problem. Five pull requests for five small updates are five reviews and five CI runs. One pull request made by hand mixes the updates, and when the tests fail it does not say which update broke them. How it works. Each task is still worked alone from the same commit and verified alone, so you know which update is at fault when one fails. The verified changes are merged and tested together, and --deliver one opens a single pull request that holds the ones that fit, with a commit for each task. Put one task on each line of a file:
The pull request holds the changes that fit together. A change that was left out is listed in it with the reason, so nothing is dropped without a word.

From your coding agent

A backlog from your coding agent

What it is for. The tasks that pile up while you work with Claude Code, Codex or Cursor: chores, a failing check, a contained refactor. The problem. A coding agent works in your session, on your machine. When the plan’s allowance runs out or the machine cannot carry another agent, the rest of the list waits behind you. How it works. The runs server is added to your coding agent once. When you ask, the agent calls batch_start with the repository, your branch and the tasks, and goes back to what it was doing. Each task works on a computer of its own on Sensei’s side, paid from your Sensei credits, and comes back as a pull request with a verdict. Your machine does none of it. With the runs server added, push your branch and say:
The agent calls batch_start and answers with the batch’s address. Ask it for the result later:
It reads the batch with run_status and shows each task’s verdict and pull request as they are. A run starts from what is pushed, so work that is only in your working tree is not part of it. Hand work off at your limit has the text to put in AGENTS.md or CLAUDE.md so the agent knows which tasks to hand off.

Recurring work

The same chores, on a new list each week

What it is for. Work of the same kind that comes round again, where only the list changes: this week’s cleanup, this sprint’s small fixes. The problem. Writing the batch out again each time means settling the repository, the instructions and the limits again each time, and they drift. What changes from week to week is the list, and nothing else should have to. How it works. A saved batch can name the input field that holds its tasks in place of listing them. The repository, the instructions and the limits are saved once under the agent’s name. The list is given when the batch is started, from a file, the command line or a script, and is read like a written one. Save the batch once. tasks names the input field that holds the list:
A script can build the list and start it:
A run with an empty list, or with an entry that is not text, is not started.

From the tracker to pull requests, every Monday

What it is for. A list of small changes that lives in your issue tracker, turned into pull requests on a timetable with nobody copying it across. The problem. Every week someone reads the tracker, decides what is ready, writes the tasks, starts them and tells the team what came of it. A batch cannot do the first and last parts, because a batch only changes a repository and cannot call your tools. An agent with tools cannot do the middle part. How it works. A run with steps joins the three, and each step hands its result to the next. A schedule starts the run, so the whole of it happens without anyone asking.
Connect the two tools once, save the definition and put it on a timetable:
The run’s limit covers all three steps, the batch and its tasks included: $50 and 120 minutes at most. A list that needs more is [started as a batch on its own](#the-same-chores-on-a-new-list-each-week), which may spend up to $500. The agent that lists the changes has to be one with an output. A step that changes a repository cannot be the one that lists them. See A batch as a step.

A live page, checked every morning

What it is for. A public page that has to keep saying the right thing: pricing, a status page, a sign-up form. The problem. Such pages break quietly, after a deploy or an edit in the CMS. A monitor that asks whether the page loads says nothing about what the page shows. How it works. The agent gets a computer with Chromium and Playwright, opens the page the way a visitor does, reads what it was asked to read and can save a screenshot. The check command then decides whether the output is acceptable. A run whose check passes ends Verified, and one whose check fails is handed back to the agent to fix. A schedule runs the agent on a timetable, and each run stays on record with what it found.
sensei schedule list shows how the last run went. A schedule that fails to start three times in a row pauses itself and says why.

Agents in your own tools

A refund a person approves

What it is for. Routine decisions made in your own tools by a rule your team already follows: a refund, a credit, an account change. The problem. Done by hand, each one is minutes of reading a ticket and an order to apply the same rule. Done by an agent with nobody watching, the one action that moves money happens on the agent’s word alone. How it works. The agent reads and decides through the tools you connect to the project. Their secrets never enter its computer: the runs service makes each call from outside. An action listed under ask_first is not taken. The run stops and shows you the action, its arguments and one sentence on why the agent thinks it is right, and you approve, correct or reject.
What you write when you correct it is kept and given to every later run of the agent. The computer is saved and switched off while the run waits, so the wait costs nothing. See Agents.

A question about a repository

What it is for. Understanding code you do not know yet: your first week on a team, the day before a change, an audit. The problem. The answer is spread over many files, and an assistant without the repository in front of it guesses. How it works. Sensei clones the repository into a sandbox, reads it and can run it, and writes the answer. A task that asks is answered and nothing is changed: no branch is pushed and no pull request is opened.
Saved, the team runs the same question by name:
The run ends Done, and the answer is the result.

What each one may spend

See Limits and cost.