[PR #264] [MERGED] feat: add dedicated StopEvent subclasses for workflow termination scenarios #270

Closed
opened 2026-02-16 02:17:06 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/workflows-py/pull/264
Author: @adrianlyjak
Created: 1/6/2026
Status: Merged
Merged: 1/10/2026
Merged by: @adrianlyjak

Base: mainHead: claude/workflow-timeout-error-cPvHN


📝 Commits (7)

  • 02a6e73 feat: add dedicated StopEvent subclasses for workflow termination scenarios
  • 9099ddd refactor: simplify termination events to inherit directly from StopEvent
  • 26ff616 chore: add changeset
  • 1ca2384 feat: add traceback and fully qualified exception type to WorkflowFailedEvent
  • 5b22d48 feat: add retry info (attempts, elapsed_seconds) to WorkflowFailedEvent
  • f3b52c6 fix lints/locks
  • a8d9561 docs: add workflow termination events to streaming docs

📊 Changes

9 files changed (+353 additions, -29 deletions)

View changed files

.changeset/workflow-termination-events.md (+5 -0)
📝 docs/api_docs/docs/api_reference/events.md (+3 -0)
📝 docs/src/content/docs/llamaagents/workflows/streaming.mdx (+24 -0)
📝 packages/llama-index-workflows/src/workflows/events.py (+73 -0)
📝 packages/llama-index-workflows/src/workflows/runtime/control_loop.py (+36 -9)
📝 packages/llama-index-workflows/src/workflows/runtime/types/step_function.py (+1 -1)
📝 packages/llama-index-workflows/tests/runtime/test_control_loop.py (+42 -17)
📝 packages/llama-index-workflows/tests/test_event.py (+168 -1)
📝 uv.lock (+1 -1)

📄 Description

Add WorkflowTerminationEvent base class and specific subclasses to provide
detailed information when workflows end abnormally:

  • WorkflowTimedOutEvent: Published when workflow exceeds timeout, includes
    timeout duration and list of active steps
  • WorkflowCancelledEvent: Published when workflow is cancelled by user
  • WorkflowFailedEvent: Published when a step fails permanently, includes
    step name, exception type, and exception message

These events replace the empty StopEvent() instances that were previously
published, allowing consumers to understand why a workflow ended and take
appropriate action.

Fixes https://github.com/run-llama/workflows-py/issues/222


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/workflows-py/pull/264 **Author:** [@adrianlyjak](https://github.com/adrianlyjak) **Created:** 1/6/2026 **Status:** ✅ Merged **Merged:** 1/10/2026 **Merged by:** [@adrianlyjak](https://github.com/adrianlyjak) **Base:** `main` ← **Head:** `claude/workflow-timeout-error-cPvHN` --- ### 📝 Commits (7) - [`02a6e73`](https://github.com/run-llama/workflows-py/commit/02a6e73d6e1bb51e46b1307f1d5f76b2c5b9e614) feat: add dedicated StopEvent subclasses for workflow termination scenarios - [`9099ddd`](https://github.com/run-llama/workflows-py/commit/9099dddee46b4cc89c326bed7fbf11c22468fb58) refactor: simplify termination events to inherit directly from StopEvent - [`26ff616`](https://github.com/run-llama/workflows-py/commit/26ff616a36af7feee2196ee6734aa5dfa2767d99) chore: add changeset - [`1ca2384`](https://github.com/run-llama/workflows-py/commit/1ca238433a8e039ba0f3b17f4f06dced20c303a5) feat: add traceback and fully qualified exception type to WorkflowFailedEvent - [`5b22d48`](https://github.com/run-llama/workflows-py/commit/5b22d481feb0abf21327dfacda5dd2a26d7fc614) feat: add retry info (attempts, elapsed_seconds) to WorkflowFailedEvent - [`f3b52c6`](https://github.com/run-llama/workflows-py/commit/f3b52c675d9b7a354e3ebbb5615cc508e0f4a832) fix lints/locks - [`a8d9561`](https://github.com/run-llama/workflows-py/commit/a8d956167e9e643a037d0487acea180a25a0091d) docs: add workflow termination events to streaming docs ### 📊 Changes **9 files changed** (+353 additions, -29 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/workflow-termination-events.md` (+5 -0) 📝 `docs/api_docs/docs/api_reference/events.md` (+3 -0) 📝 `docs/src/content/docs/llamaagents/workflows/streaming.mdx` (+24 -0) 📝 `packages/llama-index-workflows/src/workflows/events.py` (+73 -0) 📝 `packages/llama-index-workflows/src/workflows/runtime/control_loop.py` (+36 -9) 📝 `packages/llama-index-workflows/src/workflows/runtime/types/step_function.py` (+1 -1) 📝 `packages/llama-index-workflows/tests/runtime/test_control_loop.py` (+42 -17) 📝 `packages/llama-index-workflows/tests/test_event.py` (+168 -1) 📝 `uv.lock` (+1 -1) </details> ### 📄 Description Add WorkflowTerminationEvent base class and specific subclasses to provide detailed information when workflows end abnormally: - WorkflowTimedOutEvent: Published when workflow exceeds timeout, includes timeout duration and list of active steps - WorkflowCancelledEvent: Published when workflow is cancelled by user - WorkflowFailedEvent: Published when a step fails permanently, includes step name, exception type, and exception message These events replace the empty StopEvent() instances that were previously published, allowing consumers to understand why a workflow ended and take appropriate action. Fixes https://github.com/run-llama/workflows-py/issues/222 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:17:06 -05:00
yindo closed this issue 2026-02-16 02:17:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/workflows-py#270