Production workflows need polling, error handling, retries, and monitoring. This guide shows battle-tested patterns for building robust baking pipelines.Documentation Index
Fetch the complete documentation index at: https://docs.bread.com.ai/llms.txt
Use this file to discover all available pages before exploring further.
These patterns build on the basic baking workflows. Use them when deploying to production.
Overview
Production-ready baking workflows need:- Job polling - Wait for async operations (stim, rollout, bake) to complete
- Error handling - Gracefully handle auth failures, timeouts, API errors
- Retry logic - Automatically retry transient failures
- Logging - Track progress for debugging and monitoring
- Timeouts - Prevent jobs from running indefinitely
- Async support - Better concurrency for high-throughput pipelines
Job Polling Pattern
The Problem
Stim, rollout, and bake jobs run asynchronously. You need to wait for completion:The Solution
Poll for job status with proper intervals:Recommended Poll Intervals
| Job Type | Interval | Typical Duration |
|---|---|---|
| Stim | 5 seconds | 30s - 5min |
| Rollout | 10 seconds | 2min - 30min |
| Bake | 30 seconds | 10min - 2hours |
Error Handling Pattern
Comprehensive Error Handling
Handle specific error types with appropriate responses:Retry Pattern
Automatic Retries for Transient Failures
Some failures are temporary (network blips, rate limits). Retry with exponential backoff:Logging Pattern
Structured Logging for Production
Use proper logging libraries for log levels and formatting:Async Pattern
Async/Await for Better Concurrency
Use async workflows when running multiple bakes in parallel:Complete Production Example
Putting it all together:Best Practices
Use Appropriate Timeouts
Use Appropriate Timeouts
Set realistic timeouts based on job type. Stim: 1h, Rollout: 2h, Bake: 4h.
Log Everything
Log Everything
Log start/completion of each phase, error details, and timing info for debugging.
Retry Transient Failures
Retry Transient Failures
Automatically retry connection errors and rate limits with exponential backoff.
Handle All Error Types
Handle All Error Types
Catch specific exceptions (AuthenticationError, APIConnectionError) not just Exception.
Use Async for Parallel Jobs
Use Async for Parallel Jobs
Process multiple targets concurrently with asyncio for better throughput.
Next Steps
Error Handling Guide
Deep dive on SDK error types
Bake Configuration
Detailed bake configuration reference
Single-Prompt Bake
Review basic baking workflow
Multi-Target Baking
Apply patterns to multi-target workflows