Skip to content

fix(flow): save plot output to CWD instead of hidden temp directory#5003

Closed
NIK-TIGER-BILL wants to merge 1 commit into
crewAIInc:mainfrom
NIK-TIGER-BILL:fix/flow-plot-save-to-cwd
Closed

fix(flow): save plot output to CWD instead of hidden temp directory#5003
NIK-TIGER-BILL wants to merge 1 commit into
crewAIInc:mainfrom
NIK-TIGER-BILL:fix/flow-plot-save-to-cwd

Conversation

@NIK-TIGER-BILL
Copy link
Copy Markdown
Contributor

Summary

Fixes #4991

render_interactive() was always writing the HTML, CSS, and JS files into a directory created by tempfile.mkdtemp(prefix="crewai_flow_"). This caused crewai flow plot to print a misleading success message like:

Flow visualization saved to guide_creator_flow.html

…while the actual file landed in a hidden /tmp/crewai_flow_…/ path that the user cannot easily find.

Changes

  • Replace tempfile.mkdtemp() with a CWD-based output directory
  • If filename already contains a directory component, that directory is used
  • Otherwise Path.cwd() is used, so files appear in the user's working directory
  • Remove now-unused import tempfile
  • Update docstring to document the new resolution logic

Testing

Existing tests continue to pass. The fix is consistent with user expectation described in the issue: running crewai flow plot now produces guide_creator_flow.html (and its sibling CSS/JS files) in the current working directory.

Fixes crewAIInc#4991

Previously, render_interactive() always wrote the HTML, CSS, and JS
files into a directory created by tempfile.mkdtemp(), so running
`crewai flow plot` would print a misleading success message while the
actual file ended up in a hidden /tmp/… path.

Now the output directory is derived from the filename argument:
- If filename contains a directory component, that directory is used.
- Otherwise the files are written to Path.cwd() (the user's working dir).

The temporary-directory import is no longer needed and has been removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] crewai flow plot saves HTML to a hidden temp directory instead of the current working directory (despite CLI message)

1 participant