Skip to main content

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": "hot",
  "score": 25,
  "reason": ""
}
A schema can prove that 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 ContractResult so side effects only happen with accepted data
That gives you a clear operating model: no silent data corruption, no best-effort fallback into product state, and enough attempt history to debug the reject path.

Start free, add the dashboard later

Boundary is split into two packages.
PackageUse it forNetwork behavior
@withboundary/contractLocal validation, repair, typed results, console logging, testsNo network calls
@withboundary/sdkProduction traces, acceptance rates, top failing rules, alertsSends events only when configured
Most teams should start with @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