Hacker News new | ask | show | jobs
by scribu 564 days ago
Nice approach!

I'm intrigued by the ability to start execution from a particular task.

One thing I like about LangGraph is the declarative state merging. In the MapReduce example, how do you guarantee that the collector.append() operation is thread-safe?

2 comments

Thank you! Good question. Behind the scenes, state is manage via Semaphore. So each call to .get(...) acquires a semaphore with a single permit so it essentially guarantees thread-safety. Check out how the state is implemented here https://github.com/lmnr-ai/flow/blob/main/src/lmnr_flow/stat...
Also curious, what kind of agents are you building with LangGraph. Would be more than happy to help you onboard to Flow!