----------------------
Based on the knowledge sources provided, I can offer some insights about workflows in LlamaIndex, particularly regarding nested workflows and their management. However, the information doesn't directly address running a workflow indefinitely or the efficiency of managing multiple sub-workflows.
LlamaIndex does support nested workflows, which allows you to create more complex and customizable workflow structures. As described in the
Nested workflows documentation, you can create slots in existing workflows where you can supply additional workflows. This feature enables you to extend and customize workflows to suit your specific needs.
For example, you can create a main workflow that includes a slot for a nested workflow:
class MainWorkflow(Workflow):
@step
async def start(
self, ctx: Context, ev: StartEvent, reflection_workflow: Workflow
) -> Step2Event:
print("Need to run reflection")
res = await reflection_workflow.run(query=ev.query)
return Step2Event(query=res)
You can then supply a custom workflow to fill this slot:
w = MainWorkflow(timeout=10, verbose=False)
w.add_workflows(reflection_workflow=ReflectionFlow())
result = await w.run(query="Initial query")
While this demonstrates the ability to manage sub-workflows within a main workflow, the documentation doesn't mention running workflows indefinitely or provide information about the efficiency of managing multiple sub-workflows over extended periods.