Skip to main content
The Tally TypeScript SDK is published as @tallyforagents/sdk. It targets Node 20+ and uses the platform’s native fetch — no extra dependencies for the network layer.

Install

pnpm, yarn, and bun work the same way. The SDK has no peer dependencies and ships its own type definitions.

Construct a client

new Tally({ apiKey }) is the only call you’ll make to set up. The returned client exposes agents, payments, and webhooks resources.

ClientOptions

API key validation

The constructor validates the key prefix and throws a TallyError (type: "validation_failed") if the key doesn’t start with tly_test_ or tly_live_. This catches misconfigured environments at startup, not at first request.

Setting baseUrl in production

The SDK defaults baseUrl to http://localhost:3000 so a fresh install Just Works against a locally running Tally. For any deployed environment, set it explicitly:
Trailing slashes are stripped — https://api.example.com/ and https://api.example.com are equivalent.

Custom fetch

If you want to wrap requests with logging, retries, or use a runtime where globalThis.fetch isn’t available, pass a custom implementation:
The SDK doesn’t add automatic retries on its own — the client is a thin transport and idempotency is the recommended retry primitive. See Payments for the idempotency_key pattern.

Request shape

Every SDK call goes through one HTTP request. Headers Tally sends: Responses are always JSON. Non-2xx responses are mapped to typed exceptions — see Errors.

Minimal end-to-end example

The smallest working app: load an env, construct a client, upsert an agent.
Run with node --env-file=.env.local index.ts (Node 20+) and you should see agent smoke-test status=no_permissions.

Where to go next

  • Agentstally.agents.*
  • Paymentstally.payments.*
  • Webhookstally.webhooks.verifySignature
  • Errors — typed exceptions and the recovery patterns