{"by":"skull8888888","descendants":50,"id":42299098,"kids":[42300300,42303765,42302157,42303102,42305664,42303169,42301859,42308046,42302147,42300464,42302190,42302960,42305720,42308206],"score":160,"text":"I think graph is a wrong abstraction for building AI agents. Just look at how incredibly hard it is to make routing using LangGraph - conditional edges are a mess.<p>I built Laminar Flow to solve a common frustration with traditional workflow engines - the rigid need to predefine all node connections. Instead of static DAGs, Flow uses a dynamic task queue system that lets workflows evolve at runtime.<p>Flow is built on 3 core principles:<p>* Concurrent Execution - Tasks run in parallel automatically<p>* Dynamic Scheduling - Tasks can schedule new tasks at runtime<p>* Smart Dependencies - Tasks can await results from previous operations<p>All tasks share a thread-safe context for state management.<p>This architecture makes it surprisingly simple to implement complex patterns like map-reduce, streaming results, cycles, and self-modifying workflows. Perfect for AI agents that need to make runtime decisions about their next actions.<p>Flow is lightweight, elegantly written and has zero dependencies for the engine.<p>Behind the scenes it&#x27;s a ThreadPoolExecutor, which is more than enough to handle concurrent execution considering majority of AI workflows are IO bound.<p>To make it possible to wait for the completion of previous tasks, I just added semaphore for the state value. Once the state is set, one permit is released for the semaphore.<p>The project also comes with built-in OpenTelemetry instrumentation for debugging and state reconstruction.<p>Give it a try here -&gt; <a href=\"https:&#x2F;&#x2F;github.com&#x2F;lmnr-ai&#x2F;flow\">https:&#x2F;&#x2F;github.com&#x2F;lmnr-ai&#x2F;flow</a>. Just do pip install lmnr-flow. (or uv add lmnr-flow). More examples are in the readme.<p>Looking forward to feedback from the HN community! Especially interested in hearing about your use cases for dynamic workflows.<p>Couple of things on the roadmap, so contributions are welcome!<p>* Async function support<p>* TS port<p>* Some consensus on how to handle task ids when the same tasks is spawned multiple times","time":1733165463,"title":"Show HN: Flow – A dynamic task engine for building AI agents","type":"story","url":"https://github.com/lmnr-ai/flow"}