Skip to main content
Use checkOutput(...) after the provider returns final text and before your application returns it.
const decision = await client.checkOutput({
  provider: {
    name: "custom-provider",
    operation: "messages.create",
    model: "model-name",
  },
  content: {
    value: "Here is the final answer from the model.",
  },
  rewriteAttempt: 0,
});
For output checkpoints, valid decisions are allow, block, and rewrite.

Handle Rewrites

If the decision is rewrite, use decision.actions?.rewrite?.category to build a provider-specific rewrite prompt, call the provider again, and check the rewritten output with rewriteAttempt: 1. Provider wrappers do this for supported non-streaming calls. Custom adapters must implement the rewrite loop themselves.