Skip to main content
Boundary enforces a deterministic acceptance boundary around your LLM calls. Your application only receives outputs that have passed the schema and rules you defined.

When result.ok === true

The output is guaranteed to be:
  • Valid JSON — successfully parsed
  • Schema-compliant — matches your Zod schema exactly
  • Rule-correct — all domain rules returned true
  • Accepted for this workflow — safe for the side effects covered by your schema and rules
You can treat result.data as accepted input for the workflow the contract protects.

When result.ok === false

No output is returned to your application. Instead, you receive a structured error:
  • No invalid data leaks through
  • All attempts are preserved for debugging
  • Failures are fully explained with categories and violations

What Boundary guarantees

Boundary guarantees system-level correctness, not model behavior:
The model may generate incorrect outputs. Boundary keeps those outputs out of the accepted path and gives you structured rejection details.

What Boundary does NOT guarantee

Correctness is defined by your schema and rules:
If a value violates your domain logic but you have not written a rule for it, Boundary will not catch it. The guarantee is scoped: everything you define is enforced.

Mental model

The model proposes outputs. Boundary decides what your system accepts.This separation makes your application deterministic, even when the model is probabilistic.

The acceptance boundary

Next steps

When to Use

Where Boundary fits — and where it doesn’t

API Reference

Full API surface

Observability

The guarantee is enforced locally by @withboundary/contract. Use local development logging to inspect individual runs, then add production observability when you want aggregate dashboard views.