LlamaIndex has a very different approach to graph flows than LangGraph, based on events rather than explicit (static or dynamic) connections. You can achieve the same results in both frameworks and they have both plus and minus.
Let’s assemble the same number-trials logic as in our LangGraph example.
the API has two special events StartEvent and StopEvent which define the starting node and the end node respectively.
you define custom events in function of the logic you wish to implement
the type of event accepted by a step function creates the graph flow
there is a global context where you can store whatever is necessary outside the local handler.
from IPython.display import IFrameIFrame(src='./workflow_all_flows.html', width=700, height=600)
Just as before with LangGraph, the workflow infrastructure was developed to embrace complex LLM logic beyond chains but you can use it for arbitrary workflow needs.
For oldtimers like me who witnessed Windows Workflow Foundations, API’s like this are a joy and so much easier than how one used to assemble flows. At the same time, it’s interesting to notice that finite state machines, flows (including things like n8n and PowerApps)) appear again and again in software development. Not everyone likes it but it’s clear that certain paradigns like workflows, visual programming, literate programming, declarative programming…have a place in any software stack.