{"_id":"@agentscope-sdk/sdk","_rev":"8-f9f3497218cf4c39db777b32fc06594b","name":"@agentscope-sdk/sdk","dist-tags":{"latest":"0.1.7"},"versions":{"0.1.0":{"name":"@agentscope-sdk/sdk","version":"0.1.0","keywords":["agentscope","observability","telemetry","agent"],"license":"MIT","_id":"@agentscope-sdk/sdk@0.1.0","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"7104175c40c2df867b063abc36f4cb7b45c6066a","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.0.tgz","fileCount":24,"integrity":"sha512-tuwVUOJjGzQwRSBa3ygOnLrW0iG2tfspFFUf/nLHrbJBvr6zZGC+L72TgZtUEVUz/JAlTNlaaoMEqDpYPLEsSw==","signatures":[{"sig":"MEUCIQDtnrGKOy6luOTDu0/V5NHsa8myo1qxo8ZyqXrL8+1w3wIgJMuYG/aelLMHFZ22IySB3sQtm0UDWOAUu82GX892qQ8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42508},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"0820a44b866744b2c4a9d13409005248e2c6129f","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1774100753103_0.3522881451005262","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agentscope-sdk/sdk","version":"0.1.1","keywords":["agentscope","observability","telemetry","agent"],"license":"MIT","_id":"@agentscope-sdk/sdk@0.1.1","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"4964a298e5b8b70dbe65fbc7d0982dfd1de9ea24","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.1.tgz","fileCount":24,"integrity":"sha512-PCrYvYyKRXKmrmybWnhyHZ0qo+VkVM0js7jsSS22HwpET65vklLCLNaYSLVc74bBjJdETVLSMLMWvvEzxxJCmA==","signatures":[{"sig":"MEUCIQDEu2xQQswZ/oF+MFkaTUVY6J2tVb/K5bQj3tH+2zc2UAIgeU+XIW/PQbMQaU7wPMBobWv6C/rsfarCckxy7SqSYWo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42968},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"6f9ea522552a133f0ce3c4207d4457c188ec2022","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1774100990625_0.6163312866217672","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agentscope-sdk/sdk","version":"0.1.2","keywords":["agentscope","observability","telemetry","agent"],"license":"UNLICENSED","_id":"@agentscope-sdk/sdk@0.1.2","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"93a891fedc12675f20f1b2f784ec76c4ee41ac00","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.2.tgz","fileCount":24,"integrity":"sha512-thqf1oReZBwzP/mLj+uOGPcvSV/2N61f+n+YE6WzqOXzVt//+DbMgkcRy61zWZ+eHNOph/Q5kRbssJ1e5krBWQ==","signatures":[{"sig":"MEUCIGH8PwuZxdYlTxCUgXlGicIOpeM8KDn5rx5kG6LnIzSKAiEAyD0izCg0A0SxDb2hYjeCW53uMTGAHVSn+1K3jyeOhYY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44153},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"89ae04afeaf0290a37e3a92b32d06677023d228e","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.2_1775138814441_0.49809069357851365","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@agentscope-sdk/sdk","version":"0.1.3","keywords":["agentscope","observability","telemetry","agent"],"license":"UNLICENSED","_id":"@agentscope-sdk/sdk@0.1.3","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"bc3d99a73b07af602565615e80cbc6033dfca15b","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.3.tgz","fileCount":24,"integrity":"sha512-15iEF53T9n5/8gxbBmOELIFFZM0nG23AMGnTn+7wKpGvk3NnT2t6eUziLK+P9K59jjrBOhYiJC/k+5/60zWt8w==","signatures":[{"sig":"MEUCIQCDkLbepw9i5Uj6EKhE4pcz60VsHLxKCrZua1Gt92SyFAIgFq5RdRRh6mfp0u0+qCE+9A0DqCgdJ1pZzl9ef1tA108=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45144},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"298d26ddab906257d2ea53712cbe8ef53d3d6c96","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.3_1775382259435_0.06335686596794332","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@agentscope-sdk/sdk","version":"0.1.4","keywords":["agentscope","observability","telemetry","agent"],"license":"UNLICENSED","_id":"@agentscope-sdk/sdk@0.1.4","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"32faec0a296a5ea5d7c64346a4ad3ee13dac4b2f","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.4.tgz","fileCount":24,"integrity":"sha512-LXNVPKGRxcG93asY2axpneIPEEOBHFoYVf1cpLV8td+oj9Z9jt/k+r9JpLU3c9qh59xmPIAS675aokrKZIFb0g==","signatures":[{"sig":"MEUCIAC26KbGJGaEbNCcaBJdUyhq5iqUD+K53x7GeLDyNPwbAiEA1kHUTIB7WIUyQucgBHyoSWPZVePnVCSErmYFiiwb2DE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45144},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"58e47e735ba7f2ea541597f9b1e329a916859c6e","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.4_1775393318512_0.1265415703482642","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@agentscope-sdk/sdk","version":"0.1.5","keywords":["agentscope","observability","telemetry","agent"],"license":"UNLICENSED","_id":"@agentscope-sdk/sdk@0.1.5","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"760cb3649eb3aadba74805af9115b3c851a71e25","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.5.tgz","fileCount":24,"integrity":"sha512-o12w5fjyEfPDFG1fq+elM5x2kXoAcxOtX8IH0pIjoIKHjJPuVGLgErFs5WTImb6iE+AyWyH+jrEUzGAGJ2SMug==","signatures":[{"sig":"MEUCIQC7W/fgb1SJApoZ2nlBvx/Yb2dA7MiOB1R1QFKtdeAWqgIgXU8IZo5xIng7oAXI66JB7knKetap2JIJqI/JO4f6WtE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45144},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"58e47e735ba7f2ea541597f9b1e329a916859c6e","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.5_1775394262006_0.1285018439741481","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@agentscope-sdk/sdk","version":"0.1.6","keywords":["agentscope","observability","telemetry","agent"],"license":"UNLICENSED","_id":"@agentscope-sdk/sdk@0.1.6","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"dist":{"shasum":"ebd2314c052b93be72cc4908296a908780080d9a","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.6.tgz","fileCount":26,"integrity":"sha512-HEgbXeuNadEYUQYMhYqcH2azu7A4FehGxhkcRPvBkwvAO5banQ+RbVvd7uk1v0NfMM0Hh4O2//k2UI2G0iYYQg==","signatures":[{"sig":"MEQCIBQaGfzxi+ldAGdnHkf/8AGT1egBOY38fzoCOXScRD+gAiBJzwmOPmKxWbHvnI0HwvI9z1dBQ9H+RY2H50N2WMbSew==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52907},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"597e439dac438d98ad842ff55778d24e3deeb79c","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"_npmVersion":"10.9.2","description":"AgentScope TypeScript SDK","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.6_1775470692703_0.042626517649470674","host":"s3://npm-registry-packages-npm-production"}},"0.1.7":{"name":"@agentscope-sdk/sdk","version":"0.1.7","description":"AgentScope TypeScript SDK","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","example":"npm run build && node examples/basic.js"},"keywords":["agentscope","observability","telemetry","agent"],"license":"UNLICENSED","engines":{"node":">=18"},"devDependencies":{"@types/node":"^24.0.0","typescript":"^5.8.2"},"_id":"@agentscope-sdk/sdk@0.1.7","gitHead":"9dd2ddf9e6a87c23b9ad47fc9de158c7af949358","_nodeVersion":"23.7.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-9lhdarmlu1JF1N46HPser+db3XQD60L2fWf0HZ8MXdKOUmak+B0238f1rtfvSMVlHMTscFF/yVFK+t7RPTHP0Q==","shasum":"450b4b26185b3ada03fd4c7526c7d08a62bbbfdd","tarball":"https://registry.npmjs.org/@agentscope-sdk/sdk/-/sdk-0.1.7.tgz","fileCount":26,"unpackedSize":55448,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEl+spJHAbRxlnRrz7nWR5N2It/eLgMSLxH8Y/4JBvU8AiEAuuVeHvoV/t4acggm+LvB9BFrMxtZ0V9sa9Nk8P3tM7U="}]},"_npmUser":{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"},"directories":{},"maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.7_1776065316685_0.1497690058049208"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-21T13:45:52.979Z","modified":"2026-04-13T07:28:37.275Z","0.1.0":"2026-03-21T13:45:53.274Z","0.1.1":"2026-03-21T13:49:50.774Z","0.1.2":"2026-04-02T14:06:54.587Z","0.1.3":"2026-04-05T09:44:19.589Z","0.1.4":"2026-04-05T12:48:38.677Z","0.1.5":"2026-04-05T13:04:22.148Z","0.1.6":"2026-04-06T10:18:12.842Z","0.1.7":"2026-04-13T07:28:36.826Z"},"license":"UNLICENSED","keywords":["agentscope","observability","telemetry","agent"],"description":"AgentScope TypeScript SDK","maintainers":[{"name":"agentscope-sdk","email":"dinesh.rwp@gmail.com"}],"readme":"# AgentScope TypeScript SDK\n\nNode.js SDK for instrumenting runs, spans, and artifacts and exporting them to the AgentScope ingestion API.\n\n## Install\n\n```bash\nnpm install\nnpm run build\n```\n\n## Usage\n\n```ts\nimport { addArtifact, autoInstrument, observeRun, observeSpan, trace } from \"@agentscope/sdk\";\n\nautoInstrument([\"openai\", \"anthropic\"]);\n\nawait observeRun(\"coding_agent\", async () => {\n  await observeSpan(\"file_read\", async () => {\n    // file read logic\n  });\n\n  await observeSpan(\"llm_call\", async () => {\n    addArtifact(\"llm.prompt\", {\n      model: \"gpt-4o\",\n      messages: [{ role: \"user\", content: \"hello\" }],\n    });\n  });\n\n  trace.log(\"run step finished\", { level: \"info\" });\n});\n```\n\nSet `AGENTSCOPE_API_BASE=http://localhost:8080` if the API is not running on the default host.\n\n## Anonymous SDK Telemetry (Optional)\n\nSDK usage telemetry is disabled by default. To opt in, set:\n\n```bash\nexport AGENTSCOPE_TELEMETRY_ENABLED=true\n```\n\nWhen enabled, the SDK sends only anonymous events (`sdk_init`, `run_start`, `run_end`) to `POST /v1/telemetry` with an anonymized `project_id` stored in `~/.agentscope/config.json`. Prompt/output content and user payloads are never sent by this channel.\n\n## Example Script\n\n```bash\nnpm install\nnpm run example\n```\n\nThis runs `examples/basic.js`, which emits a run with nested spans and artifacts to the local AgentScope API.\n\n## API\n\n- `observeRun(workflowName, fn, options?)`\n  - Cross-run linkage options in `options`: `traceId`, `parentRunId`, `rootRunId`\n- `observeSpan(name, fn, options?)`\n- `addArtifact(kind, payload, spanId?)`\n- `trace.auto(providers?)`\n- `trace.log(message, options?)`\n- `trace.updateSpan(spanId, data)`\n- `autoTrace(providers?)`\n- `autoInstrument(providers?)`\n- `codingAgentRun(fn, options?)`\n- `instrumentCodingAgent(fn)`\n- `readFile(filePath, encoding?)`\n- `writeFile(filePath, content, encoding?)`\n- `runCommand(command, options?)`\n- `flush()`\n\n## Fetch Instrumentation\n\nPhase two includes fetch auto-instrumentation:\n\n```ts\nimport { instrumentFetch, observeRun } from \"@agentscope/sdk\";\n\nconst restoreFetch = instrumentFetch();\n\nawait observeRun(\"coding_agent\", async () => {\n  await fetch(\"https://api.openai.com/v1/chat/completions\", {\n    method: \"POST\",\n    headers: {\n      \"content-type\": \"application/json\",\n      authorization: `Bearer ${process.env.OPENAI_API_KEY}`,\n    },\n    body: JSON.stringify({\n      model: \"gpt-4o\",\n      messages: [{ role: \"user\", content: \"hello\" }],\n    }),\n  });\n});\n\nrestoreFetch();\n```\n\nOpenAI-compatible requests are detected by URL and JSON payload shape. Prompt and response bodies are captured as `llm.prompt` and `llm.response` artifacts.\n","readmeFilename":"README.md"}