Skip to main content
Pick the interface that fits your stack. All three talk to the same Decision API and use the same scoped ASKWITHAI_API_KEY.

TypeScript SDK (@askwithai/sdk)

@askwithai/sdk provides a typed client, Zod-validated decisions with createDecision, receipt formatting, and a faux server (@askwithai/sdk/testing) for fast local tests.

Direct client call

Typed decisions with Zod

Use createDecision to validate answers at runtime and get full TypeScript inference:

What is an idempotencyKey?

A unique ID you attach to a request (like an order_id). If your app retries the same call after a network hiccup, AskWithAI returns the original decision instead of running the models twice.

The askwithai CLI

The askwithai command ships with @askwithai/sdk and covers the full Decision API from your terminal or CI pipeline.

Decision API (HTTP)

Call any runtime from Python, Go, Ruby, or any HTTP client using a Bearer token.

POST /v1/decide/{owner}/{runtime}

string
required
Your workspace handle (for example, acme).
string
required
The Decision Runtime slug (for example, payment-refund).
string
required
Bearer token using your API key: Bearer wai_....
object
required
The structured JSON payload your runtime’s questions evaluate.
string
Optional key to safely deduplicate retried requests.

Reporting real outcomes

Send real-world results to POST /v1/decisions/{id}/outcome once a decision’s outcome is known:
string
Unique identifier for the recorded decision. Save this to attach outcomes later.
object
Map of question names to their resolved answers (for example, approve_refund.answer).
object
Full explanation of how the decision was reached: path taken (fast_only, fast_then_reasoning, etc.), latency, cost, and plain-language reason.