SDKs overview
The official TypeScript and Python SDKs — what they add over plain HTTPS, how they compare, and how to build them from source until they are published on npm and PyPI.
Two official SDKs wrap the public API: @dcision/sdk for TypeScript and JavaScript, and dcision for Python. They run decisions with safe retries, dispatch function destinations, verify webhook signatures and read your account and executions — with the same behavior in both languages.
Not published yet — build from source
@dcision/sdk isn't on npm and dcision isn't on PyPI yet. Build them from a checkout of the Dcision repository, as below. Until this page says they are published, a package with these names on npm or PyPI doesn't come from Dcision: don't install it.
# In a checkout of the Dcision repository — Node.js 22 and pnpm 10 for the workspace
pnpm install
pnpm --filter @dcision/sdk build # TypeScript: builds packages/sdk/dist
pip install ./packages/sdk-python # Python: installs into the active environmentThen add the TypeScript build to your project with npm install /path/to/dcision/packages/sdk — see TypeScript SDK and Python SDK.
What they add
- Retries that never run a decision twice. Every
decidecall sends anIdempotency-Key— yours, or a new UUID reused by all its retries — and retries network errors, timeouts,429,502,503and504, honoringRetry-After. A second request that finds the first still running waits for it instead of failing. - Function destinations. Register handlers by name; the SDK calls them in order after the decision.
- Webhook verification. One call checks
Dcision-Signaturein constant time, the timestamp and the event. - Typed responses and one error type. Every API field is typed, and every failure — an API error, a network error, a handler that throws, a bad signature — is a
DcisionErrorwith a stablecode. - Safe defaults. The API key is validated locally and never printed; requests use
httpsand never follow redirects, so the key can't reach another host.
Compared
| TypeScript | Python | |
|---|---|---|
| Package | @dcision/sdk (packages/sdk) | dcision (packages/sdk-python) |
| Runtimes | Node.js 20+, Bun, Deno, Cloudflare Workers, Vercel Edge | Python 3.9+ |
| Dependencies | None — fetch and Web Crypto | None — the standard library |
| Client | Asynchronous (promises) | Synchronous; use asyncio.to_thread in async code |
| Run a decision | dcision.decide(slug, state, options) | client.decide(slug, state, ...) |
| Function destinations | functions, decision.dispatch() | functions=, decision.dispatch() |
| Webhooks | verifyWebhook(), verifySignature() | verify_webhook(), verify_signature() |
| Account and executions | me(), executions.list(), executions.iterate() | me(), executions.list(), executions.iterate() |
| Timeout of each attempt | 30 seconds | 30 seconds |
| Retries | 2 (3 attempts) | 2 (3 attempts) |
Without an SDK
The API is a single HTTPS POST with JSON, so any language works: see the cURL, JavaScript and Python examples in Run a decision and a complete client with retries in Idempotent retries. The CLI covers the terminal and CI — it is built from source too.
Limits
Every size and count limit in one place — request body, state and token budget, decision schema, destinations and deliveries, identifiers, workspace, team and sign-in limits.
TypeScript SDK
@dcision/sdk for Node.js, Bun, Deno and edge runtimes — build from source, decide, destinations and functions, errors, idempotent retries, executions, me() and webhook verification.