SDK overview
import { carbon } from '@carbon/sdk';
const replica = await carbon.emulate({ from: './stripe.json', port: 8787,});
await replica.state.reset();await replica.close();Runnable examples
Section titled “Runnable examples”Every snippet below has a matching runnable package under
examples/ in the
monorepo — each one typechecks in CI and works from a fresh clone.
| Example | What it shows |
|---|---|
sdk-basic | Boot a replica, hit it with fetch, read usage() / metrics(), stop(). |
sdk-with-ai | AiCapabilities + AiJudge enrichment gated by replica.assertQuality(). |
sdk-vitest | The SDK inside a Vitest suite — one replica per file, state.reset() between tests. |
Run them locally:
pnpm --filter @carbon/example-sdk-basic devpnpm --filter @carbon/example-sdk-with-ai dev # offline-friendly; set CARBON_AI_API_KEY for a live providerpnpm --filter @carbon/example-sdk-vitest test