{"_id":"@an-sdk/agent","_rev":"6-d0c40e40c893d9c45ec43a7fdd497b9d","name":"@an-sdk/agent","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@an-sdk/agent","version":"0.0.1","keywords":["ai","agent","tools","an","an.dev","sdk","claude","codex"],"license":"MIT","_id":"@an-sdk/agent@0.0.1","maintainers":[{"name":"bunasq","email":"realsergeybunas@gmail.com"}],"homepage":"https://an.dev","dist":{"shasum":"cbfdfa197ba07fc42f991500532fa77c38560cd3","tarball":"https://registry.npmjs.org/@an-sdk/agent/-/agent-0.0.1.tgz","fileCount":7,"integrity":"sha512-LhFfQtkdUKiYh1+35M5y5aWtu5hjyVX4k7uso5WP6V3nKSKcp+k3C9iJxHcu6mId7PLIFMKj3v8VsJjDCmOQQw==","signatures":[{"sig":"MEQCIEXhjd7EUwJ/yXI6NSNNNL7p2Ks30EaRejOKTKZuorrBAiAEvcrLpylDHPXgVA+/U0o4KMCI3XlLzroG18S1TgTW0A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12947},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"b0be80080123e3a8af15925cf177e153e39e141c","scripts":{"dev":"tsup --watch","lint":"tsc --noEmit","build":"tsup"},"_npmUser":{"name":"bunasq","email":"realsergeybunas@gmail.com"},"_npmVersion":"11.6.2","description":"Define AI agents and tools with full type inference — the config layer for AN","directories":{},"_nodeVersion":"22.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24","tsup":"^8.0.0","typescript":"^5.4.5"},"peerDependencies":{"zod":"^3.24"},"_npmOperationalInternal":{"tmp":"tmp/agent_0.0.1_1771918335240_0.030742226563421626","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@an-sdk/agent","version":"0.0.2","keywords":["ai","agent","tools","an","an.dev","sdk","claude","codex"],"license":"MIT","_id":"@an-sdk/agent@0.0.2","maintainers":[{"name":"bunasq","email":"realsergeybunas@gmail.com"}],"homepage":"https://an.dev","dist":{"shasum":"551392c22b41e52bec061bb5a22b047fca9cd809","tarball":"https://registry.npmjs.org/@an-sdk/agent/-/agent-0.0.2.tgz","fileCount":7,"integrity":"sha512-NW6/2LiYfwAFtprb2kN6V9i3rj4wbz3jTl64pELfUfAs++TAzWGICoQ7vNHWmcuC61zznhmxjcgxdyVHRot4ew==","signatures":[{"sig":"MEYCIQCZRp8OELoIdHgpkjkUinPYMy3eZdslb9uDDrEbu0GAtgIhAIM+fQOoL2xbcDILXVePytFWVCARWBMX2q8NE1cfyWVb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12948},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"b0be80080123e3a8af15925cf177e153e39e141c","scripts":{"dev":"tsup --watch","lint":"tsc --noEmit","build":"tsup"},"_npmUser":{"name":"bunasq","email":"realsergeybunas@gmail.com"},"_npmVersion":"11.6.2","description":"Define AI agents and tools with full type inference — the config layer for AN","directories":{},"_nodeVersion":"22.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24","tsup":"^8.0.0","typescript":"^5.4.5"},"peerDependencies":{"zod":">=3.24"},"_npmOperationalInternal":{"tmp":"tmp/agent_0.0.2_1771918698065_0.6564948713009648","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@an-sdk/agent","version":"0.0.3","keywords":["ai","agent","tools","an","an.dev","sdk","claude","codex"],"license":"MIT","_id":"@an-sdk/agent@0.0.3","maintainers":[{"name":"bunasq","email":"realsergeybunas@gmail.com"}],"homepage":"https://an.dev","dist":{"shasum":"e7758b4c4975220e6d6cdff6acd548d8e14ad158","tarball":"https://registry.npmjs.org/@an-sdk/agent/-/agent-0.0.3.tgz","fileCount":8,"integrity":"sha512-UDmOZ4nQaazy9woFD8rhy09G6HlQ3hVWTnDxSXSxxMCQaWEEE+tEO52nYPsLi0O7gUFC+j79T+PLjxEKxskKUQ==","signatures":[{"sig":"MEUCIQD+E50hlKDRkPUMryUNLWR3hIY4aQvRoR8/RW+L/bSKDwIgN+47JKN2q6kvYcBeM0TxGnCyPAryvo1wA7AdrH3QXbM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15974},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"b0be80080123e3a8af15925cf177e153e39e141c","scripts":{"dev":"tsup --watch","lint":"tsc --noEmit","build":"tsup"},"_npmUser":{"name":"bunasq","email":"realsergeybunas@gmail.com"},"_npmVersion":"11.6.2","description":"Define AI agents and tools with full type inference — the config layer for AN","directories":{},"_nodeVersion":"22.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24","tsup":"^8.0.0","typescript":"^5.4.5"},"peerDependencies":{"zod":">=3.24"},"_npmOperationalInternal":{"tmp":"tmp/agent_0.0.3_1771962754922_0.2747613880439925","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@an-sdk/agent","version":"0.0.4","keywords":["ai","agent","tools","an","an.dev","sdk","claude","codex"],"license":"MIT","_id":"@an-sdk/agent@0.0.4","maintainers":[{"name":"bunasq","email":"realsergeybunas@gmail.com"},{"name":"danverr","email":"ddmaryakhin@mail.ru"}],"homepage":"https://an.dev","dist":{"shasum":"933fda51984b0cbf92b94459c9c13702372203c2","tarball":"https://registry.npmjs.org/@an-sdk/agent/-/agent-0.0.4.tgz","fileCount":21,"integrity":"sha512-Eu97KAaBc9U7Rxybmq8cMC46QzDJiWjOnLvDP7N9A82gFM12pE2PHi1Ay3ZS+xvMYdik7kEo8D42xHAl0TALWQ==","signatures":[{"sig":"MEUCIQCrdeMGQhn9hNjuIpHoVnX9GruedAXrZJ5Dz9f9wktZXAIgWzFGF3Zr5KbCWuijv0JHlivA1DO2Eu6mTAwcCjlPXDE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44128},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"c215fdaca5f6b546b0fe69cfc5e57611f833a48f","scripts":{"dev":"tsup --watch","lint":"tsc --noEmit","build":"tsup","prepack":"cp -r ../docs ./docs","postpack":"rm -rf ./docs"},"_npmUser":{"name":"bunasq","email":"realsergeybunas@gmail.com"},"_npmVersion":"11.6.2","description":"Define AI agents and tools with full type inference — the config layer for AN","directories":{"doc":"./docs"},"_nodeVersion":"22.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24","tsup":"^8.0.0","typescript":"^5.4.5"},"peerDependencies":{"zod":">=3.24"},"_npmOperationalInternal":{"tmp":"tmp/agent_0.0.4_1772238782946_0.06774662240855123","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@an-sdk/agent","version":"0.0.5","license":"MIT","description":"Define AI agents and tools with full type inference — the config layer for AN","homepage":"https://an.dev","publishConfig":{"access":"public"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"directories":{"doc":"./docs"},"keywords":["ai","agent","tools","an","an.dev","sdk","claude","codex"],"scripts":{"prepack":"cp -r ../docs ./docs","postpack":"rm -rf ./docs","build":"tsup","dev":"tsup --watch","lint":"tsc --noEmit"},"peerDependencies":{"zod":">=3.24"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.4.5","zod":"^3.24"},"_id":"@an-sdk/agent@0.0.5","gitHead":"b8227ba7850b0563251aedfb70965040d35cd49c","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-OkwxcEsVjf/83tt2P2zfC/+j+e+J/fTOHa5dxBnDXFmg2zLyc3l3cS4Bty3VTqP/VI49d2U5zf3hS/iSIDwxUQ==","shasum":"ac0042d7cd6c2f20f98b3ba50bb79f3d95b34f6c","tarball":"https://registry.npmjs.org/@an-sdk/agent/-/agent-0.0.5.tgz","fileCount":21,"unpackedSize":46076,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD5hh3H1O+4L+n+P8J9jOmnVxXeF1QAbY9Jp0h5ZvWrFgIgGSxRrfdyoWLaZTN7uWH+YCDQJaoda3iATnb7wM0T28w="}]},"_npmUser":{"name":"danverr","email":"ddmaryakhin@mail.ru"},"maintainers":[{"name":"bunasq","email":"realsergeybunas@gmail.com"},{"name":"danverr","email":"ddmaryakhin@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent_0.0.5_1772675736279_0.9800925910505682"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-24T07:32:15.147Z","modified":"2026-03-05T01:55:36.565Z","0.0.1":"2026-02-24T07:32:15.377Z","0.0.2":"2026-02-24T07:38:18.216Z","0.0.3":"2026-02-24T19:52:35.051Z","0.0.4":"2026-02-28T00:33:03.094Z","0.0.5":"2026-03-05T01:55:36.433Z"},"license":"MIT","homepage":"https://an.dev","keywords":["ai","agent","tools","an","an.dev","sdk","claude","codex"],"description":"Define AI agents and tools with full type inference — the config layer for AN","maintainers":[{"name":"bunasq","email":"realsergeybunas@gmail.com"},{"name":"danverr","email":"ddmaryakhin@mail.ru"}],"readme":"# @an-sdk/agent\n\nDefine AI agents with full type inference. The config layer for [AN](https://an.dev).\n\n## Install\n\n```bash\nnpm install @an-sdk/agent zod\n```\n\n## Quick Start\n\nCreate `src/agent.ts`:\n\n```ts\nimport { agent, tool } from \"@an-sdk/agent\"\nimport { z } from \"zod\"\n\nexport default agent({\n  model: \"claude-sonnet-4-6\",\n  systemPrompt: \"You are a helpful coding assistant.\",\n  tools: {\n    greet: tool({\n      description: \"Greet a user by name\",\n      inputSchema: z.object({ name: z.string() }),\n      execute: async ({ name }) => ({\n        content: [{ type: \"text\", text: `Hello, ${name}!` }],\n      }),\n    }),\n  },\n})\n```\n\nThen deploy with the [AN CLI](https://www.npmjs.com/package/@an-sdk/cli):\n\n```bash\nnpx @an-sdk/cli login\nnpx @an-sdk/cli deploy\n```\n\n## API\n\n### `agent(config)`\n\nCreates an agent configuration. Returns the config with a `_type: \"agent\"` tag for the runtime.\n\n```ts\nexport default agent({\n  // Model to use (default: \"claude-sonnet-4-6\")\n  model: \"claude-sonnet-4-6\",\n\n  // System prompt for the agent\n  systemPrompt: \"You are a PR reviewer...\",\n\n  // Custom tools the agent can use\n  tools: {\n    lint: tool({ ... }),\n    test: tool({ ... }),\n  },\n\n  // Runtime: \"claude-code\" (default) or \"codex\"\n  runtime: \"claude-code\",\n\n  // Permission mode: \"default\", \"acceptEdits\", or \"bypassPermissions\"\n  permissionMode: \"default\",\n\n  // Max turns before stopping (default: 50)\n  maxTurns: 50,\n\n  // Max budget in USD\n  maxBudgetUsd: 5,\n\n  // Lifecycle hooks\n  onStart: async () => { ... },\n  onToolCall: async ({ toolName, input }) => { ... },\n  onToolResult: async ({ toolName, input, output }) => { ... },\n  onStepFinish: async ({ step }) => { ... },\n  onFinish: async ({ result }) => { ... },\n  onError: async ({ error }) => { ... },\n})\n```\n\n### `tool(definition)`\n\nCreates a tool definition with Zod schema validation.\n\n```ts\nimport { tool } from \"@an-sdk/agent\"\nimport { z } from \"zod\"\n\nconst myTool = tool({\n  description: \"What this tool does\",\n  inputSchema: z.object({\n    path: z.string(),\n    verbose: z.boolean().optional(),\n  }),\n  execute: async (args) => {\n    // args is fully typed from the schema\n    return {\n      content: [{ type: \"text\", text: \"result\" }],\n    }\n  },\n})\n```\n\n### Hooks\n\n#### `onToolCall`\n\nRuns before a tool executes. Return `false` to block it.\n\n```ts\nonToolCall: async ({ toolName, input }) => {\n  if (toolName === \"Bash\" && input.command?.includes(\"rm -rf\")) {\n    return false // blocked\n  }\n}\n```\n\n#### `onFinish`\n\nRuns when the agent completes successfully.\n\n```ts\nonFinish: async ({ result }) => {\n  await fetch(\"https://my-api.com/webhook\", {\n    method: \"POST\",\n    body: JSON.stringify({ done: true }),\n  })\n}\n```\n\n## How It Works\n\n`agent()` and `tool()` are identity functions — they return exactly what you pass in, with type inference added. The actual execution happens in the AN runtime (E2B sandbox) using the Claude Agent SDK.\n\nYour code runs in a secure cloud sandbox with full access to Node.js, git, and system tools.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}