Run work while you sleep
Use this when you want an agent to do a task overnight, as a specific
identity, and leave the result for you in the morning. The recipe declares a
schedule in a bag of your own that runs an agent action as bonanza, the
identity from Build a Barry, with the
public Linear bag. For the same
idea built up one primitive at a time, follow
Automate a recurring task.
Before you begin
Section titled “Before you begin”- You packed the Linear bag onto
bonanza, andbonanza identity checkreports itsLINEAR_API_KEYsecret. Keep work and home identities apart shows both steps. - The identity has a default harness and model, which the scheduled run uses.
- Your Mac stays on overnight, or you accept that a missed run catches up when it wakes.
Create the bag and the action
Section titled “Create the bag and the action”Scaffold a bag, then an action inside it:
barry new my-toolscd my-toolsbarry new action nightly-triageBarry writes actions/nightly-triage/action.yaml with a placeholder prompt.
Replace the file’s contents with the task:
version: 1name: nightly-triagedescription: Summarize the open Linear issues that changed in the last day.context: noneinput_schema: type: object properties: team: type: string required: [team]prompt: |- List the open Linear issues for the given team that changed in the last day. For each, write one line: the issue, what changed, and the next step.context: none marks the action as self-contained, so a fresh agent can run
it with no conversation behind it.
Declare the schedule
Section titled “Declare the schedule”Add a schedule to the bag’s bag.yaml:
schedules: nightly-triage: cron: "0 2 * * 1-5" timezone: America/New_York action: nightly-triage identity: bonanza inputs: team: platform traits: [linear] bounds: [readonly] overlap: skip catch_up: onceEach key does one job:
cronandtimezonefire it at 02:00 New York time, Monday to Friday.identitynames who the agent acts as: that identity’s credentials, default harness, and model.traitsgrants the Linear tools, andboundskeeps the run read-only.overlap: skipdrops a fire that lands while the last run is still going.catch_up: onceruns one missed fire when the machine wakes, never one per missed night.
From the bag’s directory, install it so Barry registers it:
barry install .After that, the scheduler reloads bag manifests every minute, so later edits to the schedule need no reinstall.
Verify
Section titled “Verify”List the schedules:
bonanza schedule listmy-tools/nightly-triage appears with its next fire, and the list says
whether the scheduler is alive. Run it once now instead of waiting for the
night, then read the result:
bonanza schedule run my-tools/nightly-triagebonanza schedule show my-tools/nightly-triageschedule show lists the recent runs with their run IDs. Pass one to
bonanza action show to print the run’s deliverable. In the morning, the same
two commands show what ran overnight, and
bonanza action runs --trigger schedule lists every scheduled run.
If it fails
Section titled “If it fails”- The schedule is missing from the list. Run
barry bag check .from the bag’s directory to find a manifest error, fix it, and install again. - The list reports the scheduler as down. See
See what is running
to find and restart the
schedules.schedulerservice. - A run failed.
bonanza schedule logs my-tools/nightly-triageprints the latest run’s log. Barry raises asystem_alertevent on the first failure, whichbonanza events list --type system_alertshows. A missing Linear key shows up inbonanza identity check. - You want to stop it for a while.
bonanza schedule pausestops it firing untilbonanza schedule resume.