{"_id":"@ai2in/sdk","_rev":"2-3c182d26a65ab69f9bd1f475e527115b","name":"@ai2in/sdk","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@ai2in/sdk","version":"0.1.0","keywords":["ai","agents","sandbox","code-interpreter","india","e2b"],"author":{"url":"https://ai2in.dev","name":"AI2IN.dev"},"license":"MIT","_id":"@ai2in/sdk@0.1.0","maintainers":[{"name":"pradeepvonti","email":"pradeepvonti@aksdataai.com"}],"homepage":"https://ai2in.dev","bugs":{"url":"https://github.com/AI2IN-DEV/AI2IN/issues"},"dist":{"shasum":"7946e4107c5b42f99742eac2a42540b38c644cff","tarball":"https://registry.npmjs.org/@ai2in/sdk/-/sdk-0.1.0.tgz","fileCount":5,"integrity":"sha512-+xvXB2nd7azywbAHPPUXzRUqRpNCOiDbYIy2ma6bxMfTW/Yq1Wa9Rl90icKTf4oWNDOuK4U7bus4HIrDLg35NQ==","signatures":[{"sig":"MEUCIQDeO282A1IepXXJGYPKutXCd7W4L+1QVdwMZTPIHwYtjAIgWskMfni4a14lhUWszG+c6dt3gs5DZ5lw8ayuyAweC7Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24042},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"8e014ffe7e61f9932cebfe67ad0f5d9babb6af1c","scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"pradeepvonti","email":"pradeepvonti@aksdataai.com"},"repository":{"url":"git+https://github.com/AI2IN-DEV/AI2IN.git","type":"git","directory":"sdk/js"},"_npmVersion":"10.8.2","description":"JavaScript / TypeScript SDK for AI2IN — secure AI code sandboxes, hosted in India.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1783181452373_0.7121543770125076","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@ai2in/sdk","version":"0.3.0","description":"JavaScript / TypeScript SDK for AI2IN — secure AI code sandboxes, hosted in India.","license":"MIT","author":{"name":"AI2IN.dev","url":"https://ai2in.dev"},"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./ai":{"types":"./dist/ai.d.ts","import":"./dist/ai.js"},"./langchain":{"types":"./dist/langchain.d.ts","import":"./dist/langchain.js"}},"engines":{"node":">=18"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","prepublishOnly":"npm run build"},"keywords":["ai","agents","sandbox","code-interpreter","india","e2b"],"homepage":"https://ai2in.dev","repository":{"type":"git","url":"git+https://github.com/AI2IN-DEV/AI2IN.git","directory":"sdk/js"},"bugs":{"url":"https://github.com/AI2IN-DEV/AI2IN/issues"},"publishConfig":{"access":"public"},"peerDependencies":{"zod":"^3.23.0","ai":"^4.0.0 || ^5.0.0","@langchain/core":"^0.3.0"},"peerDependenciesMeta":{"zod":{"optional":true},"ai":{"optional":true},"@langchain/core":{"optional":true}},"devDependencies":{"typescript":"^5.5.0","@types/node":"^20.0.0","zod":"^3.23.0","@langchain/core":"^0.3.0"},"_id":"@ai2in/sdk@0.3.0","gitHead":"d2ecad5fc494040a3faed5239b9fa769714dfd39","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-BCnkznel/zQW8BxMPfpQIF077gwuA4wK9LU3SqUB4CpJE1UBDMcJ60ynD/YXJvVCbnwIFXEd0GLZARvKkjEueQ==","shasum":"d444eb09f8a29ae349a457a1dd88c46b3d711904","tarball":"https://registry.npmjs.org/@ai2in/sdk/-/sdk-0.3.0.tgz","fileCount":9,"unpackedSize":37751,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDEEMb+/CjFPEuE+L61a2Z3Z+tb3RjVYWlXcOCZDaA73AiAYRFls7HxYhvYF53jdEIYdhEP675Fmyso0AUiq6ERv8Q=="}]},"_npmUser":{"name":"pradeepvonti","email":"pradeepvonti@aksdataai.com"},"directories":{},"maintainers":[{"name":"pradeepvonti","email":"pradeepvonti@aksdataai.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.3.0_1783204454579_0.029767801094295443"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-04T16:10:52.183Z","modified":"2026-07-04T22:34:14.900Z","0.1.0":"2026-07-04T16:10:52.498Z","0.3.0":"2026-07-04T22:34:14.765Z"},"bugs":{"url":"https://github.com/AI2IN-DEV/AI2IN/issues"},"author":{"name":"AI2IN.dev","url":"https://ai2in.dev"},"license":"MIT","homepage":"https://ai2in.dev","keywords":["ai","agents","sandbox","code-interpreter","india","e2b"],"repository":{"type":"git","url":"git+https://github.com/AI2IN-DEV/AI2IN.git","directory":"sdk/js"},"description":"JavaScript / TypeScript SDK for AI2IN — secure AI code sandboxes, hosted in India.","maintainers":[{"name":"pradeepvonti","email":"pradeepvonti@aksdataai.com"}],"readme":"# @ai2in/sdk — JavaScript / TypeScript SDK\n\nThe developer client for [AI2IN.dev](https://ai2in.dev) — secure AI code\nsandboxes, hosted in India. Spin up an isolated Linux sandbox, run untrusted /\nAI‑generated Python in a stateful kernel, and get back rich, typed results\n(text, HTML tables, charts, JSON) — the E2B code‑interpreter model, in‑region.\n\nZero runtime dependencies (global `fetch`, Node 18+).\n\n## Install\n\n```bash\nnpm install @ai2in/sdk          # once published\n# or, from this repo:\ncd sdk/js && npm install && npm run build\n```\n\n## Quickstart\n\n```ts\nimport { Sandbox } from \"@ai2in/sdk\";\n\nconst sbx = await Sandbox.create({\n  apiKey: \"ai2in_live_…\",\n  baseUrl: \"https://api.ai2in.dev\",\n});\n\nconst execution = await sbx.runCode(\n  \"import pandas as pd; pd.DataFrame({'gst_lakh_cr': [1.87, 1.73, 1.95]})\"\n);\n\nconsole.log(execution.text);          // the main result's plain text\nconsole.log(execution.logs.stdout);   // ['…']\n\nfor (const r of execution.results) {  // rich, typed outputs\n  if (r.html) save(r.html);           // e.g. a DataFrame → HTML table\n  if (r.png) saveImage(r.png);        // e.g. a matplotlib figure → base64 PNG\n}\n\nif (execution.error) {                // structured error for self-correction\n  console.error(execution.error.name, execution.error.value);\n}\n\nawait sbx.kill();\n```\n\nState persists across `runCode` calls in the same sandbox (like a notebook):\n\n```ts\nawait sbx.runCode(\"x = 41\");\n(await sbx.runCode(\"x + 1\")).text;    // \"42\"\n```\n\n## Streaming\n\nPass callbacks to stream output **live** as the kernel produces it (long loops,\ntraining logs, incremental prints). The events are still accumulated into the\nresolved `Execution`, so the return value is identical whether or not you stream:\n\n```ts\nconst execution = await sbx.runCode(\n  \"for i in range(5):\\n    print('step', i); import time; time.sleep(1)\",\n  {\n    onStdout: (t) => process.stdout.write(t),  // arrives chunk-by-chunk\n    onResult: (r) => render(r),                // display() calls, figures, the value\n    onError:  (e) => console.error(e.value),\n  }\n);\nconsole.log(execution.executionMs);            // still get the full Execution\n```\n\n## Result model\n\n`runCode()` returns an `Execution`:\n\n| Field | Type | Notes |\n|---|---|---|\n| `results` | `Result[]` | rich outputs; the cell's value has `isMainResult: true` |\n| `logs` | `Logs` | `.stdout` / `.stderr` (string arrays) |\n| `error` | `ExecutionError \\| null` | `.name`, `.value`, `.traceback` |\n| `text` | `string \\| null` | convenience: the main result's text |\n\nEach `Result` may carry any of: `text`, `html`, `markdown`, `svg`, `png`,\n`jpeg`, `pdf`, `latex`, `json`, `javascript`.\n\n## Local dev\n\nPoint at a local engine (default `http://localhost:4000`):\n\n```ts\nconst sbx = await Sandbox.create();            // talks to localhost:4000\nconsole.log((await sbx.runCode(\"print(1 + 1)\")).logs.stdout);\n```\n\n---\n\n© 2026 AI2IN.dev — see the repository LICENSE.\n","readmeFilename":"README.md"}