crewAI
crewAI copied to clipboard
[BUG] Cannot properly kill a flow
Description
I have a flow with a simple crew inside. While running, if I try to fo CTRL+C to kill the process, I get an "Aborted!" and then the process follow and continue to stream to stdout.
I have to manually kill ".venv/bin/kickoff" to end the process. This does not happen with crew only projects.
Steps to Reproduce
- Create a flow with a crew
- kickoff the flow
- Try to abort with CTRL+C
- The process continues until ".venv/bin/kickoff" is killed
Expected behavior
The flow should stop :-)
Screenshots/Code snippets
Operating System
Other (specify in additional context)
Python Version
3.12
crewAI Version
0.114.0
crewAI Tools Version
0.40.1
Virtual Environment
Venv
Evidence
c'est screenshot above
Possible Solution
None
Additional context
I'm on MacOS Sequoia (this version is not in the list above).
Flows seems to be kickoff with async but not crews. So, I guess, KeyboardInterrupt is not properly captured
I found this in python doc. https://docs.python.org/3.13/library/asyncio-runner.html#handling-keyboard-interruption
@fmatray thank your for reporting that. Just one thing to note, this feature was introduced in Python 3.11, and we currently support Python 3.10. Really appreciate if you could be able to submit a PR with a fix
I’m sorry, I don’t have a fix. Werk you able to reproduce the issue ?
@fmatray Yeah - recently I found the same behavior by running the SeleniumCrawerTool, btw. I tried a simple fix but didn't work. Have to dedicate more time to understand at all
Marginally connected, but I have an agent that needs to run in in a wrapper code that has to support a graceful shutdown process. I'm intercepting SIGTERM signal to perform cleanup before the application finishes. However there seems to be no way to interrupt the crew while it's running via a method call for example. Am I missing something? Is there a recommended way to do this?
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.