Skip to content

Documentation / @agentick/core / useContinuation

Function: useContinuation() ​

useContinuation(callback): void

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

Control whether execution continues after each tick.

result.shouldContinue reflects the framework's current decision (tool calls pending, messages queued, etc.), modified by any prior callbacks in the chain. Return nothing to accept it. Return a boolean, object, or call result.stop()/result.continue() to override.

Parameters ​

callback ​

TickEndCallback

Returns ​

void

Example ​

tsx
// Veto: stop even if framework would continue
useContinuation((r) => {
  if (r.tick > 50) return false;
});

// Override with reason
useContinuation((r) => {
  if (r.text?.includes("<DONE>")) return { stop: true, reason: "task-complete" };
});

// Defer to framework (no return = no opinion)
useContinuation((r) => {
  logger.info(`tick ${r.tick}, continuing: ${r.shouldContinue}`);
});

Released under the ISC License.