Hosted client
The hosted client calls agents on agntz.co or your self-hosted worker over HTTPS. TypeScript uses @agntz/client; Python uses agntz.AgntzClient or agntz.AsyncAgntzClient. Both talk to the same worker API.
Same resource shape as the embedded SDK — code is portable between local and hosted modes once your local tools are HTTP or MCP tools.
For provider-replacement workloads, start with Provider replacement. This page is the complete client resource reference.
Basic usage
Async usage
Constructor options
API surface
client.agents.run(...)
Run an agent to completion. The normalized result includes output, state, runId, requested/resolved agent versions, provider, actual model, token usage, finish reason, response id, warnings, and retention metadata. sessionId and traceId are optional because stateless and result-only retention deliberately do not create them.
client.agents.stream(...)
Streams SSE events. Always yields a terminal complete or error event.
client.agents.start(...)
Start a durable asynchronous run using the same input, content, context, and retention fields. Use client.runs.get, client.runs.cancel, or client.runs.stream to manage it. Durable starts require result or session retention.
client.agents.import(...)
Import local manifests into hosted storage. Imported agents become available to the same run and stream APIs.
Stored agents can be resolved by bare id, agent@latest, exact version timestamp, or alias when the deployment exposes version and alias administration.
client.batches.* and client.datasets.import
Create a versioned provider-native batch definition, import CSV/JSONL data, and run or compare exact manifest/dataset versions.
Both sync and async Python clients expose the same resources. See Provider-native batches for the manifest subset, lifecycle, exports, callbacks, and model comparison workflow.
Runtime context grants
Pass context when a hosted run needs access to a resource such as memory. These are namespace grants minted by trusted server-side code; the model never receives a namespace parameter.
The worker must be configured with matching resource providers. See Context and resources and Memory with memrez.
Rich content
content is an ordered array of text, image, and audio blocks. Blocks can reference URLs, base64 bytes, existing artifacts, or local files. TypeScript and Python automatically upload local files before execution.
See Content, artifacts, and retention for every block source, limit, and persistence rule.
Artifacts
Retention
| Mode | Behavior |
|---|---|
none | Synchronous stateless execution; no durable run, session, or trace |
result | Redacted durable result without raw input, tool calls, session, or trace |
session | Conversation history, complete run data, and trace |
Set a default in the manifest and optionally tighten it per call. TTL fields use ttlSeconds / artifactTtlSeconds in TypeScript and ttl_seconds / artifact_ttl_seconds in Python.
client.runs.*
client.traces.*
Sessions
Pass the same session id across calls to continue a conversation. The hosted runtime auto-loads and appends history.
Sessions are managed automatically and scoped to your user. See Sessions.
You can also import or delete sessions when migrating local state:
Memory
Hosted memory APIs mirror the embedded memrez admin surface. All requests are bounded by namespace roots and runtime context grants.
Datasets and evals
The hosted client manages eval definitions, datasets, async eval runs, cancellation, and latest score queries.
Errors
The base AgntzError preserves the worker's stable error code. Use the code for program logic and the message for diagnostics. Structured output, manifest schema, retention, artifact, and callback failures retain their specific worker codes where supplied. See Results, streaming, and errors.
Authentication
External clients send Authorization: Bearer ar_live_.... Keys are issued in Settings → API Keys on agntz.co or your self-hosted UI. For browser usage, never embed an ar_live_* key client-side; proxy through your own backend and inject the key server-side.
Self-host with the same client
The hosted client works against any Agntz worker — the public api.agntz.co or your own deployment.