Batch operations allow you to execute multiple AI agent tasks in parallel or sequence, monitor their progress, and merge the results automatically. This is ideal for large-scale automation workflows like updating documentation across multiple repositories, triaging issues, or performing code reviews.
Overview
A batch operation consists of:
Batch File: A text file defining all tasks to execute
Launch: Starting the batch operation
Monitor: Tracking progress of individual tasks
Merge: Combining results from completed tasks
Batch File Format
Batch files use a simple text format where each task is separated by a blank line. Each task can specify:
repo: Repository identifier
task: Task description or prompt
budget: Budget allocation for this task
provider: Provider to use (optional, uses default if not specified)
repo: zudoku-docstask: Update API reference documentation with latest changesbudget: 3.00provider: cursormodel: gpt-4timeout: 300repo: brightpath-clitask: Add installation instructions for Windows platformbudget: 2.50provider: cursormodel: gpt-4timeout: 200
Creating Batch Files
Example 1: Documentation Updates
Create a file named docs-update-batch.txt:
Code
repo: zudoku-docstask: Update the OpenAPI plugin documentation to include the new authentication optionsbudget: 2.00repo: zudoku-docstask: Add examples for custom MDX components in the components documentationbudget: 2.50repo: zudoku-docstask: Update the deployment guide to include Cloudflare Pages worker configurationbudget: 1.50repo: zudoku-docstask: Fix broken links in the configuration reference documentationbudget: 1.00repo: zudoku-docstask: Add troubleshooting section to the build configuration documentationbudget: 2.00
Example 2: Multi-Repository Code Review
Create a file named review-batch.txt:
Code
repo: frontend-apptask: Review PR #42 focusing on security vulnerabilities and authentication flowsbudget: 5.00provider: cursorrepo: backend-apitask: Review PR #103 for performance issues and database query optimizationbudget: 4.50provider: cursorrepo: mobile-apptask: Review PR #28 for memory leaks and React Native best practicesbudget: 4.00provider: cursorrepo: infrastructuretask: Review terraform changes in PR #15 for security and cost implicationsbudget: 3.50provider: cursor
Example 3: Issue Triage
Create a file named triage-batch.txt:
Code
repo: backend-apitask: Triage and label all open issues from the last weekbudget: 3.00provider: linearrepo: frontend-apptask: Triage bugs reported by customers and assign priority levelsbudget: 3.50provider: linearrepo: mobile-apptask: Review feature requests and categorize by implementation effortbudget: 2.50provider: linear
Example 4: Zudoku Documentation Batch (Real Example)
Here's a comprehensive batch file for updating Zudoku documentation:
Code
repo: zudoku-docstask: Update the getting started guide to include the new CLI commands for project initializationbudget: 2.50provider: cursormodel: gpt-4repo: zudoku-docstask: Expand the OpenAPI plugin documentation with examples of schema customization and override optionsbudget: 3.00provider: cursorrepo: zudoku-docstask: Add a new guide for integrating Zudoku with Vercel, including environment variables and build configurationbudget: 2.00provider: cursorrepo: zudoku-docstask: Update the MDX components documentation with examples of using the new Stepper componentbudget: 1.50provider: cursorrepo: zudoku-docstask: Create a troubleshooting section for common build errors and how to resolve thembudget: 2.50provider: cursorrepo: zudoku-docstask: Add authentication provider examples for Azure AD and PingFederatebudget: 3.50provider: cursorrepo: zudoku-docstask: Update the API reference to include the new search configuration optionsbudget: 2.00provider: cursorrepo: zudoku-docstask: Expand the custom plugins guide with real-world examples and best practicesbudget: 3.00provider: cursorrepo: zudoku-docstask: Add performance optimization tips to the build configuration documentationbudget: 2.50provider: cursorrepo: zudoku-docstask: Create a migration guide for users upgrading from version 1.x to 2.xbudget: 4.00provider: cursor
Launching Batch Operations
Basic Launch
Code
# Launch a batch with default settingsbrightpath batch launch docs-update-batch.txt
# Check status of a specific batchbrightpath batch status batch-abc123# Check all running batchesbrightpath batch status# Watch status with live updatesbrightpath batch status batch-abc123 --watch
# View detailed status for a specific taskbrightpath batch status batch-abc123 --task 3 --verbose
JSON Output
Code
# Get status in JSON format for programmatic usebrightpath batch status batch-abc123 --json
Managing Running Batches
List All Batches
Code
# List all batchesbrightpath batch list# List only running batchesbrightpath batch list --status running# List completed batches from last weekbrightpath batch list --status completed --since 2024-01-08
Cancel a Batch
Code
# Cancel a batch operationbrightpath batch cancel batch-abc123# Force cancel without cleanupbrightpath batch cancel batch-abc123 --force
Pause and Resume
Code
# Pause a running batchbrightpath batch pause batch-abc123# Resume a paused batchbrightpath batch resume batch-abc123
Merging Results
After tasks complete, merge the results into a cohesive output.
Automatic Merge
Code
# Merge with automatic strategybrightpath batch merge batch-abc123 --strategy auto
Merge Strategies
Auto Strategy
Automatically resolves conflicts based on:
Task completion time (latest wins)
Task success rate
Confidence scores from AI agents
Code
brightpath batch merge batch-abc123 --strategy auto