<@ULVA73B9P> Is it possible to run an async flow w...
# ask-marvin
n
@Marvin Is it possible to run an async flow within in a sync flow?
m
I need to confirm your Prefect version to provide accurate guidance. Could you please let me know if you're using Prefect 2.x or 3.x? Otherwise, I can guide you on how to find your current Prefect version.
n
@Marvin Prefect 2.x
m
In Prefect 2.x, you can manage synchronous (sync) and asynchronous (async) operations within their respective contexts using the concurrency tools provided by Prefect. Prefect doesn't naturally support running an async flow within a sync flow directly; however, you can manage both types separately using different concurrency management contexts. If you want to incorporate async tasks within a sync flow, you typically need to await them properly, necessitating an async flow context. Here's a useful guide on global concurrency limits in Prefect 2.x that explains how to manage both sync and async operations. For further details on running async functions within Prefect, you might consider converting the enclosing flow into an async flow to accommodate async tasks. If you need to mix sync and async operations frequently, structuring them as separate flows might be beneficial for clean execution and better control.