Testing Locally with the CLI
The Buster CLI provides a local testing environment that simulates agent execution without affecting production systems.Installation
Install the Buster CLI globally using your preferred package manager:Verify installation:
Basic Testing
Execute an agent in a local sandbox environment.What happens:
- Agent runs in isolated sandbox
- Reads from your local repository
- Connects to your warehouse using local credentials
- All tools available (respects restrictions)
- Dry-run mode (no actual pushes to GitHub)
- Files read and modified
- SQL queries executed with results
- Tool calls and their outputs
- Agent reasoning and decision-making
- Actions attempted (PRs, comments, etc.)
- Any errors or warnings
Review the complete execution trace to understand agent behavior before deploying.
Testing Pull Request Triggers
Simulate a pull request without opening a real one.Available mock options:
--files- Comma-separated list of changed files--pr-title- Simulated PR title--pr-author- Simulated PR author--pr-number- Simulated PR number--base-branch- Target branch (default: main)--head-branch- Source branch
The agent will behave as if these files changed in a real PR, allowing you to test path filters and PR-specific logic.
Testing Scheduled Triggers
Provide custom context variables for scheduled agent testing.Context usage:
- Pass any key-value pairs defined in your trigger context
- Access in prompts via template variables
- Test different time windows and configurations
Testing Event Triggers
Simulate data stack events locally.Event simulation:
- Specify event type and source
- Provide event-specific data as JSON
- Test event filters and conditional logic
Validation
Validate agent configurations before testing execution.YAML Syntax Validation
Check agent configuration for syntax and structural errors.Validates:
- YAML syntax correctness
- Required fields present (
name,triggers,prompt) - Trigger configuration validity
- Tool preset and tool list compatibility
- Restriction consistency
- No conflicting configurations
Run validation before every test to catch configuration errors early.
Batch Validation
Validate all agents in a directory at once.Checks every
.yaml and .yml file in the directory and reports errors collectively.Integrate this into your CI/CD pipeline to prevent invalid configurations from reaching production.
Schema Validation
Validate against the full YAML schema with detailed error messages.Provides more detailed validation including:
- Type checking for all fields
- Enum value validation
- Pattern matching for specific fields
- Nested object validation
Debugging Strategies
Reading Agent Run Logs
When an agent doesn’t behave as expected, the run logs provide complete visibility into its execution.Access run logs in the web interface
Access run logs in the web interface
Navigate to Runs in the web app to see all agent executions. Each run includes:
-
Trigger Context - What caused the execution
- PR number, author, changed files (for PR triggers)
- Timestamp, cron expression (for scheduled triggers)
- Event name, source, data (for event triggers)
-
Files Accessed - Complete list of files read or modified
- File paths and operation types
- Content before/after for modifications
-
SQL Queries - All queries executed
- Full SQL text
- Execution time
- Rows returned
- Any errors
-
Tool Calls - Every tool invocation
- Tool name and parameters
- Output or return value
- Execution duration
-
Agent Reasoning - Decision-making process
- Why certain actions were taken
- How conclusions were reached
- Alternative approaches considered
-
Actions Taken - Final outcomes
- PRs created with links
- Comments posted
- Files modified
- Notifications sent
-
Errors - Any failures
- Error messages
- Stack traces
- Failed tool calls
Filter and search runs
Filter and search runs
Use filters to find specific runs:
- By agent name
- By trigger type
- By status (success, failure, timeout)
- By date range
- By changed files
- Search for specific file paths
- Find SQL queries mentioning tables
- Locate error messages
Download run logs
Download run logs
Export run logs for offline analysis or sharing:
Common Issues and Solutions
Agent didn't trigger when expected
Agent didn't trigger when expected
Possible causes:
-
Path filters don’t match
-
Branch filters exclude the PR
-
Conditions not satisfied
-
Event filters too restrictive
Agent didn't perform expected action
Agent didn't perform expected action
Possible causes:
-
Insufficient tool permissions
- Agent tried to use a tool not in its preset or include list
- Restrictions prevented the operation
-
Ambiguous prompt
- Agent interpreted instructions differently than intended
- Missing conditional logic
-
File/directory permissions
- Agent couldn’t access required files
- Path outside allowed directories
- Check tool calls in logs to see which tools were attempted
- Review agent reasoning to understand its interpretation
- Make prompt more specific with numbered steps and examples
Agent encountered errors
Agent encountered errors
Common errors:
-
Permission denied
Fix: Remove from critical_files or add approval gate
-
File not found
Fix: Verify file paths, check for typos
-
SQL timeout
Fix: Optimize query or increase
restrictions.sql.timeout_seconds -
Rate limit
Fix: Adjust rate limits or fix trigger logic causing excessive runs
Agent took wrong action
Agent took wrong action
Diagnosis:
- Review agent reasoning section to understand why it chose that action
- Check if prompt contains conditional logic that may have misfired
- Look for missing context or examples in the prompt
-
Add explicit conditions:
-
Provide examples:
-
Break into steps:
Iterating on Prompts
Most debugging involves refining the agent prompt. Start broad and add specificity based on test results.Iteration Strategy
1
Start with high-level goal
2
Add specific steps
3
Add detailed requirements
Testing Edge Cases
Test your agent with diverse scenarios:Empty or minimal changes
Empty or minimal changes
- PRs with no relevant file changes
- Single file changes
- Whitespace-only changes
Large or complex changes
Large or complex changes
- PRs with 50+ files changed
- Multiple model layers affected
- Complex SQL with CTEs and joins
Error conditions
Error conditions
- Invalid SQL syntax
- Missing required files
- Database connection failures
- Git conflicts
Different data patterns
Different data patterns
- Tables with all NULLs
- Empty tables
- Wide tables (many columns)
- Tables with unusual data types
Dry Run Mode
Test agents without making actual changes to your systems.Enable simulation mode for testing.Dry run behavior:
- ✓ Files read normally
- ✓ SQL queries execute (read-only enforced)
- ✗ Git operations simulated (no actual commits/pushes)
- ✗ PRs logged but not created
- ✗ Comments logged but not posted
- ✗ Notifications logged but not sent
Remove
dry_run: true before deploying to production. Agents won’t take real actions in dry-run mode.Rate Limiting
Prevent runaway agents and control execution frequency.Configure rate limiting to prevent excessive agent runs.Options:
max_runs_per_hour- Maximum executions in any 60-minute windowmax_runs_per_day- Maximum executions in any 24-hour periodcooldown_minutes- Minimum time between runs
Use rate limits during initial testing to prevent accidental cost or resource issues.
Best Practices
Pre-Deployment Testing Checklist
1
Validate configuration
2
Test with mock data
3
Review execution logs
Check that agent:
- Read correct files
- Executed expected queries
- Made intended decisions
- Produced desired output
4
Test edge cases
Run with empty PRs, large PRs, error conditions.
5
Enable dry run initially
6
Monitor first real runs
Watch first few production executions closely. Be ready to disable if needed.
Start Restrictive
Begin with the
safe preset and limited scope. Expand permissions as you gain confidence.Version Control for Agents
Track changes to agent configurations:Commit agent configurations to git with meaningful commit messages. This enables rollback if issues arise.
Progressive Rollout
Deploy agents gradually:- Test locally - Verify with
buster test - Deploy with dry run - Observe without actions
- Deploy with manual trigger - Test on-demand
- Enable for specific paths - Limit scope initially
- Full deployment - Enable all triggers and paths
Monitoring and Alerts
Set up monitoring for agent health:Troubleshooting Tools
Debug Mode
Run tests with verbose debug output.Shows additional information:
- Internal agent state
- Detailed tool call parameters
- Intermediate reasoning steps
- Cache hits/misses
Replay Mode
Replay a previous run locally for debugging.Re-executes the agent with the same trigger context, allowing you to test fixes against historical runs.
Diff Mode
Display file changes made by the agent.Shows before/after for all file modifications in unified diff format.