Skip to content
WIP

This guide is a work in progress. Barry is also a work in progress.

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.

  • You packed the Linear bag onto bonanza, and bonanza identity check reports its LINEAR_API_KEY secret. 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.

Scaffold a bag, then an action inside it:

Terminal
barry new my-tools
cd my-tools
barry new action nightly-triage

Barry writes actions/nightly-triage/action.yaml with a placeholder prompt. Replace the file’s contents with the task:

version: 1
name: nightly-triage
description: Summarize the open Linear issues that changed in the last day.
context: none
input_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.

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: once

Each key does one job:

  • cron and timezone fire it at 02:00 New York time, Monday to Friday.
  • identity names who the agent acts as: that identity’s credentials, default harness, and model.
  • traits grants the Linear tools, and bounds keeps the run read-only.
  • overlap: skip drops a fire that lands while the last run is still going.
  • catch_up: once runs one missed fire when the machine wakes, never one per missed night.

From the bag’s directory, install it so Barry registers it:

Terminal
barry install .

After that, the scheduler reloads bag manifests every minute, so later edits to the schedule need no reinstall.

List the schedules:

Terminal
bonanza schedule list

my-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:

Terminal
bonanza schedule run my-tools/nightly-triage
bonanza schedule show my-tools/nightly-triage

schedule 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.

  • 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.scheduler service.
  • A run failed. bonanza schedule logs my-tools/nightly-triage prints the latest run’s log. Barry raises a system_alert event on the first failure, which bonanza events list --type system_alert shows. A missing Linear key shows up in bonanza identity check.
  • You want to stop it for a while. bonanza schedule pause stops it firing until bonanza schedule resume.