[FEATURE] Add read-only CLI listing and inspection for persisted Flow states
Python PR scope
Expose the new flow_states history/read API through the existing CLI organization, with text and machine-readable JSON output. Make the storage kind explicit so this is not confused with full-object checkpoints.
Difficulty: medium. Allocation index: #8118. Project: #8121.
Cohort allocation
This ticket is reserved for maintainer-coordinated allocation to the Stanford semester collaboration. Please wait for @lorenzejay to confirm an assignee before implementing. A comment expresses interest; it does not establish ownership. Public good first issue / help wanted discovery labels will be considered after cohort allocation.
GitHub usernames have not yet been supplied, so no individual assignment is implied.
Acceptance criteria
- [ ] Support a user-specified database path, Flow UUID, bounded history listing, and exact record inspection.
- [ ] Reuse Click/Rich conventions and confirm the command shape with maintainers before implementation.
- [ ] Never create a missing database, write state, or change journal settings as a side effect of inspection.
- [ ] Test JSON output, empty/missing stores, wrong UUIDs, invalid limits, and unsupported SQLite schemas with CliRunner/temp files.
- [ ] Keep existing checkpoint list/info/resume commands unchanged.
Dependencies and coordination
- Depends on #8138.
- Depends on #8139.
Starting points
- lib/cli/src/crewai_cli/cli.py
- lib/cli/src/crewai_cli/checkpoint_cli.py
- lib/cli/tests
- lib/crewai/src/crewai/flow/persistence/sqlite.py
Submission
The contributor implements this scope and submits one focused PR linked to this open issue. Include full Python annotations, behavioral tests, and relevant quality checks. No paid API calls are required for the tests. Preserve existing APIs outside the scoped feature. For newly found defects, reproduce them and check active issues/PRs before fixing them. Docs edits, when needed, belong under docs/edge/ and must sync ar, ko, pt-BR per DOCS_TRANSLATIONS.md. Follow .github/CONTRIBUTING.md. Issue prepared with AI assistance.
Hi @lorenzejay,
I would like to take this issue.
Plan:
- Implement a clean read-only inspection query on
SQLiteFlowPersistencethat fetches historical state metadata without triggering schema/journal initialization side-effects. - Expose the CLI subcommand (
crewai flow list-states/inspect-state) to display formatted tables of execution timestamps, step methods, and state metadata. - Add unit tests covering multiple UUIDs, pagination, and invalid Flow IDs.
Could you please assign this to me
Hi @lorenzejay, I'm in the Stanford cohort (I did #8129 / #8167) and would like to take this one.
Proposed command shape, under the existing crewai flow group:
crewai flow states <FLOW_UUID> --db PATH [--limit N] [--offset N] [--json]: a bounded history listing built onlist_state_historyfrom #8253.crewai flow state <FLOW_UUID> <RECORD_ID> --db PATH [--json]: exact record inspection viaload_state_from_historyfrom #8272.
The output would label the storage kind as flow_states so it isn't confused with checkpoints. Inspection opens SQLite read-only (mode=ro URI), so it never creates a missing database, writes state, or changes journal settings. Tests would use CliRunner with temp files and cover JSON output, empty and missing stores, wrong UUIDs, invalid limits, and unsupported schemas. crewai checkpoint commands stay unchanged.
I'll build against #8253's interface and rebase once it merges. Does this command shape work for you?
Hi @lorenzejay — I'd like to take this ticket if it's still unallocated. I'm a student in the Stanford CS 146S cohort.
Plan
- Confirm the command shape with you before writing code (e.g.
listandinfosubcommands for flow states, kept separate from the existing checkpoint commands so the storage kind is explicit). - Build exact-record inspection first, on top of
SQLiteFlowPersistence.load_state_from_history, which is already on main. - Add bounded history listing once #8138 lands, reusing its API rather than writing a second query path.
- Open the database read-only, so inspection never creates a missing file, writes state, or changes journal settings.
- Provide Rich text output and
--jsonoutput, following the conventions incheckpoint_cli.py. - Add CliRunner tests with temp files for JSON output, empty and missing stores, wrong UUIDs, invalid limits, and unsupported schemas.
Outcome
One focused PR linked to this issue, with full type annotations and tests that need no paid API calls. Existing checkpoint list/info/resume behaviour stays unchanged.
Question Since listing depends on #8138, would you prefer I wait for it, or submit inspection first and listing as a follow-up?
I won't start implementing until you confirm the assignment.