Back to Copilotkit

Message Persistence

showcase/shell-docs/src/content/docs/integrations/crewai-flows/persistence/message-persistence.mdx

1.68.11.2 KB
Original Source
<Callout> To learn about how to load previous messages and agent states, check out the [Loading Message History](/crewai-flows/persistence/loading-message-history) and [Loading Agent State](/crewai-flows/persistence/loading-agent-state) pages. </Callout>

To persist CrewAI Flow messages to a database, you can use the @persist decorator. For example, you might use the default SQLiteFlowPersistence or provide your own custom persistence class.

<Callout type="info" title="Conversational Flow sessions"> No separate CopilotKit persistence adapter is required. CopilotKit's `threadId` becomes the CrewAI `session_id`, so CrewAI's `@persist` support stores and restores the corresponding conversational session. </Callout>

For a concrete example of how a custom persistence class like InMemoryFlowPersistence can be implemented and used with the @persist decorator, see the sample agent implementation.

Read more about persistence in the CrewAI Flows documentation.