crewai - ✅(Solved) Fix [FEATURE] Enhance the document about @persisit [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#5372Fetched 2026-04-10 03:43:01
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1mentioned ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #5373: fix: log persistence storage location for @persist decorator

Description (problem / solution / changelog)

Summary

When using @persist on a flow, users had no way to discover where their flow state was being stored. The default SQLiteFlowPersistence resolves its path via appdirs.user_data_dir(), which is platform-specific and was never surfaced to the user. This addresses #5372.

Changes:

  • SQLiteFlowPersistence._setup() now logs the resolved db_path at INFO level on initialization
  • PersistenceDecorator.persist_state() now logs the storage location (the db_path for SQLite, or the class name for custom backends) at INFO level after each state save
  • When verbose=True, the storage location is also printed to the console via PRINTER
  • Adds 5 new tests covering path discoverability (init logging, save logging, verbose output, class-level decorator)

Behavioral note: The old save_state log message was renamed from "Saving flow state to memory for ID: {}" to "Saving flow state for ID: {}". The storage location is now logged unconditionally at INFO level on every save (previously, no log was emitted with verbose=False).

Review & Testing Checklist for Human

  • Verify the INFO-level log on every save is acceptable noise. The storage location is logged at INFO on every persist_state() call, not just the first. For flows with many persisted steps, this could be chatty. Consider whether this should be DEBUG instead, or only logged once per persistence instance.
  • Check the removed QuietFlow test was intentional. The old test asserted that verbose=False produced no "Saving flow state" logs. This assertion is no longer valid because storage location is now always logged at INFO. The test was removed rather than updated — confirm this behavioral change is desired.
  • Verify getattr fallback for custom persistence backends. For non-SQLite backends without a db_path attribute, the log falls back to type(persistence_instance).__name__. Confirm this is useful enough for custom implementations.

Notes

  • To manually verify: run any flow with @persist() and check that the log output includes the SQLite database path. Enable Python INFO logging (e.g., logging.basicConfig(level=logging.INFO)) or use verbose=True on the decorator.

Link to Devin session: https://app.devin.ai/sessions/0bf4c592e402444eb5656a8159404869

<!-- CURSOR_SUMMARY -->

[!NOTE] Low Risk Low risk behavior change limited to additional INFO-level logging during persistence initialization and every state save; main concern is potential log noise or tests that assume quiet default logging.

Overview Makes persisted flow state discoverable by logging where it is stored.

@persist now logs an INFO message after each save that includes the flow ID and the persistence storage location (uses db_path when available, otherwise the backend class name), and prints the same message to the console when verbose=True. SQLiteFlowPersistence also logs its resolved db_path on initialization.

Updates and expands tests to cover the new logging behavior (including default path logging, save-time storage logging, verbose output, and class-level @persist).

<sup>Reviewed by Cursor Bugbot for commit 3758361d7435e62fbcd0d6b13e2cf4cf809475ff. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

  • lib/crewai/src/crewai/flow/persistence/decorators.py (modified, +10/-8)
  • lib/crewai/src/crewai/flow/persistence/sqlite.py (modified, +5/-0)
  • lib/crewai/tests/test_flow_persistence.py (modified, +89/-17)
RAW_BUFFERClick to expand / collapse

Feature Area

Documentation

Is your feature request related to a an existing bug? Please link it here.

In the document flow-persistence, it will persist the state when use the decorator @persist, but i can' find where does it persist. The assistant AI tells me it should be a SQLite, but it also doesn't know where it is stored

Describe the solution you'd like

Please add the description about where is the SQLite

Describe alternatives you've considered

No response

Additional context

No response

Willingness to Contribute

No, I'm just suggesting the idea

extent analysis

TL;DR

The documentation for flow-persistence should be updated to include information on where the SQLite database is stored when using the @persist decorator.

Guidance

  • Review the documentation for any mentions of default storage locations or configuration options for the @persist decorator.
  • Check the code implementation of the @persist decorator to see if it provides any hints about the storage location.
  • Consider searching the project's codebase for any references to SQLite database connections or configurations.
  • Look for any environment variables or settings that might control the storage location of the SQLite database.

Notes

The issue lacks specific technical details about the implementation of the @persist decorator, so it's difficult to provide a more precise solution.

Recommendation

Apply workaround: Update the documentation to include a note about the unclear storage location and suggest that users investigate the code implementation for more information.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING