What is Boundary?
Boundary is the deterministic acceptance layer between model output and application state. Your model can return valid JSON that is still wrong for your product:tier is a string and score is a number. It cannot prove that a hot lead needs a higher score, or that a scoring decision needs a reason. Boundary adds that missing layer: every structured output is accepted or rejected before your app uses it.
How Boundary fits
You keep your existing model provider, prompts, schemas, and runtime. Boundary sits between the model response and the part of your application that uses it. A contract combines:- a Zod schema for shape
- named rules for domain correctness
- repair context for fixable failures
- a typed
ContractResultso side effects only happen with accepted data
Start free, add the dashboard later
Boundary is split into two packages.| Package | Use it for | Network behavior |
|---|---|---|
@withboundary/contract | Local validation, repair, typed results, console logging, tests | No network calls |
@withboundary/sdk | Production traces, acceptance rates, top failing rules, alerts | Sends events only when configured |
@withboundary/contract. It is free, runs inside your process, and gives you useful debugging through debug: true, createConsoleLogger, verify(), and custom logger hooks.
Add @withboundary/sdk when you want the same contract runs to show up in the hosted dashboard.
First path through the docs
Quickstart
Define a contract and run your first accepted result
Local development
Debug contracts without the hosted dashboard
Add Boundary to an LLM feature
Put the contract boundary around existing provider code
Production observability
Send contract runs to the Boundary dashboard when ready