Skip to main content
This guide takes you from an empty Node.js project to an inspected mission lifecycle. It uses the Integration Gateway and its short-lived delegated OAuth token. It does not use an Execution Fabric API key.
The Integration Gateway is deployment-specific. You need the HTTPS origin and OAuth audience supplied for your Praxa deployment before live calls can succeed. Package installation alone does not create a Gateway.

1. Create the project

Use Node.js 20 or newer. The package is ESM and ships its own TypeScript declarations.

2. Configure server-only values

.env
Keep both values in your trusted server runtime. Never expose the access token through a NEXT_PUBLIC_, NUXT_PUBLIC_, VITE_, Expo public, or mobile build variable.

3. Create the client

src/praxa.ts
The SDK calls the token provider before each request. In production, replace the environment lookup with your OAuth token cache or broker so expired tokens can be refreshed without recreating the client.

4. Create and observe a mission

src/run.ts
Run the file with your preferred TypeScript runner, or compile it with tsc. A create response is admission evidence only. The final getMission readback is the authoritative mission projection.

5. Resume after a disconnect

Persist the latest event ID only after your consumer durably processes that event. Reconnect with the cursor:
Do not advance the cursor before the side effect associated with an event has committed. That ordering avoids acknowledging work your application did not finish.

6. Test without a live credential

Inject a fake fetch and assert the outbound contract. This test proves your application wiring without contacting Praxa:

End-to-end acceptance

Before calling the integration complete, prove all of these with a disposable tenant and least-privilege token:
  1. A valid mission is admitted and can be read by its owner.
  2. The event stream reconnects from a saved cursor without losing events.
  3. Replaying the same body and idempotency key returns the same logical work.
  4. Reusing the key with a changed body returns a conflict.
  5. A missing or expired token fails before application success is reported.
  6. An under-scoped token is denied.
  7. A foreign-tenant run ID is not disclosed.
  8. The mission reaches a terminal projection or is deliberately cancelled.

Configuration and authentication

Add token refresh, timeouts, cancellation, redacted observability, and contract pinning.

Mission events

Handle resumable SSE, event filtering, stream cancellation, and terminal reconciliation.
Last modified on August 14, 2026