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.

Build from source
# 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 environment

Then 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 decide call sends an Idempotency-Key — yours, or a new UUID reused by all its retries — and retries network errors, timeouts, 429, 502, 503 and 504, honoring Retry-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-Signature in 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 DcisionError with a stable code.
  • Safe defaults. The API key is validated locally and never printed; requests use https and never follow redirects, so the key can't reach another host.

Compared

TypeScriptPython
Package@dcision/sdk (packages/sdk)dcision (packages/sdk-python)
RuntimesNode.js 20+, Bun, Deno, Cloudflare Workers, Vercel EdgePython 3.9+
DependenciesNone — fetch and Web CryptoNone — the standard library
ClientAsynchronous (promises)Synchronous; use asyncio.to_thread in async code
Run a decisiondcision.decide(slug, state, options)client.decide(slug, state, ...)
Function destinationsfunctions, decision.dispatch()functions=, decision.dispatch()
WebhooksverifyWebhook(), verifySignature()verify_webhook(), verify_signature()
Account and executionsme(), executions.list(), executions.iterate()me(), executions.list(), executions.iterate()
Timeout of each attempt30 seconds30 seconds
Retries2 (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.

On this page