[PR #342] [MERGED] Server runtime #344

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

📋 Pull Request Information

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

Base: devHead: adrian/server-runtime


📝 Commits (10+)

📊 Changes

46 files changed (+5355 additions, -2437 deletions)

View changed files

.changeset/bright-waves-crash.md (+5 -0)
📝 .changeset/itchy-crabs-report.md (+1 -1)
.changeset/warm-doors-glow.md (+5 -0)
📝 packages/llama-agents-client/src/llama_agents/client/client.py (+71 -36)
📝 packages/llama-agents-client/src/llama_agents/client/protocol/__init__.py (+1 -8)
📝 packages/llama-agents-client/tests/client/client_test_workflows.py (+0 -6)
📝 packages/llama-agents-client/tests/client/test_client.py (+129 -5)
📝 packages/llama-agents-server/pyproject.toml (+5 -2)
📝 packages/llama-agents-server/src/llama_agents/server/__init__.py (+3 -1)
📝 packages/llama-agents-server/src/llama_agents/server/_api.py (+218 -239)
packages/llama-agents-server/src/llama_agents/server/_handler.py (+0 -399)
📝 packages/llama-agents-server/src/llama_agents/server/_keyed_lock.py (+2 -0)
packages/llama-agents-server/src/llama_agents/server/_runtime/__init__.py (+2 -0)
packages/llama-agents-server/src/llama_agents/server/_runtime/idle_release_runtime.py (+242 -0)
packages/llama-agents-server/src/llama_agents/server/_runtime/persistence_runtime.py (+267 -0)
packages/llama-agents-server/src/llama_agents/server/_runtime/runtime_decorators.py (+181 -0)
packages/llama-agents-server/src/llama_agents/server/_runtime/server_runtime.py (+270 -0)
📝 packages/llama-agents-server/src/llama_agents/server/_service.py (+224 -232)
📝 packages/llama-agents-server/src/llama_agents/server/_store/__init__.py (+0 -2)
📝 packages/llama-agents-server/src/llama_agents/server/_store/abstract_workflow_store.py (+147 -3)

...and 26 more files

📄 Description

Summary

Replaces the server's monolithic handler/service design with a composable runtime decorator pattern and adds full workflow durability.

Runtime decorators

Server concerns are now implemented as stackable decorators wrapping the core workflow runtime:

  • ServerRuntimeDecorator — Records emitted events to the workflow store, detects terminal events, manages handler lifecycle
  • PersistenceDecorator — Persists ticks and state for crash recovery; resumes in-flight workflows on server restart
  • IdleReleaseDecorator — Releases memory for idle workflows and reloads on demand

This replaces the old _handler.py and enables support for alternate runtimes beyond the default asyncio runtime.

Workflow store expansion

AbstractWorkflowStore gains tick storage, event storage with SSE subscription, per-run state stores, and centralized status transition logic. SQLite store adds migration 0004_add_ticks and SqliteStateStore.

Client SSE reconnection

Event streaming uses proper SSE format with sequence-based cursors. The client auto-reconnects from the last received sequence on connection drop (configurable max_reconnect_attempts).


🔄 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/342 **Author:** [@adrianlyjak](https://github.com/adrianlyjak) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/10/2026 **Merged by:** [@adrianlyjak](https://github.com/adrianlyjak) **Base:** `dev` ← **Head:** `adrian/server-runtime` --- ### 📝 Commits (10+) - [`4c469d0`](https://github.com/run-llama/workflows-py/commit/4c469d0183e2ea89aad4cbc35fc77b0307f85896) Add alternate runtime support to server - [`8046ee3`](https://github.com/run-llama/workflows-py/commit/8046ee3e16e723d370aeb1c28fda086c9c4b5ca3) add better client reconnect tests - [`87c03e0`](https://github.com/run-llama/workflows-py/commit/87c03e0016befbefba99339f749aed223849dfd6) move state store to server runtime - [`21a5ae0`](https://github.com/run-llama/workflows-py/commit/21a5ae08317e531e3524dff5d3593997b082dd39) split durable - [`700953e`](https://github.com/run-llama/workflows-py/commit/700953ed31d50f9e6dc59075ff5788eb439c6c04) trim back a bit - [`c24a258`](https://github.com/run-llama/workflows-py/commit/c24a25877104df55d8db9d31828af5b864a65e86) proxy - [`094ff45`](https://github.com/run-llama/workflows-py/commit/094ff4590d482e749d2e55b211e25382a6f21862) cleaning up - [`23f344f`](https://github.com/run-llama/workflows-py/commit/23f344f60c13d0fee65a31bbbb2e21b88c0fe87b) use hitl event - [`cf50de5`](https://github.com/run-llama/workflows-py/commit/cf50de534df617b6bb91225b82bb86030c8bf834) idle delay timeout - [`a945c5d`](https://github.com/run-llama/workflows-py/commit/a945c5d3729ec9faf93b3b235f1b986bb867b785) clean up names and Any ### 📊 Changes **46 files changed** (+5355 additions, -2437 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/bright-waves-crash.md` (+5 -0) 📝 `.changeset/itchy-crabs-report.md` (+1 -1) ➕ `.changeset/warm-doors-glow.md` (+5 -0) 📝 `packages/llama-agents-client/src/llama_agents/client/client.py` (+71 -36) 📝 `packages/llama-agents-client/src/llama_agents/client/protocol/__init__.py` (+1 -8) 📝 `packages/llama-agents-client/tests/client/client_test_workflows.py` (+0 -6) 📝 `packages/llama-agents-client/tests/client/test_client.py` (+129 -5) 📝 `packages/llama-agents-server/pyproject.toml` (+5 -2) 📝 `packages/llama-agents-server/src/llama_agents/server/__init__.py` (+3 -1) 📝 `packages/llama-agents-server/src/llama_agents/server/_api.py` (+218 -239) ➖ `packages/llama-agents-server/src/llama_agents/server/_handler.py` (+0 -399) 📝 `packages/llama-agents-server/src/llama_agents/server/_keyed_lock.py` (+2 -0) ➕ `packages/llama-agents-server/src/llama_agents/server/_runtime/__init__.py` (+2 -0) ➕ `packages/llama-agents-server/src/llama_agents/server/_runtime/idle_release_runtime.py` (+242 -0) ➕ `packages/llama-agents-server/src/llama_agents/server/_runtime/persistence_runtime.py` (+267 -0) ➕ `packages/llama-agents-server/src/llama_agents/server/_runtime/runtime_decorators.py` (+181 -0) ➕ `packages/llama-agents-server/src/llama_agents/server/_runtime/server_runtime.py` (+270 -0) 📝 `packages/llama-agents-server/src/llama_agents/server/_service.py` (+224 -232) 📝 `packages/llama-agents-server/src/llama_agents/server/_store/__init__.py` (+0 -2) 📝 `packages/llama-agents-server/src/llama_agents/server/_store/abstract_workflow_store.py` (+147 -3) _...and 26 more files_ </details> ### 📄 Description ## Summary Replaces the server's monolithic handler/service design with a composable **runtime decorator** pattern and adds full workflow durability. ### Runtime decorators Server concerns are now implemented as stackable decorators wrapping the core workflow runtime: - **`ServerRuntimeDecorator`** — Records emitted events to the workflow store, detects terminal events, manages handler lifecycle - **`PersistenceDecorator`** — Persists ticks and state for crash recovery; resumes in-flight workflows on server restart - **`IdleReleaseDecorator`** — Releases memory for idle workflows and reloads on demand This replaces the old `_handler.py` and enables support for alternate runtimes beyond the default asyncio runtime. ### Workflow store expansion `AbstractWorkflowStore` gains tick storage, event storage with SSE subscription, per-run state stores, and centralized status transition logic. SQLite store adds migration `0004_add_ticks` and `SqliteStateStore`. ### Client SSE reconnection Event streaming uses proper SSE format with sequence-based cursors. The client auto-reconnects from the last received sequence on connection drop (configurable `max_reconnect_attempts`). --- <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:17 -05:00
yindo closed this issue 2026-02-16 02:17:17 -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#344