agntz
RuntimeHostedSelf-hostDocsChangelog
Sign inQuickstart
Documentation
View .mdOptimized for LLMs — paste directly into ChatGPT, Claude, or Cursor.

HTTP API reference

The hosted client wraps the worker HTTP API. You can call the API directly from trusted server-side code, or point @agntz/client / Python AgntzClient at your own worker.

Endpoint groups

Health and authoring

MethodPathAuthDescription
GET/healthnoneLiveness probe
POST/build-agentnonePublic agent-builder endpoint used by agntz create
POST/edit-agentrequiredEdit an existing manifest from instructions
POST/validaterequiredValidate a manifest before saving or publishing

Agents and sessions

MethodPathAuthDescription
GET/agentsrequiredList agents visible to the caller
GET/agents/:idrequiredFetch an agent definition
POST/agents/importrequiredImport one or more local manifests into hosted storage
GET/sessionsrequiredList sessions
GET/sessions/:idrequiredFetch a session and messages
POST/sessions/importrequiredImport persisted local sessions
DELETE/sessions/:idrequiredDelete a hosted session

Some self-hosted app/server deployments also expose create/update/delete agent routes and version/alias administration. The public clients use the import and run surfaces first, so those are the portable routes.

Managed artifacts

MethodPathAuthDescription
POST/artifactsrequiredMultipart upload; fields file, purpose, and optional expiresInSeconds
GET/artifacts/:idrequiredTenant-scoped metadata and signed download URL
GET/artifacts/:id/contentrequiredAuthenticated binary download
DELETE/artifacts/:idrequiredDelete metadata and bytes
GET/artifact-download/:idsigned queryShort-lived signed binary download

Uploads are limited to 50 MiB. The public clients automatically upload local files and replace them with artifactId content blocks.

Runs and streams

MethodPathAuthDescription
POST/runrequiredExecute an agent and return final output + state
POST/run/blockrequiredBlocking run alias used by compatibility clients
POST/run/streamrequiredExecute an agent as Server-Sent Events
POST/run/block/streamrequiredBlocking stream alias used by compatibility clients
POST/runsrequiredStart an async run and return its handle
GET/runsrequiredList runs
GET/runs/:idrequiredFetch current state of a run
POST/runs/:id/cancelrequiredCancel a run and cascade to descendants
GET/runs/:id/streamrequiredMultiplexed event stream for a run subtree

Traces

MethodPathAuthDescription
GET/tracesrequiredList traces
GET/traces/:idrequiredTrace detail with spans
GET/traces/:id/streamrequiredLive trace events while running
DELETE/traces/:idrequiredDelete a trace

Memory and namespace roots

MethodPathAuthDescription
POST/memory/importrequiredImport raw memory entries from a local memrez store
GET/memory/topicsrequiredScan memory topics visible to grants
GET/memory/entriesrequiredList memory entries visible to grants
DELETE/memory/entries/:idrequiredDelete a memory entry
POST/memory/entries/:id/correctrequiredCorrect an entry and supersede the previous value
POST/memory/curaterequiredRun memrez curation for granted scopes
POST/scopes/deleterequiredCascade-delete a granted namespace scope
GET/namespace-rootsrequiredList tenant namespace roots where exposed by the app/server
POST/namespace-rootsrequiredAdd a tenant namespace root
DELETE/namespace-roots/:rootrequiredRemove a tenant namespace root

Namespace-root administration is app/server owned. The worker enforces bounded grants when roots are available, and self-hosted deployments decide which admin route shape they expose.

Datasets and evals

MethodPathAuthDescription
GET/datasetsrequiredList datasets
POST/datasetsrequiredCreate or update a dataset
GET/datasets/:idrequiredFetch dataset detail
PUT/datasets/:idrequiredUpdate dataset
DELETE/datasets/:idrequiredDelete dataset
GET/evalsrequiredList eval definitions
POST/evalsrequiredCreate or update an eval definition
GET/evals/:idrequiredFetch eval detail
PUT/evals/:idrequiredUpdate eval definition
DELETE/evals/:idrequiredDelete eval definition
POST/eval-runsrequiredStart an eval run
GET/eval-runsrequiredList eval runs
GET/eval-runs/:idrequiredFetch eval run detail
POST/eval-runs/:id/cancelrequiredCancel an eval run
GET/eval-scores/latestrequiredLatest scores by agent/eval/dataset/version
GET/eval-scoresrequiredScore history

Provider-native batches

MethodPathAuthDescription
GET/POST/batchesrequiredList or create versioned batch definitions
GET/PUT/DELETE/batches/:idrequiredFetch, create a version, or delete a definition
GET/batches/:id/versionsrequiredList immutable manifest versions
GET/batches/:id/versions/:versionrequiredResolve an exact version, latest, or alias
POST/batches/:id/versions/:version/activaterequiredMake a version or alias active
PUT/DELETE/batches/:id/aliases/:aliasrequiredSet or remove a version alias
POST/batch-runsrequiredSubmit a stored dataset or inline items
GET/batch-runsrequiredFilter and page batch runs
GET/batch-runs/:idrequiredFetch reconciled provider state
DELETE/batch-runs/:idrequiredDelete a terminal run and its retained results
POST/batch-runs/:id/cancelrequiredRequest native provider cancellation
GET/batch-runs/:id/itemsrequiredPage normalized item results
GET/batch-runs/:id/results.jsonlrequiredExport normalized JSONL
GET/batch-runs/comparerequiredCompare two runs by item id
POST/dataset-importsrequiredStart a staged CSV/JSONL import
POST/dataset-imports/:id/itemsrequiredAppend normalized import items
POST/dataset-imports/:id/completerequiredPublish a dataset version atomically

Batch runs are provider-native asynchronous jobs and do not create ordinary runs, sessions, or traces. See Provider-native batches for manifests, status semantics, version pinning, callbacks, and client examples.

System agents and webhooks

MethodPathAuthDescription
GET/system/agentsrequiredList bundled system agents
GET/system/agents/:idrequiredFetch a bundled system agent
GET/webhook-secretsrequiredList webhook secrets
POST/webhook-secretsrequiredCreate or rotate a webhook secret
DELETE/webhook-secrets/:namerequiredDelete a webhook secret

Authentication

The worker accepts two auth modes.

External bearer token

Authorization: Bearer ar_live_<token>

The worker hashes the key, looks it up in the API-key store, resolves the tenant, and bounds namespace grants to that tenant's roots. This is what hosted clients send.

Internal app-to-worker secret

X-Internal-Secret: <WORKER_INTERNAL_SECRET>

The product app uses this when calling the worker for a signed-in user. Current deployments sign and forward tenant context rather than trusting browser-provided tenant data. Do not expose this secret to clients.

Run request shape

{
  "agentId": "support",
  "input": { "customerId": "cus_123" },
  "content": [
    { "type": "text", "text": "Explain this invoice" },
    {
      "type": "image",
      "artifactId": "artifact_...",
      "mediaType": "image/png",
      "detail": "high"
    }
  ],
  "sessionId": "optional-session-id",
  "context": ["app/user/u_123"],
  "retention": {
    "mode": "result",
    "ttlSeconds": 86400,
    "artifactTtlSeconds": 3600
  }
}

input accepts a plain string, an object matching the agent schema, or rich content for compatibility. Prefer the independent ordered content array for text/image/audio messages. Content sources are url, base64, artifactId, or client-only file; raw HTTP callers cannot send a local file path.

context is a namespace grant array minted by trusted server-side code and passed to resource providers such as memory. retention defaults to the manifest policy or session. A caller can tighten a manifest default but cannot loosen it. none is synchronous-only.

Run endpoints accept the same core fields. Async runs also accept callback and webhook fields when webhook delivery is configured.

The active manifest kind selects ordinary LLM execution, transcription, image generation, or a composed workflow. No provider-specific route is required.

Run response shape

{
  "output": { "answer": "..." },
  "state": {},
  "runId": "run_...",
  "traceId": "trace_...",
  "sessionId": "session_...",
  "status": "completed",
  "requestedAgentVersion": "production",
  "resolvedAgentVersion": "2026-07-28T18:30:00.000Z",
  "provider": "openai",
  "model": "gpt-5.4-2026-07-15",
  "usage": {
    "inputTokens": 412,
    "outputTokens": 87,
    "totalTokens": 499
  },
  "finishReason": "stop",
  "responseId": "resp_...",
  "warnings": [],
  "retention": { "mode": "session" }
}

traceId and sessionId are omitted for none and result retention. runId remains a correlation id even when no durable run record is created. See Results, streaming, and errors.

Stream format

/run/stream, /runs/:id/stream, and /traces/:id/stream emit Server-Sent Events.

event: stream
data: {"type": "text-delta", "text": "Hello"}

event: stream
data: {"type": "complete", "output": "Hello, world!", "state": {...}}

Reconnect with Last-Event-ID or ?since=<seq> where supported. Servers may send keepalive comments to avoid proxy idle timeouts.

Errors

The worker returns JSON error bodies with stable codes:

{
  "error": {
    "code": "AGENT_NOT_FOUND",
    "message": "No agent with id 'unknown'",
    "status": 404
  }
}
HTTP statusCommon codes
400INVALID_INPUT, SCHEMA_VALIDATION
401AUTH_MISSING, AUTH_INVALID
404AGENT_NOT_FOUND, RUN_NOT_FOUND
409RUN_CANCELLED
429RATE_LIMITED
500INTERNAL

The clients map these to typed errors. See Hosted client → Errors.

← Previous
Self-host in production
Next →
Models & providers