Interceptors
Agent skill:
nitrostack-python-middleware-pipeline
Around-invoke wrappers: async def intercept(self, context, next_fn).
Python
from nitrostack import use_interceptors, tool, ExecutionContext
class TimingInterceptor:
async def intercept(self, context: ExecutionContext, next_fn):
import time
start = time.perf_counter()
try:
return await next_fn()
finally:
context.logger.info(f"elapsed_ms={(time.perf_counter() - start) * 1000:.1f}")
@tool(name="work", description="...", input_schema=WorkInput)
@use_interceptors(TimingInterceptor)
async def work(self, input: WorkInput, context: ExecutionContext):
...
Generate a stub: nitrostack-py generate interceptor Transform.