griptape icon indicating copy to clipboard operation
griptape copied to clipboard

Add `RunnableMixin` for pre/post processing on arbitrary run execution

Open vachillo opened this issue 7 months ago • 3 comments

Is your feature request related to a problem? Please describe. there is a lot of different areas of the framework that could benefit from pre/post processing hooks on data.

Describe the solution you'd like implement a RunnableMixin:

class RunnableMixin:
process_before_run_fn: Callable[[Any], Any]
process_after_run_fn: Callable[[Any], Any]

def before_run(self, *args, **kwargs) -> None (or Any?): ....
def run(self, *args, **kwargs) -> Any: ...
def after_run(self, *args, **kwargs) -> None (or Any?): ...

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

vachillo avatar Jul 02 '24 00:07 vachillo