Skip to content

[Feature Request]: Add workflow step cancellation mechanism #20314

@yevhenii-volynskyi

Description

@yevhenii-volynskyi

Feature Description

Add the ability to cancel or abort a workflow step from within another step in LlamaIndex workflows.

Reason

Currently, LlamaIndex workflows execute steps based on event triggers, but there's no built-in mechanism for one step to cancel or abort another step's execution.

Use case example

                    ┌─────────┐
                    │ Step A  │
                    └────┬────┘
                         │
              ┌──────────┴──────────┐
              │ (parallel execution)│
              │                     │
         ┌────▼────┐           ┌────▼────┐
         │ Step A1 │◄─ ─ ─ ─ ─ │ Step A2 │
         └────┬────┘  cancels  └────┬────┘
              x                     │
              │                     │
         ┌────▼────┐           ┌────▼────┐
         │ Step B1 │           │ Step B2 │
         └────┬────┘           └────┬────┘
              x                     │
              └──────────┬──────────┘
                         │
                    ┌────▼────┐
                    │ Step C  │
                    └─────────┘

Step A1 is slow, and can be skipped when a condition discovered in the parallel step A2 is satisfied. Should have the ability to stop A1's execution immediately and discard its entire downstream branch as soon as A2 produces that condition, for example via AbortEvent.

Value of Feature

This feature would significantly improve the flexibility and robustness of LlamaIndex workflows for production use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageIssue needs to be triaged/prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions