Skip to main content
Hook into lifecycle stages to enforce policy, add telemetry, or transform IO. Concepts
  • Flows are named pipelines with stages; hooks run at specific stages.
  • Kinds: Will (before), Stage (in-place), Did (after), Around (wrap).
  • Priority orders execution; higher runs earlier for Will/Stage; Did runs in reverse.
Example (pseudocode)
 const Tool = FlowHooksOf('tool.execute');

 class MyHooks {
   @Tool.Will('validate', { priority: 100 })
   requireFields(ctx) {
     // if (!ctx.input.amount) throw new Error('amount required');
   }

   @Tool.Did('execute')
   redact(ctx) {
     // ctx.result = redactSensitive(ctx.result);
   }
 }
Tips
  • Contribute hooks from a Plugin to reuse across apps.
  • Use context to pass data between stages in the same flow.
  • See servers/flows and servers/hooks for more details.