[HN Gopher] Show HN: Flow - A dynamic task engine for building A...
___________________________________________________________________
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://github.com/lmnr-ai/flow. 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
Author : skull8888888
Score : 35 points
Date : 2024-12-02 18:51 UTC (4 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| sprobertson wrote:
| I agree complex conditional LangGraph setups get pretty tedious
| after a certain point - though you claim to not use graphs here,
| but isn't that essentially what returning the "next task" does?
| The graph isn't explicitly defined but it still exists implicitly
| if you trace through all the tasks and next tasks.
|
| Would be interesting to see a complex agent implementation in
| both Flow and regular LangGraph to compare maintainability.
| skull8888888 wrote:
| In some sense yes, task dependencies do form a graph. However,
| what I meant when I was saying that graph is a wrong
| abstraction, is that predefined edges is a not the best of
| writing code when dealing with dynamic systems such as AI
| Agents.
|
| As you said, the easiest conditional workflows are tedious and
| we have to rely on "conditional" edges to solve the simplest
| stuff. Then, how would you define cycles or spawning of the
| same task multiple times as a node-edge relation? It becomes
| extremely inconvenient and just gets in your way. The reason I
| built Flow is exactly because I previously relied on a
| predefined node-edge system which I also built
| (https://docs.lmnr.ai/pipeline/introduction).
|
| Also it impossible to do MapReduce like operations on node-edge
| without inventing some special node for handling that stuff.
|
| Idea about comparing LangGraph and Flow is really good and I
| will work on that asap! What kind of workflows would you love
| to see implemented in Flow? Btw, there're a lot of examples in
| the readme and in the /tests folder
| mdaniel wrote:
| I did see the part about "graph is wrong," but the examples in
| the readme seem like you may find this interesting:
| https://news.ycombinator.com/item?id=42274399 _(Nodezator is a
| generalist Python node editor; 29 Nov 2024; 78 comments)_
| skull8888888 wrote:
| True, graph is not wrong per se, but in my experience I saw a
| lot of problems, the moment it starts to be a little more
| dynamic. Main problem is predefined edges. That's where you
| bump into things like conditional edges, cycles edges and so
| on. That's also my problem with frameworks like LangGraph. They
| just get in your way by pushing on things which looked like a
| good idea in the beginning.
___________________________________________________________________
(page generated 2024-12-02 23:00 UTC)