Contract Properties
- Name - Unique identifier for the contract
- Version - Supports contract evolution
- Rules - Validation logic for steps and transitions
- Entry Points - Valid starting steps
- Terminal Steps - Steps that complete the thread
- Timeouts - Maximum duration for steps and threads
Contract Rules
Contracts can validate:- Step data - Required fields and data formats
- Step sequences - Which steps can follow others
- Time limits - Maximum execution time for steps and threads
- Business logic - Custom validation rules
Contract Benefits
- Real-time validation - Rules checked as steps execute
- Business enforcement - Ensure processes follow requirements
- Error prevention - Catch violations before they cause issues
- Documentation - Contracts serve as living documentation
Contract Structure
Using Your Contract
Once created, contracts validate required fields automatically:The
// required comments refer to the business_context.required fields defined in the contract YAML sample above. See how order_id, product_id, and quantity are listed under steps[0].business_context.required.Contract Validation
Contracts validate in real-time:| Validation | Description | Severity |
|---|---|---|
| Entry Point | First step must be in entry_points | Critical |
| Required Fields | Context must include all required fields | Critical |
| Transitions | Steps must follow allowed transitions | Critical |
| Step Timeout | Step must complete within timeout | Critical |
| Thread Duration | Thread must complete within max_duration | Critical |
| Optional Fields | Missing optional fields logged | Info |