Scheduling agents
You can schedule an Agency file to run on a recurring basis using agency schedule. This is useful for running an agent every morning, every hour, on weekdays only, and so on.
Adding a schedule
agency schedule add foo.agency --every daily
agency schedule add foo.agency --cron "0 9 * * 1-5"You can either pick a preset with --every or write your own cron expression with --cron. Exactly one of the two is required.
Options
--every <preset>— one of:minute,hourly,daily,weekdays,weekends,weekly,monthly.--cron <expression>— a standard 5-field cron expression.--name <name>— name for the schedule. Defaults to being derived from the filename.--env-file <path>— path to a.envfile. Environment variables in this file are loaded into the agent's environment when it runs.
Listing schedules
agency schedule list
agency schedule lsRemoving a schedule
agency schedule remove my-agent
agency schedule rm my-agentEditing a schedule
agency schedule edit my-agent --every hourly
agency schedule edit my-agent --cron "0 * * * *"Accepts the same --every, --cron, and --env-file options as schedule add.
Testing the scheduler
agency schedule testSchedules a small test agent that runs every minute. Use this to verify that cron is working on your machine.
Run on GitHub Actions
To generate a GitHub Actions workflow for an agent:
agency schedule add agents/foo.agency \
--backend github \
--every hourly \
--secret SLACK_WEBHOOKThis writes a foo.yml workflow file to the current directory. The command does not require git, does not look for the agent file on your filesystem, and does not assume you're inside the target repo. The agent path you pass on the command line is used verbatim as the workflow's file: value.
After the file is written, the next steps printed by the CLI are:
- Move
foo.ymlinto your repo at.github/workflows/foo.yml. - Open it and verify the
file:line points to the agent's path as it lives in your repo (relative to the repo root). Edit it if needed. - In github.com → repo Settings → Secrets and variables → Actions, set
OPENAI_API_KEY(required) and any extra--secrets you passed. git add/commit/push.
You don't need to add agency-lang as a dependency to the repo — the workflow uses egonSchiele/run-agency-action which installs and runs agency-lang on the runner. agency-lang is only needed locally to generate the workflow file.
GitHub-specific options
--secret NAME(repeatable) wires a secret into the workflow'senv:block.--writegrantscontents: write+pull-requests: write(e.g. for agents that open PRs).--no-pinemits@<tag>instead of@<sha>action references (less secure; default is SHA pins).--forceoverwrites an existing<name>.ymlin the current directory.
Notes
- GitHub Actions enforces a 5-minute minimum cron interval.
agency schedule add --backend githubrefuses cadences shorter than that (--every minuteand any*/Nfor N < 5) since GitHub will not honor them. Use--every hourly,--every daily, or--cron "*/5 * * * *"or longer. - To remove a GitHub schedule,
git rmthe workflow file. GitHub schedules are not tracked byagency schedule list/remove— the workflow file in your repo is the source of truth.