Skip to main content
This tutorial uses the deployed Execution Fabric v1 task contract at https://api.praxa.io. It is a production partner preview for admitted personal tenants. Organization execution and request-level agent, tool, context, policy, and delivery overrides are not accepted.

Prerequisites

  • A personal workspace API key created in the Developer Platform.
  • execute:write to submit a task.
  • runs:read to read or stream the run.
  • runs:write only if you will test cancellation.
  • A server runtime. Never expose the key in browser code.

1. Submit a task

A successful request returns 202 with a RunResource. The status will be one of queued, running, awaiting_approval, completed, failed, or cancelled.

2. Read until terminal

Do not automatically resubmit a run whose outcome is unknown. A committing action may have happened even though Praxa could not verify the final result.

3. Stream instead of polling

Persist the numeric event id. Reconnect with Last-Event-ID and require strictly increasing sequences. A terminal event closes the stream.

4. Integrate a framework safely

Have the client create one application request ID when the user starts the logical action, persist it until the request settles, and resend that same ID after a timeout. The backend should combine it with the authenticated user identity to derive a bounded Praxa idempotency key.
Put the task call in a Route Handler. The browser sends only your application input to /api/tasks; the Praxa key stays on the server.
app/api/tasks/route.ts
requireSession, authenticateApplicationRequest, and idempotencyKeyFor represent your application-owned auth and deterministic key helpers. They must fail before the Praxa request if the user, input, or request ID is invalid.

5. Verify end to end

Run these checks with a disposable task and least-privilege keys:
  1. Submit once and require 202 plus a UUID run_id.
  2. Replay the exact body with the same idempotency key and require the same run.
  3. Change the body under that key and require 409.
  4. Read the run with runs:read and require the same tenant-owned run ID.
  5. Attempt the read with a key that lacks runs:read and require a fail-closed response.
  6. Consume events until a terminal event or an explicitly documented timeout.
  7. If testing cancellation, send exactly {} and continue reading until the run actually becomes terminal.
A passing submission test proves admission only. Your end-to-end assertion must observe a terminal run or an explicit non-terminal state that your product knows how to handle.

Troubleshooting

Best practices

  • Persist identity before I/O and state transitions after durable processing.
  • Treat admission, delivery attempt, and cancellation request as non-terminal acknowledgements.
  • Verify signatures against the raw body before parsing webhook JSON.
  • Deduplicate streams and webhooks using stable event or delivery identity.
  • Test disconnect, duplicate, out-of-order, timeout, revocation, and cleanup paths.

Optimize for production

  • Prefer event-driven updates while retaining bounded polling or readback reconciliation.
  • Commit cursors in batches only when that cannot lose acknowledged application work.
  • Keep webhook handlers short: verify, persist, acknowledge, then process asynchronously.
  • Measure admission-to-terminal time, reconnect rate, duplicate rate, delivery latency, and reconciliation backlog.
Optimize only after the correctness and isolation matrix passes. Lower latency or cost is not an improvement if verified outcomes, authority checks, or recovery rates regress.

Cleanup and next steps

  1. Cancel or terminally reconcile disposable runs.
  2. Disable test webhook endpoints and remove their signing secrets.
  3. Delete synthetic inbox, cursor, and delivery records after assertions.
  4. Revoke disposable credentials and keep only redacted lifecycle evidence.
After cleanup, run the shared integration test matrix and record any environment-specific check that remains pending.

Frequently asked questions

What proves this tutorial works?

The minimum observable result is that one logical task survives exact replay and reaches an authoritative terminal state. A compile, package import, mocked response, or initial admission alone does not prove the complete workflow.

Can a browser, mobile app, or model prompt hold the credential?

No. The trusted runtime owns Praxa keys, OAuth tokens, and webhook secrets; clients receive only bounded application projections.

How should an ambiguous mutation be retried?

Persist the exact logical input and idempotency key before the first attempt. Reconcile through authoritative readback or replay the exact request with that same key before creating new work.

What should we monitor after release?

Monitor admission-to-terminal time, stream reconnects, duplicate events, webhook delivery latency, retries, and reconciliation backlog. Alert on authorization bypass, cross-tenant disclosure, repeated conflicts, or cleanup failure.
Last modified on August 14, 2026