The Middleware Pattern allows you to easily change the input and output of an action; one layer at a time.
PHP
Using AI as a deterministic translation tool in Laravel
Split a task into reasoning and execution to get deterministic behaviour out of a non-deterministic model. Read more