CUGA LogoCUGA AGENT
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 = true

2. 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

  1. Task Execution: CUGA executes a new task
  2. Pattern Recognition: Identifies successful execution patterns
  3. Generalization: Creates reusable workflow templates
  4. Storage: Saves workflows with metadata
  5. 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

ModeDescriptionUse Case
save_reuse_fastOptimized for speedDevelopment, testing
save_reuse_accurateOptimized for precisionProduction, critical tasks

๐Ÿ” Troubleshooting

Common Issues

IssueSolution
๐Ÿ”ด Workflows not savingCheck save_reuse.enabled setting
๐Ÿ”ด No workflow reuseVerify generalization settings
๐Ÿ”ด Poor generalizationProvide more diverse examples
๐Ÿ”ด Workflow conflictsCheck workflow validation settings
๐Ÿ”ด Storage errorsVerify storage path permissions

๐Ÿ“š Best Practices

Workflow Design

  1. Clear Intent: Use descriptive, specific queries
  2. Consistent Patterns: Follow similar query structures
  3. Parameter Variation: Test with different parameters
  4. Error Handling: Include error scenarios in examples

Generalization

  1. Diverse Examples: Provide varied but related examples
  2. Parameter Flexibility: Use variable parameters when possible
  3. Pattern Recognition: Help CUGA identify common patterns
  4. Validation: Test generalized workflows thoroughly

Maintenance

  1. Regular Review: Periodically review saved workflows
  2. Performance Monitoring: Track workflow performance
  3. Cleanup: Remove outdated or unused workflows
  4. Backup: Regular backup of workflow storage

๐Ÿ“š Next Steps

After mastering save & reuse:

  1. Advanced Features: Explore execution modes
  2. Evaluation: Test with benchmarks
  3. Development: Test and debug
  4. API Integration: Extend with custom APIs

Workflows saved? Explore Advanced Features next!