{"_id":"@humanlayer/sdk","_rev":"5-1a90efb84d266bb32bbcd8863fedf573","name":"@humanlayer/sdk","dist-tags":{"alpha":"0.7.9-alpha.1","latest":"0.7.9"},"versions":{"0.7.8-alpha.1":{"name":"@humanlayer/sdk","version":"0.7.8-alpha.1","keywords":["human-in-the-loop","ai-agents","tool-use","function-calling"],"author":{"name":"HumanLayer Authors"},"license":"Apache-2.0","_id":"@humanlayer/sdk@0.7.8-alpha.1","maintainers":[{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"}],"homepage":"https://github.com/humanlayer/humanlayer#readme","bugs":{"url":"https://github.com/humanlayer/humanlayer/issues"},"dist":{"shasum":"6838f0510c02a01d086860eacebf0172cf7d5f97","tarball":"https://registry.npmjs.org/@humanlayer/sdk/-/sdk-0.7.8-alpha.1.tgz","fileCount":47,"integrity":"sha512-UI5ELaQB0Lu26Eq0snoJ/A3ALJkn9TSbpasYHAokXI3EK79uHOGL1lHzjPD1m1UpAgGs23+qYwxam5WD70WzhA==","signatures":[{"sig":"MEQCIEP6J5xqXVrU8q3d5c8Z4oo6582iP5uDTcW/8aKCnnWDAiA4xf+Qj2zJoVDz0+f8XFn4YgBQ6CL8yTJ2OozFPRm0PA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":133382},"main":"./dist/index.cjs","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"gitHead":"d4a9e7645690b0ab20f230a87b2ba5a0affdbab8","private":false,"scripts":{"dev":"node -r ts-node/register src/index.ts","test":"jest","build":"tsc && pkgroll","check":"tsc --noEmit"},"_npmUser":{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"},"repository":{"url":"git+https://github.com/humanlayer/humanlayer.git","type":"git"},"_npmVersion":"10.9.2","description":"typescript client for humanlayer.dev","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","pkgroll":"^2.10.0","ts-jest":"^29.1.5","ts-node":"^10.9.2","prettier":"^3.3.2","typescript":"^5.7.3","@types/jest":"^29.5.14","@types/node":"^20.17.11"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.7.8-alpha.1_1748533320395_0.7521743874057867","host":"s3://npm-registry-packages-npm-production"}},"0.7.8":{"name":"@humanlayer/sdk","version":"0.7.8","keywords":["human-in-the-loop","ai-agents","tool-use","function-calling"],"author":{"name":"HumanLayer Authors"},"license":"Apache-2.0","_id":"@humanlayer/sdk@0.7.8","maintainers":[{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"}],"homepage":"https://github.com/humanlayer/humanlayer#readme","bugs":{"url":"https://github.com/humanlayer/humanlayer/issues"},"dist":{"shasum":"cfb1148cf1d69f15795744f1df4bbeae938658e9","tarball":"https://registry.npmjs.org/@humanlayer/sdk/-/sdk-0.7.8.tgz","fileCount":47,"integrity":"sha512-A2AJqpstF7ISxTj8w3UN9Z60WzukDmxmInR4gq5ZARepF0HHQfEsB5v5ZMVQn5TN+/l3+T2Dwf2TT5f9JChl8Q==","signatures":[{"sig":"MEYCIQCAxFUVeftWlwgMgQudHUIfeh5rcMjda+W0GqVuc5ZOIAIhAKmV5PMtKb5iJGR3AhyDILe+tQ9w2+VGBXrMkLWu47qG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":133374},"main":"./dist/index.cjs","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"gitHead":"d4a9e7645690b0ab20f230a87b2ba5a0affdbab8","private":false,"scripts":{"dev":"node -r ts-node/register src/index.ts","test":"jest","build":"tsc && pkgroll","check":"tsc --noEmit"},"_npmUser":{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"},"repository":{"url":"git+https://github.com/humanlayer/humanlayer.git","type":"git"},"_npmVersion":"10.9.2","description":"typescript client for humanlayer.dev","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","pkgroll":"^2.10.0","ts-jest":"^29.1.5","ts-node":"^10.9.2","prettier":"^3.3.2","typescript":"^5.7.3","@types/jest":"^29.5.14","@types/node":"^20.17.11"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.7.8_1748533923221_0.14291620549042272","host":"s3://npm-registry-packages-npm-production"}},"0.7.9-alpha.1":{"name":"@humanlayer/sdk","version":"0.7.9-alpha.1","keywords":["human-in-the-loop","ai-agents","tool-use","function-calling"],"author":{"name":"HumanLayer Authors"},"license":"Apache-2.0","_id":"@humanlayer/sdk@0.7.9-alpha.1","maintainers":[{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"}],"homepage":"https://github.com/humanlayer/humanlayer#readme","bugs":{"url":"https://github.com/humanlayer/humanlayer/issues"},"dist":{"shasum":"4fa6eda68bc428eeae33d0a637e2718731f91ce0","tarball":"https://registry.npmjs.org/@humanlayer/sdk/-/sdk-0.7.9-alpha.1.tgz","fileCount":50,"integrity":"sha512-mB5aZeWbDjsxWPX7PC3M3NhFZa5IgivVGEbQDSAiP0692TpEkxAned37wqkwJw1lwIKg2TmCJ7/sCn7q51bkTA==","signatures":[{"sig":"MEUCIDXVJqAA0mgJDAGKCQNiTTKK7pNVdXP+zvTpxO2P8/l0AiEAuJZcVw3k15bpHFIPfnjYtmTfx/8megiRY6yLXhwAJn4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":137389},"main":"./dist/index.cjs","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"gitHead":"1298055889e7740d84d6e6e2460a7d536671d268","private":false,"scripts":{"dev":"node -r ts-node/register src/index.ts","test":"jest","build":"tsc && pkgroll","check":"tsc --noEmit"},"_npmUser":{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"},"repository":{"url":"git+https://github.com/humanlayer/humanlayer.git","type":"git"},"_npmVersion":"10.9.2","description":"typescript client for humanlayer.dev","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","pkgroll":"^2.10.0","ts-jest":"^29.1.5","ts-node":"^10.9.2","prettier":"^3.3.2","typescript":"^5.7.3","@types/jest":"^29.5.14","@types/node":"^20.17.11"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.7.9-alpha.1_1748982229256_0.012656718210722895","host":"s3://npm-registry-packages-npm-production"}},"0.7.9":{"name":"@humanlayer/sdk","version":"0.7.9","keywords":["human-in-the-loop","ai-agents","tool-use","function-calling"],"author":{"name":"HumanLayer Authors"},"license":"Apache-2.0","_id":"@humanlayer/sdk@0.7.9","maintainers":[{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"}],"homepage":"https://github.com/humanlayer/humanlayer#readme","bugs":{"url":"https://github.com/humanlayer/humanlayer/issues"},"dist":{"shasum":"93238f845b4e96535776b0cd159957abb93bc7e6","tarball":"https://registry.npmjs.org/@humanlayer/sdk/-/sdk-0.7.9.tgz","fileCount":50,"integrity":"sha512-TYLiM5mGNkF0H4YsZmPYzfoQB/942NIUtxrMMiK9V3nclzPc+qASoTeQH9GYMCq7ZivdItM6WKiMX8Kj2bfr9g==","signatures":[{"sig":"MEQCICYbxKk+yq1r2gZKZ2mXtWL8cHutDSRWU5Cchf2RAa+HAiAngxPzCTL+yzA4GQEKA50wMbnbq226ZUCYCf4YCLyZ2Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":137381},"main":"./dist/index.cjs","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"gitHead":"1298055889e7740d84d6e6e2460a7d536671d268","private":false,"scripts":{"dev":"node -r ts-node/register src/index.ts","test":"jest","build":"tsc && pkgroll","check":"tsc --noEmit"},"_npmUser":{"name":"dexhorthy-humanlayer","email":"dexter@humanlayer.dev"},"repository":{"url":"git+https://github.com/humanlayer/humanlayer.git","type":"git"},"_npmVersion":"10.9.2","description":"typescript client for humanlayer.dev","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","pkgroll":"^2.10.0","ts-jest":"^29.1.5","ts-node":"^10.9.2","prettier":"^3.3.2","typescript":"^5.7.3","@types/jest":"^29.5.14","@types/node":"^20.17.11"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.7.9_1748982369030_0.009018443224143802","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-05-29T15:42:00.272Z","modified":"2026-01-05T18:25:11.324Z","0.7.8-alpha.1":"2025-05-29T15:42:00.601Z","0.7.8":"2025-05-29T15:52:03.426Z","0.7.9-alpha.1":"2025-06-03T20:23:49.508Z","0.7.9":"2025-06-03T20:26:09.289Z"},"bugs":{"url":"https://github.com/humanlayer/humanlayer/issues"},"author":{"name":"HumanLayer Authors"},"license":"Apache-2.0","homepage":"https://github.com/humanlayer/humanlayer#readme","keywords":["human-in-the-loop","ai-agents","tool-use","function-calling"],"repository":{"url":"git+https://github.com/humanlayer/humanlayer.git","type":"git"},"description":"typescript client for humanlayer.dev","maintainers":[{"email":"kyle@humanlayer.dev","name":"kylelayer"},{"email":"dexter@humanlayer.dev","name":"dexhorthy-humanlayer"}],"readme":"# HumanLayer TypeScript SDK\n\nThe official TypeScript SDK for [HumanLayer](https://humanlayer.dev), providing human oversight for AI applications.\n\n## Installation\n\n```bash\nnpm install humanlayer\n```\n\n## Key Features\n\n- Human approval workflows for sensitive operations\n- Structured feedback collection from humans\n- Multiple contact channels (Slack, Email, etc.)\n- Full TypeScript support\n- Async/await API\n- Framework integrations\n\n## Basic Usage\n\n```typescript\nimport { humanlayer } from 'humanlayer'\n\nconst hl = humanlayer({\n  runId: 'my-agent',\n  contactChannel: {\n    slack: {\n      channelOrUserId: 'C123456',\n      contextAboutChannelOrUser: 'the compliance team',\n    },\n  },\n})\n\n// Require approval for sensitive functions\nconst sendEmail = hl.requireApproval(async (to: string, subject: string) => {\n  // Email sending logic here\n})\n\n// Get human input during execution\nconst support = hl.humanAsTool({\n  responseOptions: [\n    { name: 'approve', title: 'Approve' },\n    { name: 'deny', title: 'Deny' },\n  ],\n})\n```\n\n## Framework Support\n\n- OpenAI function calling\n- LangChain.js\n- Vercel AI SDK\n\n## Contact Channels\n\nConfigure how humans are contacted:\n\n```typescript\n// Slack\nconst slackChannel = {\n  slack: {\n    channelOrUserId: 'C123456',\n    contextAboutChannelOrUser: 'the support team',\n  },\n}\n\n// Email\nconst emailChannel = {\n  email: {\n    address: 'support@company.com',\n    contextAboutUser: 'the support team',\n  },\n}\n```\n\n## Response Options\n\nStructure human responses:\n\n```typescript\nconst options = [\n  {\n    name: 'approve',\n    title: 'Approve',\n    description: 'Approve the action',\n  },\n  {\n    name: 'deny',\n    title: 'Deny',\n    description: 'Deny with feedback',\n    promptFill: 'Denied because...',\n  },\n]\n\nconst approval = await hl.requireApproval(myFunction, {\n  responseOptions: options,\n})\n```\n\n## Error Handling\n\nThe SDK provides detailed error types:\n\n```typescript\ntry {\n  await hl.requireApproval(myFunction)()\n} catch (error) {\n  if (error instanceof HumanLayerException) {\n    // Handle HumanLayer-specific errors\n    console.error('HumanLayer error:', error.message)\n  } else {\n    // Handle other errors\n    console.error('Unexpected error:', error)\n  }\n}\n```\n\n## Environment Variables\n\nRequired:\n\n- `HUMANLAYER_API_KEY`: Your HumanLayer API key\n\nOptional:\n\n- `HUMANLAYER_API_BASE`: API base URL (default: https://api.humanlayer.dev/humanlayer/v1)\n- `HUMANLAYER_HTTP_TIMEOUT_SECONDS`: HTTP timeout in seconds (default: 30)\n\n## Examples\n\nSee the [examples directory](https://github.com/humanlayer/humanlayer/tree/main/examples#typescript-examples) for complete working examples:\n\n- [OpenAI function calling](https://github.com/humanlayer/humanlayer/tree/main/examples/ts_openai_client)\n- [Email classification](https://github.com/humanlayer/humanlayer/tree/main/examples/ts_email_classifier)\n- [Vercel AI SDK integration](https://github.com/humanlayer/humanlayer/tree/main/examples/ts_vercel_ai_sdk)\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Build\nnpm run build\n\n# Type check\nnpm run check\n```\n\n## License\n\nApache 2.0 - see [LICENSE](../LICENSE)\n","readmeFilename":"README.md"}