Skip to content

Streaming workflow with nested workflow(s) #15838

Answered by dosubot bot
anirbanbasu asked this question in Q&A
Discussion options

You must be logged in to vote

To handle multiple parallel triggers in the main workflow that call the nested workflow without causing the WorkflowRuntimeError due to concurrent runs, you can dynamically create and manage multiple instances of the nested workflow. This approach ensures that each nested workflow instance is only run once, thus avoiding the WorkflowRuntimeError.

Here is an example of how you can achieve this:

Main Workflow

import asyncio
from llama_index.core.workflow import (
    StartEvent,
    StopEvent,
    Workflow,
    step,
    Event,
    Context,
)

class ProcessEvent(Event):
    data: str

class ResultEvent(Event):
    result: str

class MainWorkflow(Workflow):
    @step
    async def start(self, 

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@anirbanbasu
Comment options

@dosubot
Comment options

@anirbanbasu
Comment options

@dosubot
Comment options

Answer selected by anirbanbasu
@anirbanbasu
Comment options

@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant