I am actually worried that the crew execution is often taking multiple seconds and this means that the request triggering the crew might time out before the result being returned. What I think makes more sense is to generate an ID for the request and the initial POST request to return the ID of the request only and then to add a GET endpoint to check the status of the request, and eventually this will return the completed result, once the crew execution is completed. This can be achieved with BackgroundTasks in FastAPI, and to start the crew execution as a background task and return some arbitrary UUID.
Actually, I found another user who implemented exactly this: Deploying CrewAI as an API service - #20 by italiano