Skip to content

Documentation / @agentick/core / useAfterCompile

Function: useAfterCompile() ​

useAfterCompile(callback): void

Defined in: core/src/hooks/lifecycle.ts:173

Register a callback to run after compilation. This is where you can inspect the compiled output and request recompilation.

Parameters ​

callback ​

AfterCompileCallback

Returns ​

void

Example ​

tsx
// Inspect compiled output
useAfterCompile((compiled) => {
  console.log(`Compiled ${compiled.tools.length} tools`);
});

// Request recompilation when needed
useAfterCompile((compiled, ctx) => {
  if (compiled.tools.length === 0) {
    registerMoreTools();
    ctx.requestRecompile('adding tools');
  }
});

Released under the ISC License.