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
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:
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.