Skip to main content
createServerClient from @arg/sdk/server binds the whole SDK to one workspace with a credential you hold. It refuses to run in a browser: credentials stay on your side, and the backend checks every call against the principal’s own permissions.

Options

A user-owned key acts as that user; a service-account key acts as the account, and user-only endpoints refuse it. The SDK never widens what the key can do.

What the client serves

Everything in the reference except the embedded-only surfaces: fs with conditional writes, actions and agents, chat and workspace, auth.principal(), users, permissions, and the resource namespaces (comments, notifications, integrations, automations, code, sites, servers). db, host, ui and fs.open need an Arg application host and report unsupported_capability here; chat.start with a desktop harness is refused too, since those run inside the desktop app.

Requests, deadlines, cancellation

Every request carries a deadline, refuses redirects, sends no cookies and reads at most 32 MiB. Mutating requests are never retried automatically. Cancelling a call through its signal stops waiting; it cannot undo a mutation the server already accepted, so reconcile with a read before retrying. dispose() aborts every in-flight call and stops every fs.watch the client created; a call after that rejects with client_closed.

The legacy client underneath

The server client is built on @arg-ai/sdk and exposes it, so a script written against that package keeps its resources and gains the new namespaces:
files, workspaces, chats, keys and agentLifecycle are those legacy resources unchanged: their DTOs, errors and retry behaviour are the legacy contracts, documented on the TypeScript SDK page.

Advanced file transfers

arg.fs reads and writes whole files as JSON. For anything large or streamed - multipart uploads with per-part retries, streamed downloads, batch operations - use arg.files, the legacy files resource, which switches to a resilient multipart upload above 16 MiB.

Sites and Servers with their own tokens

A published Site or a running Server receives an Action capability token at deploy time. createCapabilityClient from @arg/sdk/server uses that token on the app server without turning it into an account credential:
The capability client covers Action discovery, schema, execution and run lookup, plus integrations.proxy when a separate integration token is supplied. It cannot reach chats, workspace discovery or the other resources: those need an account, and a capability token is not one. Its principal, read scope, expiry and revocation are exactly what the token carries. Never return either token to a browser; the hosted frontends guide shows how a Site’s own frontend reaches the SDK through a gateway instead.

A CI example