How to schedule Pi coding agent: cron with pi -p, or CodeAgentSwarm
By CodeAgentSwarm · Updated October 31, 2026
How do I put Pi on a cron?
- Log only: a crontab line with
pi -p. - A conversation you can continue: CodeAgentSwarm Scheduled Conversations.
What Pi offers on its own
Pi's README and CLI docs describe print mode, JSON mode and RPC mode, but no scheduler. You could write an extension that schedules prompts; nothing official does it today. Pi CLI docs
A Pi cron job with pi -p
# crontab -e: every day at 08:30
30 8 * * * cd ~/code/my-app && pi -p "Read TODO.md and list the next three steps." >> ~/logs/pi-cron.log 2>&1-p writes the final answer to stdout and exits; --mode json writes JSONL events instead, if a script reads the output. Pi CLI docs
Schedule Pi in CodeAgentSwarm
- Open Scheduled in the top bar and press New schedule. Or type the prompt in a Pi Chat and pick Schedule this prompt… from the send menu.
- Pick the Project and choose Pi as the agent. Model, reasoning and permissions are optional: leave them on Default or set them like in the Chat composer.
- Write the prompt the agent should run every time.
- Under When, choose At set times (up to 24 a day), Every few hours (1, 2, 3, 4, 6, 8 or 12) or When I run it, and the days.
- Choose Visible (opens a Chat) or Headless (no tab, result in Scheduled), and whether each run continues the same conversation or starts a new one. Press Create schedule.

Prompts worth scheduling with Pi
- Every weekday at 08:30: read the TODO file of this project and tell me the three next steps.
- Every 12 hours: run the tests and explain any new failure.
- Sundays at 09:00: check for outdated dependencies and list them with their changelog links.
Pi works with the provider you log in to. Pick the model in the schedule if a job must not change when you switch Pi's default.
What happens on each run
- With Continue the same conversation, a visible run goes to the Pi agent that already holds the conversation, and never opens a second copy. With Start a new conversation, each run opens a fresh agent. If it is busy, Skip if still working (on by default) skips that slot; turn it off and the prompt waits in the queue.
- The Chat marks every scheduled run, so you can tell your own messages from the scheduled ones and reply to a run like any other message.
- If CodeAgentSwarm was closed or the computer asleep at the set time, If missed, run when the app opens runs it once, late. A week away gives one run, not seven.
- Schedules run on your computer, so CodeAgentSwarm has to be open. Your phone can list, edit and run them from the Scheduled tab.
FAQ
Does Pi coding agent have a scheduler?
Not in its docs. The official CLI docs describe print, JSON and RPC modes but no scheduling. Use cron with pi -p or CodeAgentSwarm.
Can I schedule Pi with a specific model?
Yes. In CodeAgentSwarm the schedule can set the model; otherwise Pi uses its default provider and model.
Do I need to log in again for scheduled runs?
No. Scheduled runs use the Pi login on the computer that runs them, like any other Pi session.