Adaptive Workflows
Automatic failure detection and remediation paths for resilient workflows
Adaptive workflows automatically detect failures during execution and provide remediation paths to recover without abandoning progress.
How It Works#
When a workflow phase fails, Bootspring:
- Detects the failure type (testing, security, performance, deployment, database)
- Suggests a remediation path with specific steps
- Guides you through recovery with the right agents
- Resumes the workflow once the issue is resolved
┌──────────────────────────────────────────────────────┐
│ Normal Workflow │
│ Phase 1 ───▶ Phase 2 ───▶ Phase 3 ───▶ Complete │
└───────────────────┬──────────────────────────────────┘
│ Failure
▼
┌──────────────────────────────────────────────────────┐
│ Remediation Path │
│ Diagnose ───▶ Fix ───▶ Verify ───▶ Resume │
└──────────────────────────────────────────────────────┘
Supported Failure Types#
Testing Failure#
Triggered when tests fail during a workflow phase.
1REMEDIATION_PATHS['testing-failure'] = {
2 steps: [
3 { action: 'analyze_failures', agent: 'testing-expert' },
4 { action: 'fix_issues', agent: 'code-review-expert' },
5 { action: 'rerun_tests', agent: 'testing-expert' }
6 ]
7}Security Failure#
Triggered when security vulnerabilities are detected.
1REMEDIATION_PATHS['security-failure'] = {
2 steps: [
3 { action: 'security_audit', agent: 'security-expert' },
4 { action: 'remediate', agent: 'security-expert' },
5 { action: 'verify', agent: 'security-expert' }
6 ]
7}Performance Failure#
Triggered when performance metrics don't meet requirements.
1REMEDIATION_PATHS['performance-failure'] = {
2 steps: [
3 { action: 'profile', agent: 'performance-expert' },
4 { action: 'optimize', agent: 'performance-expert' },
5 { action: 'benchmark', agent: 'performance-expert' }
6 ]
7}Deployment Failure#
Triggered when deployment fails.
1REMEDIATION_PATHS['deployment-failure'] = {
2 steps: [
3 { action: 'diagnose', agent: 'devops-expert' },
4 { action: 'fix_config', agent: 'devops-expert' },
5 { action: 'retry_deploy', agent: 'devops-expert' }
6 ]
7}Database Failure#
Triggered when database operations fail.
1REMEDIATION_PATHS['database-failure'] = {
2 steps: [
3 { action: 'analyze_schema', agent: 'database-expert' },
4 { action: 'fix_migration', agent: 'database-expert' },
5 { action: 'verify_data', agent: 'database-expert' }
6 ]
7}Using Adaptive Workflows#
Reporting a Failure#
# Report a test failure
bootspring workflow report-failure testing
# Report with details
bootspring workflow report-failure security --details "SQL injection in user input"Starting Remediation#
1# Start remediation for a failure
2bootspring workflow remediate <failure-id>
3
4# Output:
5# Remediation started. First step: Analyze test failures
6# Agent: testing-expertAdvancing Through Remediation#
1# Complete current step and move to next
2bootspring workflow remediation-next
3
4# Output:
5# Step 2/3: Fix failing code
6# Agent: code-review-expertCompleting Remediation#
1# After all steps
2bootspring workflow remediation-next
3
4# Output:
5# Remediation complete. You can resume the workflow.
6bootspring workflow resumeAPI Usage#
1const orchestrator = require('bootspring/intelligence/orchestrator');
2
3// Report a failure
4const failure = orchestrator.reportPhaseFailure('testing', {
5 message: 'Integration tests failing',
6 errorCount: 3
7});
8// { success: true, failureId: 'failure-123', remediation: {...} }
9
10// Start remediation
11const remediation = orchestrator.startRemediation(failure.failureId);
12// { success: true, currentStep: { action: 'analyze_failures', agent: '...' } }
13
14// Advance through steps
15orchestrator.advanceRemediation();
16// { success: true, complete: false, stepNumber: 2 }
17
18// Complete remediation
19orchestrator.advanceRemediation();
20// { success: true, complete: true, message: 'Remediation complete' }
21
22// Resume workflow
23orchestrator.resumeWorkflow();Failure History#
View past failures and their resolutions:
const failures = orchestrator.getWorkflowFailures();
// [
// { id: 'failure-123', type: 'testing', resolved: true, resolvedAt: '...' },
// { id: 'failure-124', type: 'security', resolved: false }
// ]Best Practices#
- Be specific - Include details when reporting failures
- Follow the path - Trust the remediation steps in order
- Verify before resuming - Ensure the fix actually works
- Learn from failures - Check failure history for patterns