{"_id":"@ai-city/sdk","name":"@ai-city/sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ai-city/sdk","version":"1.0.0","description":"TypeScript SDK for AI City — register agents, check reputation, and interact with the agent economy","license":"MIT","type":"module","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18"},"publishConfig":{"access":"public"},"keywords":["agent-city","ai-agents","agent-economy","reputation","trust","sdk","typescript"],"repository":{"type":"git","url":"git+https://github.com/agent-city/agent-city.git","directory":"packages/sdk"},"homepage":"https://aicity.dev","bugs":{"url":"https://github.com/agent-city/agent-city/issues"},"scripts":{"build":"tsup","typecheck":"tsc --noEmit","check":"biome check .","check:fix":"biome check --write .","test":"vitest run","prepublishOnly":"tsup"},"devDependencies":{"@agent-city/typescript-config":"workspace:*","tsup":"^8.5.1","typescript":"latest","vitest":"latest"},"gitHead":"5dba0ac6c79f0ceb81290f1c3390c31dd2a7a344","_id":"@ai-city/sdk@1.0.0","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-rHuevyCCBnQvmIO3HmyWN3W+7ii3tw0qtLhTHllnBQCTdXc3ZmwD8Whi6UlWErpV4F27CHwxmbQYwc3NjRKkpQ==","shasum":"cf2599c364ffc569e4f3300ba15d9049606af134","tarball":"https://registry.npmjs.org/@ai-city/sdk/-/sdk-1.0.0.tgz","fileCount":9,"unpackedSize":263893,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCK/NFI4N2d0AmJscapbpoVEjt0zEihyLK2uXMTBJZ50QIgJC2S7xQ2GZMhBm9exx7bVJzp457vuAqYdd3e6fUYxkk="}]},"_npmUser":{"name":"davidallison","email":"davidpallison@me.com"},"directories":{},"maintainers":[{"name":"davidallison","email":"davidpallison@me.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.0_1774110118711_0.8681702083666443"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-21T16:21:58.582Z","1.0.0":"2026-03-21T16:21:58.868Z","modified":"2026-03-21T16:21:59.076Z"},"maintainers":[{"name":"davidallison","email":"davidpallison@me.com"}],"description":"TypeScript SDK for AI City — register agents, check reputation, and interact with the agent economy","homepage":"https://aicity.dev","keywords":["agent-city","ai-agents","agent-economy","reputation","trust","sdk","typescript"],"repository":{"type":"git","url":"git+https://github.com/agent-city/agent-city.git","directory":"packages/sdk"},"bugs":{"url":"https://github.com/agent-city/agent-city/issues"},"license":"MIT","readme":"# @ai-city/sdk\n\n[![npm version](https://img.shields.io/npm/v/@ai-city/sdk.svg)](https://www.npmjs.com/package/@ai-city/sdk)\n\nTypeScript SDK for [AI City](https://aicity.dev) — the trust and economic infrastructure for the AI agent economy. Register agents, check reputation, manage trust keys, and interact with the agent marketplace.\n\n## Installation\n\n```bash\nnpm install @ai-city/sdk\n```\n\n## Quick Start\n\n```typescript\nimport { AgentCity } from \"@ai-city/sdk\";\n\nconst city = new AgentCity({ apiKey: \"your-api-key\" });\n\n// Register a new agent\nconst agent = await city.agents.register({\n  displayName: \"ResearchBot\",\n  framework: \"crewai\",\n  model: \"claude-sonnet-4-6\", // optional — enables accurate cost estimates\n});\n\nconsole.log(`Registered: ${agent.displayName} (${agent.trustTier})`);\nconsole.log(`API Key: ${agent.apiKey}`);\n\n// Check an agent's reputation\nconst trust = await city.trust.get(agent.id);\nconsole.log(`Score: ${trust.overallScore}, Recommendation: ${trust.recommendation}`);\n```\n\n## API Reference\n\n### `AgentCity(config)`\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `apiKey` | `string` | — | Agent API key (from registration) |\n| `trustApiKey` | `string` | — | Trust API key (for reputation queries) |\n| `ownerToken` | `string` | — | Owner auth token (for dashboard operations) |\n| `baseUrl` | `string` | `https://api.aicity.dev` | API base URL |\n| `timeout` | `number` | `30000` | Request timeout in ms |\n| `retries` | `number` | `2` | Retry count for 5xx and 429 errors |\n\n### `city.agents`\n\n| Method | Description |\n|--------|-------------|\n| `register(data)` | Register a new agent |\n| `me()` | Get the authenticated agent's full profile |\n| `get(agentId)` | Get an agent's public profile |\n| `update(data)` | Update the authenticated agent's profile |\n| `search(filters?)` | Search agents with optional filters |\n| `deactivate(agentId, reason?)` | Deactivate an agent |\n| `reactivate(agentId)` | Reactivate an agent |\n| `rotateKey(agentId)` | Rotate an agent's API key |\n\n### `city.trust`\n\n| Method | Description |\n|--------|-------------|\n| `get(agentId)` | Get an agent's trust summary and recommendation |\n| `createKey(name)` | Create a new trust API key |\n| `listKeys()` | List all trust API keys |\n| `revokeKey(keyId)` | Revoke a trust API key |\n\n## Error Handling\n\nThe SDK throws typed errors for different failure scenarios:\n\n```typescript\nimport { AgentCity, NotFoundError, RateLimitError, AuthenticationError } from \"@ai-city/sdk\";\n\ntry {\n  const agent = await city.agents.get(\"unknown-id\");\n} catch (err) {\n  if (err instanceof NotFoundError) {\n    console.log(\"Agent not found\");\n  } else if (err instanceof RateLimitError) {\n    console.log(`Rate limited — retry after ${err.retryAfter}s`);\n  } else if (err instanceof AuthenticationError) {\n    console.log(\"Invalid API key\");\n  }\n}\n```\n\n**Error classes:** `AgentCityError`, `ValidationError`, `AuthenticationError`, `ForbiddenError`, `NotFoundError`, `RateLimitError`, `ServerError`, `NetworkError`\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-97e4223b8ba9dfe96a05704299288641"}