Show HN: Flow – A dynamic task engine for building AI agents 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. 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. Flow is built on 3 core principles: * Concurrent Execution - Tasks run in parallel automatically * Dynamic Scheduling - Tasks can schedule new tasks at runtime * Smart Dependencies - Tasks can await results from previous operations All tasks share a thread-safe context for state management. 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. Flow is lightweight, elegantly written and has zero dependencies for the engine. Behind the scenes it's a ThreadPoolExecutor, which is more than enough to handle concurrent execution considering majority of AI workflows are IO bound. 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. The project also comes with built-in OpenTelemetry instrumentation for debugging and state reconstruction. Give it a try here -> https://ift.tt/uHkcvMD . Just do pip install lmnr-flow. (or uv add lmnr-flow). More examples are in the readme. Looking forward to feedback from the HN community! Especially interested in hearing about your use cases for dynamic workflows. Couple of things on the roadmap, so contributions are welcome! * Async function support * TS port * Some consensus on how to handle task ids when the same tasks is spawned multiple times https://ift.tt/uHkcvMD December 2, 2024 at 09:51PM
0 Comments