fix: save flow plot HTML to current working directory instead of temp directory#5016
Open
r266-tech wants to merge 1 commit intocrewAIInc:mainfrom
Open
fix: save flow plot HTML to current working directory instead of temp directory#5016r266-tech wants to merge 1 commit intocrewAIInc:mainfrom
r266-tech wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
… directory Fixes crewAIInc#4991. Modified render_interactive() to save files in the current working directory instead of creating a temporary directory.
Contributor
|
This PR is stale because it has been open for 45 days with no activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4991
Problem
When running
crewai flow plot, the framework generates the HTML visualization inside a hidden system temporary directory instead of the user's current working directory.The CLI outputs a misleading message:
Flow visualization saved to guide_creator_flow.html, leading users to believe the file was saved locally when it was not.Solution
Modified
render_interactive()increwai/flow/visualization/renderers/interactive.pyto save files in the current working directory instead of creating a temporary directory.Changes
tempfile.mkdtemp()toPath.cwd()for output directorytempfileimportTesting
The existing test
test_visualization_plot_method()passes with this change. Files are now correctly saved where users expect them.Note
Medium Risk
Changes where
crewai flow plotwrites files, which can affect user workflows and may overwrite existing files or fail under restricted permissions. Logic is small and localized to the interactive renderer.Overview
Flow interactive plot output is now written to the current working directory rather than a generated temp directory, so
crewai flow plotleaves the HTML/CSS/JS artifacts alongside the user’s project.render_interactive()was updated to usePath.cwd()foroutput_dir, and its docstring/return description were adjusted accordingly; the unusedtempfiledependency was removed.Written by Cursor Bugbot for commit abdfad7. This will update automatically on new commits. Configure here.