{"_id":"@agenttx/sdk","_rev":"3-8ae0e4a0050197372fb77ecc0cd00e07","name":"@agenttx/sdk","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.1":{"name":"@agenttx/sdk","version":"0.2.1","license":"Apache-2.0","_id":"@agenttx/sdk@0.2.1","maintainers":[{"name":"linxsy","email":"linxsy@gmail.com"}],"dist":{"shasum":"e50ca62829d26c9f98d4bf4715a45e8708416315","tarball":"https://registry.npmjs.org/@agenttx/sdk/-/sdk-0.2.1.tgz","fileCount":6,"integrity":"sha512-lHV4TiKUMBPgBCx6Qv5sXFFrhpPfOGDw1vETS6pNGylSFgz28QPHW14eUTr++7G7pVrsEVtm/f4QKhJwI6WkXw==","signatures":[{"sig":"MEQCIA5Z/yK9zJbRyFvyKvi8a6ChT0byK6yAU9I68HB6tRq7AiB3fmvZen7JRpdR3hp5FbwTHpXVvKaIK2x63XxCG3IaRA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29186},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"f2353193da55a537248fa7c556af2aa678086ecb","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","prepack":"pnpm build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"linxsy","email":"linxsy@gmail.com"},"_npmVersion":"10.9.3","description":"Fail-closed spend control client for x402-enabled AI agents","directories":{},"sideEffects":false,"_nodeVersion":"22.19.0","dependencies":{"@agenttx/protocol":"workspace:*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.0","typescript":"^5.8.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.1_1788251479716_0.29927105717648317","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This version cannot be installed because its published manifest contains a workspace:* dependency. Use @agenttx/sdk@0.2.2 or later."},"0.2.2":{"name":"@agenttx/sdk","version":"0.2.2","license":"Apache-2.0","_id":"@agenttx/sdk@0.2.2","maintainers":[{"name":"linxsy","email":"linxsy@gmail.com"}],"dist":{"shasum":"9ce5e829aab701bd108c213a243ab30cb61fe93e","tarball":"https://registry.npmjs.org/@agenttx/sdk/-/sdk-0.2.2.tgz","fileCount":6,"integrity":"sha512-2QOySyfVogKXljPSiB8Uuv7oZAX2H67z6rFCqIrMCdWR6m+ByS1aH4UJe/gUizQQS+pK3U0F50fnjarcItdggQ==","signatures":[{"sig":"MEUCIHOiMaDbpYRLWZnMaPD6JrqMzSvYZlbM+xyjLs+LDp6DAiEAyqcKlGNYsVTMcBq2xwSC3fg/W0g+VqfUrf31wkliHgc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29180},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"f2353193da55a537248fa7c556af2aa678086ecb","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","prepack":"pnpm build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"linxsy","email":"linxsy@gmail.com"},"_npmVersion":"10.9.3","description":"Fail-closed spend control client for x402-enabled AI agents","directories":{},"sideEffects":false,"_nodeVersion":"22.19.0","dependencies":{"@agenttx/protocol":"0.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.0","typescript":"^5.8.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.2_1788251845504_0.223871462596978","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-09-01T08:31:19.512Z","modified":"2026-09-01T08:39:30.152Z","0.2.1":"2026-09-01T08:31:19.924Z","0.2.2":"2026-09-01T08:37:25.647Z"},"license":"Apache-2.0","description":"Fail-closed spend control client for x402-enabled AI agents","maintainers":[{"name":"linxsy","email":"linxsy@gmail.com"}],"readme":"# @agenttx/sdk\n\nTypeScript client for AgentTX V0.2.1. It exposes low-level spend APIs and\n`controlledFetch()`, which handles an x402 challenge, requests an AgentTX\nauthorization, executes the payment, waits for its receipt, and returns the\npurchased resource as a standard `Response`.\n\nThe public sandbox base URL is `https://control.agenttx.cc`. Its readiness and\nWorker health endpoints are public, but using the Control API still requires an\nAgent credential created in an authenticated AgentTX workspace. V0.2.1 remains\nsandbox-only and cannot move real funds.\n\nCreate an Agent in the authenticated console and copy its one-time opaque\n`atx_agent_*` credential into a server-side secret store. Also retain the workspace\norganization ID. This credential is not a JWT. Never put it in browser code,\nemail, logs, GitHub issues, or forum posts.\n\n```ts\nimport { AgentTX } from \"@agenttx/sdk\";\n\nconst agenttx = new AgentTX({\n  baseUrl: process.env.AGENTTX_API_URL!,\n  credential: process.env.AGENTTX_AGENT_SECRET!,\n  organizationId: process.env.AGENTTX_ORGANIZATION_ID!,\n});\n\nconst response = await agenttx.controlledFetch(\n  process.env.AGENTTX_X402_DEMO_URL!,\n  {},\n  { purpose: \"market_research\", category: \"data\" },\n);\nconsole.log(await response.json());\n```\n\nThe client supplies the Bearer credential and `X-AgentTX-Organization-Id` routing\nheader. It also creates an idempotency key, nonce, and timestamp for every write.\nThe organization ID is not authorization: the credential is authenticated inside\nthat tenant's database isolation scope.\n\nThe default sandbox policy may return `APPROVAL_REQUIRED`. Approve the same spend\nintent in the console, then resume it without creating a duplicate:\n\n```ts\nconst approved = await agenttx.waitForAuthorization(spendIntentId);\nif (approved.status === \"AUTHORIZED\") {\n  const response = await agenttx.resumeControlledFetch(spendIntentId);\n}\n```\n\nHTTP 429 may come from the source-IP edge limit or the authenticated tenant's\ndurable request quota. `AgentTXError.retryAfterMs` exposes `Retry-After` when the\nserver or gateway supplies it. `APPROVAL_REQUIRED` and `DENIED` are policy\noutcomes; do not retry them as transient failures or bypass the control plane.\n","readmeFilename":"README.md"}