Docs/API/Assistants

Assistants API.

The Assistants API exposes the four core operations: create, list, invoke, and audit. Every assistant run is durable and replayable; every step is in the audit log.

Endpoints

MethodPathDescription
POST/v1/assistantsCreate a new assistant
GET/v1/assistantsList all assistants
GET/v1/assistants/{id}Get a single assistant
POST/v1/assistants/{id}/invokeRun the assistant against an input
GET/v1/runs/{run_id}Get a single run, including every step
GET/v1/assistants/{id}/auditAudit log for the assistant

Create an assistant

Request:

curl -X POST https://api.wrxstack.com/v1/assistants   -H "Authorization: Bearer $WRX_API_KEY"   -H "Content-Type: application/json"   -d '{
    "name": "support-triage",
    "description": "Triage inbound support tickets",
    "model": "anthropic/claude-3-5-sonnet",
    "scope": {
      "read":  ["tasks","crm:accounts"],
      "write": ["tasks.update","tasks.comment"]
    },
    "tools": ["tasks.label","slack.post_message"]
  }'

Response (201 Created):

{
  "id": "asst_01HQ3K...",
  "name": "support-triage",
  "model": "anthropic/claude-3-5-sonnet",
  "scope": { ... },
  "tools": [ ... ],
  "created_at": "2026-05-17T15:14:22Z"
}

List assistants

curl https://api.wrxstack.com/v1/assistants?limit=10   -H "Authorization: Bearer $WRX_API_KEY"
{
  "data": [
    {"id": "asst_...", "name": "triage", "model": "…"},
    {"id": "asst_...", "name": "recap",  "model": "…"}
  ],
  "cursor": null,
  "has_more": false
}

Invoke an assistant

Synchronous mode returns when the run finishes. Async mode returns a run id immediately; poll /v1/runs/{id} for completion or subscribe to the assistant.run.completed webhook.

curl -X POST https://api.wrxstack.com/v1/assistants/asst_01HQ3K.../invoke   -H "Authorization: Bearer $WRX_API_KEY"   -H "Content-Type: application/json"   -H "Idempotency-Key: $(uuidgen)"   -d '{
    "input": { "task_id": "tsk_01HQ3K..." },
    "mode": "sync"
  }'

Response:

{
  "run_id": "run_01HQ3K...",
  "status": "completed",
  "steps": [
    {"tool": "tasks.get",   "status": "ok", "duration_ms": 142},
    {"tool": "tasks.label", "status": "ok", "duration_ms": 89}
  ],
  "output": { "summary": "Labeled high-priority and assigned to support-l2." }
}

Python

from wrxstack import Client

client = Client()

run = client.assistants.invoke(
    assistant="asst_01HQ3K...",
    input={"task_id": "tsk_01HQ3K..."},
    idempotency_key="unique-key",
)

for step in run.steps:
    print(step.tool, step.status, step.duration_ms)

TypeScript

import { Client } from "wrxstack";

const client = new Client();

const run = await client.assistants.invoke({
  assistant: "asst_01HQ3K...",
  input: { task_id: "tsk_01HQ3K..." },
  idempotencyKey: "unique-key",
});

run.steps.forEach(s => console.log(s.tool, s.status, s.durationMs));

Audit log

Every step of every run is in the audit log forever (or for your retention policy, whichever comes first).

curl https://api.wrxstack.com/v1/assistants/asst_01HQ3K.../audit?since=2026-05-01   -H "Authorization: Bearer $WRX_API_KEY"

Errors

CodeHTTPMeaning
assistant_not_found404No such id, or not visible to caller
scope_insufficient403Token cannot invoke this assistant
invalid_input400Input doesn't match the assistant's schema
run_failed500A tool returned an unrecoverable error