Loops
CI/CD for AI Agent tasks. Define repeatable automated tasks and trigger them on a schedule or via API — like cron jobs for your AI agents.
Overview
Loops let you define a task once and run it repeatedly. Each Loop wraps a Pod with a prompt template, trigger configuration, and execution policy. Key features include:
- Cron scheduling or API-triggered execution
- Autopilot (supervised) or Direct (autonomous) execution modes
- Persistent sandbox reuse across runs for incremental work
- Variable substitution in prompt templates
- Webhook callbacks for run completion notifications
- Concurrency policies (skip, queue, or replace)
Execution Modes
Autopilot
A Control Agent supervises the execution. It monitors progress, handles errors, and decides when the task is complete. Best for complex, multi-step workflows.
Direct
The agent runs the prompt autonomously. The Pod terminates automatically when the agent finishes. Best for simple, well-defined tasks.
Trigger Types
Loops support two trigger mechanisms:
Cron Schedule
Run on a recurring schedule using standard cron expressions (e.g., '0 9 * * *' for daily at 9 AM UTC). The scheduler checks every 30 seconds for due Loops.
API Trigger
Trigger runs programmatically via HTTP POST. Pass runtime variables to customize each run. Ideal for CI/CD pipelines, webhooks, and event-driven automation.
Sandbox Strategies
Control how the execution environment is managed across runs:
Persistent
Reuse the same sandbox across runs. File changes, git state, and installed packages carry over. Uses Pod Resume to restore the previous environment.
Fresh
Create a new sandbox for each run. Guarantees a clean starting state every time. Best for tasks that need reproducible environments.
Session Persistence
When enabled, the agent retains conversation history across runs. The same SessionID is reused, so the agent remembers context from previous executions. Disable this for independent runs without historical context.
Concurrency Policies
Control what happens when a new run is triggered while another is still active:
| Concurrency Policies | Overview |
|---|---|
| Skip | The new run is skipped if the maximum concurrent runs is reached. |
| Queue | The new run is queued and starts when a slot becomes available. |
| Replace | The active run is cancelled and replaced by the new one. |
Prompt Templates
Use {{variable}} placeholders in your prompt. Define default values when creating the Loop, and override them at trigger time. Example:
Review all changed files in {{branch}} branch since last review. Focus on {{focus_area}} issues.Webhook Callbacks
Configure a callback URL to receive HTTP POST notifications when a run completes. The payload includes run status, duration, exit summary, and error details. Use this to integrate with Slack, PagerDuty, or custom monitoring.
Use Cases
- Automated daily code reviews
- Nightly dependency updates and security scanning
- PR-triggered test generation
- Scheduled documentation updates
- Event-driven bug triage and reproduction