# DoNotAct SDK Integration Examples

These examples show how an agent or builder should call DoNotAct v1.1 diagnostics and preserve the verdict.

Boundary: DoNotAct does not execute, sign, route, custody, estimate probabilities, or provide advice. The caller must treat `DO_NOT_ACT` and `INSUFFICIENT_EVIDENCE` as blocking states.

## Python

```python
from closeedge_sdk import CloseEdgeClient, guard_verdict

with CloseEdgeClient(api_key="CE_KEY") as client:
    response = client.preflight("kalshi", "MARKET_ID")
    guard = guard_verdict(response)
    if not guard.can_continue:
        raise RuntimeError({
            "verdict": guard.verdict,
            "reasons": guard.reasons,
            "instruction": guard.instruction,
        })
```

## JavaScript

```js
import { CloseEdgeClient, guardVerdict } from "closeedge";

const client = new CloseEdgeClient({ apiKey: process.env.CE_KEY });
const response = await client.resolutionRisk("polymarket", "MARKET_ID");
const guard = guardVerdict(response);

if (!guard.canContinue) {
  throw new Error(JSON.stringify({
    verdict: guard.verdict,
    reasons: guard.reasons,
    instruction: guard.instruction
  }));
}
```

## Access

Request access through `/docs/access`. `POST /keys/request` queues manual review only and does not create or return an API key. Agents should treat `401`, `403`, and `429` as access-control outcomes and respect `Retry-After` on `429`.

## Required Agent Behavior

- Preserve `verdict`, `no_trade_reasons`, `what_would_change_this`, `not_advice`, and `receipt` if present.
- Do not retry after `DO_NOT_ACT` unless `what_would_change_this` has changed.
- Do not retry after `INSUFFICIENT_EVIDENCE` until missing public evidence becomes available.
- Send `X-CE-Source` when integrating without an SDK so source attribution remains measurable.

## Direct HTTP

```http
GET /v1/preflight/kalshi/{market_id}
X-API-Key: CE_KEY
X-CE-Source: custom-agent/0.1.0
```

## Receipt Verification

See `/docs/receipts` for public-key and offline verification details.
