Skip to main content
Status: Developer preview — contract-stable per @nexislabs/ai-platform v1; not yet serving public traffic.
POST /v1/execute admits a task into the Praxa execution fabric — the same durable run engine (HybridTaskWorkflow over task_runs / task_run_events) that powers Praxa’s own product surfaces, opened to an API-key principal instead of a source chat message.
Contract note. The design spec (§3.1) describes this endpoint’s body as task, context, tools, policy, delivery plus a mode discriminator. The only published wire schema for this surface, AiPlatformChatRequestV1 (@nexislabs/ai-platform), has no mode, task, context, policy, or delivery keys, and is declared .strict() — a request carrying those keys today fails validation against that schema. tools and the idempotency key are the only vocabulary confirmed in both sources. This page documents both layers separately and labels which is which.

Two execution shapes, one contract

Approval semantics are identical in both modes: the stream/run parks on an approval.required event carrying a canonical payload and an action_digest. The caller renders that payload in its own UI and posts the digest back via POST /v1/runs/:id/approve. See Approvals.

Endpoint

Authentication

Bearer API key, prefix praxa_sk_. The gateway also accepts Supabase-JWT principals for Praxa’s own desktop and Expo clients; this reference covers the API-key principal used by external integrations.

Headers

Request body — design-spec envelope

Field names and one-line descriptions as given in the design spec §3.1. Sub-field shapes are not published for task, context, policy, or delivery as of this corpus snapshot (2026-07-30) — see the contract note above. Idempotency-Key travels as a header, not a body field — see Idempotency.

Request body — mode:"turn" (published contract)

This is the literal AiPlatformChatRequestV1 zod schema from @nexislabs/ai-platform. It is .strict(): unknown top-level keys are rejected. Identifier = string, 1–128 chars, pattern ^[A-Za-z0-9][A-Za-z0-9._:-]*$.

ClientInfo

Message

MessagePart

Discriminated union on type.

ToolsFilter

ApprovalReceipt

MemoryPolicy

OutputPolicy

Metadata

Record<string, string \| number \| boolean \| null>, ≤32 keys, each key 1–64 chars, each string value ≤512 chars.

Idempotency

  • Supply a key via the Idempotency-Key header or the body’s idempotencyKey field. The reference client prefers the header/option value over the body field when both are set.
  • Idempotency keys are principal-scoped — two different API-key principals may reuse the same key value without colliding.
  • Replaying the same key with an identical request is safe: the run’s first event, request.accepted, carries replayed: true.
  • Replaying the same key with a different request body is a conflict: the server rejects it with error code conflict (see Errors).
  • A separate code, idempotency_replay, also exists in the shared error-code enum. Neither source clarifies how it relates to the request.accepted.replayed signal above — flagged as an open question.

Response

  • mode:"turn": text/event-stream — a stream of events.
  • mode:"task": JSON. The design spec confirms only that a run identifier (run_id) is returned immediately; the full response schema is not published. Poll or stream progress via GET /v1/runs/:id or GET /v1/runs/:id/events.

Errors

Failures use application/problem+json — see Errors for the full code reference.

Example

TypeScript

The reference client’s streamChat method posts to /v1/chat, not /v1/execute — see the accompanying report for this discrepancy.