[PR #327] [CLOSED] Add decorator base classes for Runtime and adapters #330

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

📋 Pull Request Information

Original PR: https://github.com/run-llama/workflows-py/pull/327
Author: @adrianlyjak
Created: 2/5/2026
Status: Closed

Base: mainHead: claude/add-runtime-decorator-abstractions-UJNsv


📝 Commits (2)

  • 186de39 feat(server): add base runtime decorator abstractions
  • c100d6c test(server): slim down runtime decorator tests

📊 Changes

3 files changed (+328 additions, -0 deletions)

View changed files

📝 packages/llama-agents-server/src/llama_agents/server/__init__.py (+8 -0)
packages/llama-agents-server/src/llama_agents/server/runtime_decorators.py (+167 -0)
packages/llama-agents-server/tests/server/test_runtime_decorators.py (+153 -0)

📄 Description

Summary

Introduces three new decorator base classes that implement the decorator pattern for the workflow runtime system. These classes provide a simple forwarding mechanism that allows subclasses to selectively override individual methods without re-implementing the entire interface.

Changes

  • New module: runtime_decorators.py containing three decorator base classes:

    • BaseRuntimeDecorator: Wraps and forwards all Runtime interface methods
    • BaseInternalRunAdapterDecorator: Wraps and forwards all InternalRunAdapter interface methods
    • BaseExternalRunAdapterDecorator: Wraps and forwards all ExternalRunAdapter interface methods
  • Updated exports: Added the three new decorator classes to the server package's __init__.py for public API access

  • Comprehensive test suite: Added test_runtime_decorators.py with:

    • Concrete stub implementations of the abstract interfaces for testing
    • Tests verifying each decorator correctly forwards all methods
    • Tests demonstrating that subclasses can selectively override individual methods while maintaining forwarding for others

Implementation Details

  • All decorators follow a consistent pattern: accept an inner instance in __init__ and delegate every method call to it
  • Subclasses can override only the methods they need to customize (e.g., for logging, metrics, authentication)
  • The pattern is particularly useful for cross-cutting concerns without modifying the core runtime implementations
  • Full type hints and async/await support throughout

https://claude.ai/code/session_015sJSiNUoYqoWZZuMQnAbsD


🔄 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/327 **Author:** [@adrianlyjak](https://github.com/adrianlyjak) **Created:** 2/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `claude/add-runtime-decorator-abstractions-UJNsv` --- ### 📝 Commits (2) - [`186de39`](https://github.com/run-llama/workflows-py/commit/186de392b43b7e290febe20d4c77f9d40486177b) feat(server): add base runtime decorator abstractions - [`c100d6c`](https://github.com/run-llama/workflows-py/commit/c100d6c7f984056b553c222ad0baf895cf1ae73f) test(server): slim down runtime decorator tests ### 📊 Changes **3 files changed** (+328 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/llama-agents-server/src/llama_agents/server/__init__.py` (+8 -0) ➕ `packages/llama-agents-server/src/llama_agents/server/runtime_decorators.py` (+167 -0) ➕ `packages/llama-agents-server/tests/server/test_runtime_decorators.py` (+153 -0) </details> ### 📄 Description ## Summary Introduces three new decorator base classes that implement the decorator pattern for the workflow runtime system. These classes provide a simple forwarding mechanism that allows subclasses to selectively override individual methods without re-implementing the entire interface. ## Changes - **New module**: `runtime_decorators.py` containing three decorator base classes: - `BaseRuntimeDecorator`: Wraps and forwards all `Runtime` interface methods - `BaseInternalRunAdapterDecorator`: Wraps and forwards all `InternalRunAdapter` interface methods - `BaseExternalRunAdapterDecorator`: Wraps and forwards all `ExternalRunAdapter` interface methods - **Updated exports**: Added the three new decorator classes to the server package's `__init__.py` for public API access - **Comprehensive test suite**: Added `test_runtime_decorators.py` with: - Concrete stub implementations of the abstract interfaces for testing - Tests verifying each decorator correctly forwards all methods - Tests demonstrating that subclasses can selectively override individual methods while maintaining forwarding for others ## Implementation Details - All decorators follow a consistent pattern: accept an inner instance in `__init__` and delegate every method call to it - Subclasses can override only the methods they need to customize (e.g., for logging, metrics, authentication) - The pattern is particularly useful for cross-cutting concerns without modifying the core runtime implementations - Full type hints and async/await support throughout https://claude.ai/code/session_015sJSiNUoYqoWZZuMQnAbsD --- <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:15 -05:00
yindo closed this issue 2026-02-16 02:17:15 -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#330