Flows are currently in private alpha and subject to change. If you would like to use them, please reach out to re-factor Support.
Motivation
Flows in re-factor provide a powerful way to orchestrate complex AI workflows by combining prompts, agents, and tools into coherent processes. They enable you to build sophisticated AI applications while maintaining clarity and control over the execution process.Basic Features
A flow in re-factor consists of several key components:- A sequence of steps that define the workflow
- Input and output specifications for each step
- Error handling and retry logic
- State management across steps
- Monitoring and observability features
Enhanced Features
Step Definition
Steps in a flow can be any combination of:State Management
Flows maintain state across steps through:- Input/output passing between steps
- Shared context objects
- Persistent storage options
- Variable scoping rules
Error Handling
Flows provide robust error handling mechanisms:- Step-level retry policies
- Error recovery strategies
- Fallback paths
- Compensation handling for failed steps
Monitoring
Each flow comes with comprehensive monitoring capabilities:- Real-time execution tracking
- Step-level metrics
- Resource usage monitoring
- Performance analytics
Schema
Flows in re-factor are defined using Zod schemas that ensure type safety and validation:Step Schema
Flow Schema
Example Usage
Best Practices
When designing flows in re-factor:- Keep steps focused and single-purpose
- Handle errors at appropriate levels
- Use meaningful step names
- Document input/output requirements
- Monitor resource usage
- Test flows with various inputs

