chat api for convo flows#6034
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds a new ChangesImplementation and Tests
Conversational Flows Documentation (All Languages)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…chat-api-for-convo-flows
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/crewai/src/crewai/experimental/conversational_mixin.py`:
- Line 293: The REPL output in the chat() method prints result directly
(output_fn(f"{assistant_prefix}{result}")), bypassing the mixin's standard
coercion; update chat() to pass the value through the mixin's
_stringify_result() (e.g.,
output_fn(f"{assistant_prefix}{self._stringify_result(result)}")) so .raw
extraction and BaseModel JSON serialization are applied and terminal output
matches conversational history.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c2db877-c695-422c-aec2-631c8a1bb8db
📒 Files selected for processing (7)
docs/ar/guides/flows/conversational-flows.mdxdocs/en/guides/flows/conversational-flows.mdxdocs/ko/guides/flows/conversational-flows.mdxdocs/pt-BR/guides/flows/conversational-flows.mdxlib/crewai/src/crewai/experimental/conversational_mixin.pylib/crewai/src/crewai/flow/runtime.pylib/crewai/tests/test_flow_conversation.py
abstracts needing to setup a turn by turn experience for conversational flows
Note
Low Risk
Experimental conversational API only; changes are additive with docs and unit tests, no auth or production transport paths affected.
Overview
Adds
flow.chat()on conversational flows: a terminal REPL that loops on user input, delegates each line tohandle_turn(), prints assistant output, and always callsfinalize_session_traces()in afinallyblock. The method rejects non-conversational flows, supports injectableinput_fn/output_fn, customizable prompts and exit commands, optional blank-line skipping, and can temporarily enabledefer_trace_finalizationfor the session.Docs (en, ar, ko, pt-BR) are updated to document
chat()alongsidekickoff/handle_turn, replacing the old “kickoff-only / no custom chat wrapper” guidance and manualinput()loop examples withflow.chat(session_id=...).runtime.pycomments now listchatas an experimental conversational entry point.Tests cover REPL behavior (skip empty, quit, trace finalization, output stringification) and the
ValueErrorfor plain flows.Reviewed by Cursor Bugbot for commit 6d98513. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Documentation
Tests