Skip to main content
This page starts after you already have a contract running locally. If you are still building your first contract, start with the main quickstart and local development guide. The SDK adds production visibility: accepted and rejected runs, attempt counts, failing rules, repair messages, and runtime attribution.

Install

Set the API key

Get an API key from the Boundary dashboard. The SDK reads BOUNDARY_API_KEY from the environment by default.

Wire a logger to your contract

Run a contract

Every accept() produces a terminal event. Runs with failed intermediate attempts also produce non-terminal failure events with repair context. Events are queued, batched, and shipped to Boundary’s ingest endpoint.

What gets sent

The SDK’s default capture policy is conservative. On a successful run you’ll see roughly:
The repair message that nudged the model on the second attempt is on the prior final: false event for the same runId — the dashboard stitches them together for you. Raw LLM input and output are not included unless you opt in — see Capture policy.

Dev-safe by default

If BOUNDARY_API_KEY is not set and you don’t pass a custom write, createBoundaryLogger returns null. Passing null to defineContract is a no-op — the contract runs normally, no events sent, no errors.

Next steps

Capture policy

Turn raw inputs/outputs on or off

Redaction

Scrub PII before events leave the process

Shutdown

Drain the queue on serverless / edge / workers

createBoundaryLogger

Every option, with defaults