> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withboundary.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Make LLM outputs correct before your application uses them

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

```json theme={null}
{
  "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.

```mermaid theme={null}
flowchart LR
  prompt[Your prompt] --> model[LLM provider]
  model --> output[Raw output]
  output --> boundary[Boundary contract]
  boundary --> accepted[Accepted data]
  boundary --> rejected[Structured rejection]
```

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.

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

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

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Define a contract and run your first accepted result
  </Card>

  <Card title="Local development" icon="terminal" href="/guides/local-development">
    Debug contracts without the hosted dashboard
  </Card>

  <Card title="Add Boundary to an LLM feature" icon="code" href="/guides/add-boundary-to-an-llm-feature">
    Put the contract boundary around existing provider code
  </Card>

  <Card title="Production observability" icon="chart-line" href="/guides/production-observability">
    Send contract runs to the Boundary dashboard when ready
  </Card>
</CardGroup>
