AI / CrewAI Interview Questions
How does the @persist decorator enable state recovery across Flow executions?
Without persistence, an interrupted Flow, whether from a crash, a restart, or a long-running pause, would simply lose all of its accumulated state and have to start from the beginning.
- @persist saves the Flow's state, including its unique identifier and any stored data, to a backing store as execution proceeds
- Uses SQLite by default, suitable for single-instance deployments
- Can be configured for PostgreSQL when running across multiple instances in production, so state isn't tied to a single machine
This is what makes long-running or interruption-prone workflows, like ones that pause for @human_feedback, actually viable in production rather than fragile to any hiccup along the way.
More Related questions...