Usage
Save & Reuse
Learn how to save and reuse successful workflows with CUGA
CUGA's workflow persistence feature allows you to save successful task executions and reuse them for similar future requests, dramatically improving performance and consistency.
๐ Overview
What is Save & Reuse?
Save & Reuse is CUGA's intelligent workflow persistence system that:
- Remembers successful task executions
- Generalizes workflows for similar requests
- Accelerates future executions
- Maintains execution quality and consistency
Benefits
- โก Faster Execution: Reuse proven workflows instead of planning from scratch
- ๐ฏ Consistent Results: Maintain quality across similar requests
- ๐ Scalability: Handle more requests with the same resources
- ๐ Learning: Continuously improve from successful executions
โ๏ธ Setup
Enable Save & Reuse
1. Configuration
Change settings.toml:
[features]
cuga_mode = "save_reuse_fast" # or "save_reuse_accurate"
[save_reuse]
enabled = true
storage_path = "./workflows"
generalization_enabled = true
validation_enabled = true2. Environment Variables
# Enable save & reuse mode
export CUGA_MODE="save_reuse_fast"
# Set storage location
export CUGA_WORKFLOW_STORAGE="./workflows"3. Start Demo
# Start with save & reuse enabled
cuga start demo๐ฏ How It Works
Workflow Lifecycle
1. First Request โ 2. Execute & Learn โ 3. Save Workflow โ 4. Reuse & Improve
โ โ โ โ
New Task Task Execution Workflow Storage Future Requests
(Planning) (Learning) (Persistence) (Acceleration)Learning Process
- Task Execution: CUGA executes a new task
- Pattern Recognition: Identifies successful execution patterns
- Generalization: Creates reusable workflow templates
- Storage: Saves workflows with metadata
- Retrieval: Finds and applies relevant workflows for similar requests
๐งช Demo Walkthrough
Step 1: First Run (Learning)
Start with a new query to establish the workflow:
# Start demo
cuga start demo
# First query (new workflow)
"get top account by revenue"What Happens:
- CUGA plans and executes the task
- Learns the execution pattern
- Prompts for workflow approval
- Saves the successful workflow
Step 2: Workflow Approval
When the task completes, CUGA will prompt:
โ
Task completed successfully!
๐พ Save this workflow for future use? (y/n)
๐ Provide additional examples to improve generalization:Provide Examples:
"get top 2 accounts by revenue"
"show me the top 3 accounts by revenue"
"find top 5 accounts by revenue"Step 3: Workflow Storage
CUGA will process and save the workflow:
๐ Processing workflow...
๐ Generalizing patterns...
๐พ Workflow saved successfully!
๐ฏ Ready for reuse!Step 4: Verify Reuse
Test the saved workflow with a similar query:
# Similar query (should use saved workflow)
"get top 4 accounts by revenue"Expected Result:
- Faster execution
- Uses saved workflow
- Consistent results
- No planning phase needed
๐ง Configuration Options
Save & Reuse Modes
| Mode | Description | Use Case |
|---|---|---|
save_reuse_fast | Optimized for speed | Development, testing |
save_reuse_accurate | Optimized for precision | Production, critical tasks |
๐ Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| ๐ด Workflows not saving | Check save_reuse.enabled setting |
| ๐ด No workflow reuse | Verify generalization settings |
| ๐ด Poor generalization | Provide more diverse examples |
| ๐ด Workflow conflicts | Check workflow validation settings |
| ๐ด Storage errors | Verify storage path permissions |
๐ Best Practices
Workflow Design
- Clear Intent: Use descriptive, specific queries
- Consistent Patterns: Follow similar query structures
- Parameter Variation: Test with different parameters
- Error Handling: Include error scenarios in examples
Generalization
- Diverse Examples: Provide varied but related examples
- Parameter Flexibility: Use variable parameters when possible
- Pattern Recognition: Help CUGA identify common patterns
- Validation: Test generalized workflows thoroughly
Maintenance
- Regular Review: Periodically review saved workflows
- Performance Monitoring: Track workflow performance
- Cleanup: Remove outdated or unused workflows
- Backup: Regular backup of workflow storage
๐ Next Steps
After mastering save & reuse:
- Advanced Features: Explore execution modes
- Evaluation: Test with benchmarks
- Development: Test and debug
- API Integration: Extend with custom APIs
Workflows saved? Explore Advanced Features next!
