Multi-Tool Recovery Demo
This demo shows how StateBase handles a realistic production scenario: an AI travel agent that needs to call multiple external APIs (flights, hotels, weather) to complete a booking—and what happens when those APIs fail.The Scenario
User Goal: Book a weekend trip to San Francisco Agent Tasks:- Search for flights
- Check hotel availability
- Get weather forecast
- Confirm booking
Without StateBase: Cascading Failures
Here’s what happens in a traditional agent when APIs fail:With StateBase: Graceful Recovery
StateBase checkpoints progress after each successful step:The Recovery Flow
Here’s what happens behind the scenes:Attempt 1: Partial Success
Attempt 2: Full Success
Code Walkthrough
Let’s break down the key StateBase features used:1. Checkpointing After Each Step
2. Checking for Cached Data
3. Graceful Degradation
4. Rollback on Critical Failures
Full Working Example
Here’s a complete, runnable example:Key Takeaways
- Checkpoint after each successful step → Don’t lose progress
- Check cache before retrying → Save money and time
- Distinguish critical vs optional → Graceful degradation
- Roll back on corruption → Prevent cascading failures
Try It Yourself
- Copy the code above
- Replace
"your-key"with your StateBase API key - Run it multiple times to see different failure scenarios
- Observe how StateBase preserves progress across retries
Next Steps
- Checkpoints & Rollbacks: Deep dive into recovery strategies
- Failure Modes: Learn all 7 common failure patterns
- Tool Calling Pattern: Best practices for external API calls
The Bottom Line: Production AI agents deal with unreliable external systems. StateBase ensures that one API timeout doesn’t force users to start over from scratch.