A comprehensive guide to managing, persisting, and leveraging state in CrewAI Flows for building robust AI applications.
self.state
which behaves like a dictionaryself.state
, which behaves like a Pydantic model instanceself.state["id"]
self.state.id
@persist()
decorator automates state persistence, saving your flow’s state at key points in execution.
@persist()
saves state after every method execution:
@persist()
to specific methods: