Middleware
Use SDK middleware (app.use) for cross-cutting concerns in your backend:
- Logging and metrics around
tool.invoke - Tenant / auth context enrichment
- Input validation and redaction
Middleware runs in your process on the signed webhook path — not inside FlowRunner step graphs.
See Backend SDK lifecycle.