{"_id":"@aetechlabs/agent-core","_rev":"5-2c975cbd480aa18da5fb2da36954f4ed","name":"@aetechlabs/agent-core","dist-tags":{"latest":"3.2.4"},"versions":{"3.2.0":{"name":"@aetechlabs/agent-core","version":"3.2.0","author":{"name":"AETech Labs","email":"engineering@aetechlabs.com"},"license":"SEE LICENSE IN LICENSE","_id":"@aetechlabs/agent-core@3.2.0","maintainers":[{"name":"aetech","email":"contact@aetechlabs.com"}],"homepage":"https://github.com/aetechlabs/agent-core#readme","bugs":{"url":"https://github.com/aetechlabs/agent-core/issues"},"bin":{"agent-core-playground":"dist/cli/playground.js"},"dist":{"shasum":"e948eb002620b3db68401dfbacd002080e1304bb","tarball":"https://registry.npmjs.org/@aetechlabs/agent-core/-/agent-core-3.2.0.tgz","fileCount":9,"integrity":"sha512-OzK2At8G9qOIL3JVsjtCCjTG42jXqmjETbAOz8MUqqByZ+LEc4XYTerg5tTmepKxAvRSCgXt7ZUWQRPImcSo5Q==","signatures":[{"sig":"MEUCIBg6CqzSqhYK62koTJf3i/jswbgxWR4fea5Aag/5msv/AiEAy7Rnvoh3e+oACeWifiUqmT1Qn9R0jgflnBupBYVxQ0Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108184},"main":"dist/loader.cjs","types":"dist/index.d.ts","module":"dist/loader.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/loader.mjs","require":"./dist/loader.cjs"}},"gitHead":"d46236aad3a08c51db6236d50fe1a064d70cb8f2","scripts":{"build":"tsx scripts/build.ts","build:types":"tsc -p tsconfig.build.json --emitDeclarationOnly","prepublishOnly":"npm run build","generate:keypair":"tsx scripts/generate-keypair.ts","generate:license":"tsx scripts/generate-license.ts"},"_npmUser":{"name":"aetech","email":"contact@aetechlabs.com"},"repository":{"url":"git+https://github.com/aetechlabs/agent-core.git","type":"git"},"_npmVersion":"10.8.2","description":"AETech Labs AI Agent Core — encrypted, license-protected agent orchestration engine","directories":{},"_nodeVersion":"20.20.2","dependencies":{"jose":"^6.0.11"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","zod":"^4.4.3","esbuild":"^0.25.0","langchain":"^1.5.2","typescript":"^5.9.0","@types/node":"^22.0.0","@langchain/aws":"^1.4.2","@langchain/core":"^1.2.1","@langchain/ollama":"^1.3.0","@langchain/openai":"^1.5.3","javascript-obfuscator":"^4.1.1"},"peerDependencies":{"pg":">=8.0.0","zod":">=3.20.0","ioredis":">=5.0.0","langchain":">=0.3.0","@langchain/aws":">=0.1.0","better-sqlite3":">=9.0.0","@langchain/core":">=0.3.0","@langchain/ollama":">=0.1.0","@langchain/openai":">=0.3.0","@opentelemetry/api":">=1.0.0"},"peerDependenciesMeta":{"pg":{"optional":true},"ioredis":{"optional":true},"better-sqlite3":{"optional":true},"@langchain/ollama":{"optional":true},"@langchain/openai":{"optional":true},"@opentelemetry/api":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/agent-core_3.2.0_1787430802719_0.750636533830563","host":"s3://npm-registry-packages-npm-production"}},"3.2.1":{"name":"@aetechlabs/agent-core","version":"3.2.1","author":{"name":"AETech Labs","email":"engineering@aetechlabs.com"},"license":"SEE LICENSE IN LICENSE","_id":"@aetechlabs/agent-core@3.2.1","maintainers":[{"name":"aetech","email":"contact@aetechlabs.com"}],"homepage":"https://github.com/aetechlabs/agent-core#readme","bugs":{"url":"https://github.com/aetechlabs/agent-core/issues"},"bin":{"agent-core-playground":"dist/cli/playground.js"},"dist":{"shasum":"f87ddd851701ad1a585664ce7ea1d6f08277e213","tarball":"https://registry.npmjs.org/@aetechlabs/agent-core/-/agent-core-3.2.1.tgz","fileCount":9,"integrity":"sha512-yP5XZJn9aXPE5FhkExOQxy+WiHM7ru9T5HNzfZ78BF+p1XhKRAhnfD4An8ZFlWqqeccRVSNzCcmc/3XEP6HrbA==","signatures":[{"sig":"MEUCIQCXYmf4q+eoRebXu76716xPCigKqHI7KHhlJ2DifFekoQIgFAHP9kQudtkST0Gk4dzJGfvznXbbqdITGKG0rVfW/TI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109007},"main":"dist/loader.cjs","types":"dist/index.d.ts","module":"dist/loader.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/loader.mjs","require":"./dist/loader.cjs"}},"gitHead":"3bdde758793fd82d184302018f0e1b0e1a394dc4","scripts":{"build":"tsx scripts/build.ts","build:types":"tsc -p tsconfig.build.json --emitDeclarationOnly","prepublishOnly":"npm run build","generate:keypair":"tsx scripts/generate-keypair.ts","generate:license":"tsx scripts/generate-license.ts"},"_npmUser":{"name":"aetech","email":"contact@aetechlabs.com"},"repository":{"url":"git+https://github.com/aetechlabs/agent-core.git","type":"git"},"_npmVersion":"10.8.2","description":"AETech Labs AI Agent Core — encrypted, license-protected agent orchestration engine","directories":{},"_nodeVersion":"20.20.2","dependencies":{"jose":"^6.0.11"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","zod":"^4.4.3","esbuild":"^0.25.0","langchain":"^1.5.2","typescript":"^5.9.0","@types/node":"^22.0.0","@langchain/aws":"^1.4.2","@langchain/core":"^1.2.1","@langchain/ollama":"^1.3.0","@langchain/openai":"^1.5.3","javascript-obfuscator":"^4.1.1"},"peerDependencies":{"pg":">=8.0.0","zod":">=3.20.0","ioredis":">=5.0.0","langchain":">=0.3.0","@langchain/aws":">=0.1.0","better-sqlite3":">=9.0.0","@langchain/core":">=0.3.0","@langchain/ollama":">=0.1.0","@langchain/openai":">=0.3.0","@opentelemetry/api":">=1.0.0"},"peerDependenciesMeta":{"pg":{"optional":true},"ioredis":{"optional":true},"better-sqlite3":{"optional":true},"@langchain/ollama":{"optional":true},"@langchain/openai":{"optional":true},"@opentelemetry/api":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/agent-core_3.2.1_1787431412993_0.013713162444447535","host":"s3://npm-registry-packages-npm-production"}},"3.2.2":{"name":"@aetechlabs/agent-core","version":"3.2.2","author":{"name":"AETech Labs","email":"engineering@aetechlabs.com"},"license":"SEE LICENSE IN LICENSE","_id":"@aetechlabs/agent-core@3.2.2","maintainers":[{"name":"aetech","email":"contact@aetechlabs.com"}],"homepage":"https://github.com/aetechlabs/agent-core#readme","bugs":{"url":"https://github.com/aetechlabs/agent-core/issues"},"bin":{"agent-core-playground":"dist/cli/playground.js"},"dist":{"shasum":"2a4e45d60a5ef8aabbea0cb982bb3fb977f10727","tarball":"https://registry.npmjs.org/@aetechlabs/agent-core/-/agent-core-3.2.2.tgz","fileCount":9,"integrity":"sha512-TttczthIijFN0GuQoXK4ULt/S40u5gN5HDHFRtxbOHWYhmhXIIsBfZXomarJrOjgWrwCUhxld3N0PMKEHfiVTQ==","signatures":[{"sig":"MEQCICmOq0fNSlGSzx3M8fuz1ExHVKgGWKqsZDT8/afphp1iAiAwBASsM4nITOQwpWPM2LtLJtRk2fq8gGin2fDJ8Aqbsg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102203},"main":"dist/loader.cjs","types":"dist/index.d.ts","module":"dist/loader.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/loader.mjs","require":"./dist/loader.cjs"}},"gitHead":"704b5c9398e624d5793131b472a919b8f13d9e79","scripts":{"build":"tsx scripts/build.ts","build:types":"tsc -p tsconfig.build.json --emitDeclarationOnly","prepublishOnly":"npm run build","generate:keypair":"tsx scripts/generate-keypair.ts","generate:license":"tsx scripts/generate-license.ts"},"_npmUser":{"name":"aetech","email":"contact@aetechlabs.com"},"repository":{"url":"git+https://github.com/aetechlabs/agent-core.git","type":"git"},"_npmVersion":"10.8.2","description":"AETech Labs AI Agent Core — encrypted, license-protected agent orchestration engine","directories":{},"_nodeVersion":"20.20.2","dependencies":{"jose":"^6.0.11"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","zod":"^4.4.3","esbuild":"^0.25.0","langchain":"^1.5.2","typescript":"^5.9.0","@types/node":"^22.0.0","@langchain/aws":"^1.4.2","@langchain/core":"^1.2.1","@langchain/ollama":"^1.3.0","@langchain/openai":"^1.5.3","javascript-obfuscator":"^4.1.1"},"peerDependencies":{"pg":">=8.0.0","zod":">=3.20.0","ioredis":">=5.0.0","langchain":">=0.3.0","@langchain/aws":">=0.1.0","better-sqlite3":">=9.0.0","@langchain/core":">=0.3.0","@langchain/ollama":">=0.1.0","@langchain/openai":">=0.3.0","@opentelemetry/api":">=1.0.0"},"peerDependenciesMeta":{"pg":{"optional":true},"ioredis":{"optional":true},"better-sqlite3":{"optional":true},"@langchain/ollama":{"optional":true},"@langchain/openai":{"optional":true},"@opentelemetry/api":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/agent-core_3.2.2_1787470625067_0.245037513844935","host":"s3://npm-registry-packages-npm-production"}},"3.2.3":{"name":"@aetechlabs/agent-core","version":"3.2.3","author":{"name":"AETech Labs","email":"engineering@aetechlabs.com"},"license":"SEE LICENSE IN LICENSE","_id":"@aetechlabs/agent-core@3.2.3","maintainers":[{"name":"aetech","email":"contact@aetechlabs.com"}],"homepage":"https://github.com/aetechlabs/agent-core#readme","bugs":{"url":"https://github.com/aetechlabs/agent-core/issues"},"bin":{"agent-core-playground":"dist/cli/playground.js"},"dist":{"shasum":"a0b30db4d2e33584bd16c29b5a0c7896b10ec117","tarball":"https://registry.npmjs.org/@aetechlabs/agent-core/-/agent-core-3.2.3.tgz","fileCount":9,"integrity":"sha512-WlZRqGQN0EwYyA68seIN/u8sL6obgLQzTpM5zSJFyQejch2WRdItcam2cHSYzbbsR45d09pEvkmQGEuDfbGI8A==","signatures":[{"sig":"MEYCIQCXMwov7yXiJi5wVb2OxP1UcWA/AJ1UX+wkbmBSTcRfhAIhAMBOxGr5wnUtYLLhSqok7bbKMmh/iVr44WLg0AcRqZ9B","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":414105},"main":"dist/loader.cjs","types":"dist/index.d.ts","module":"dist/loader.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/loader.mjs","require":"./dist/loader.cjs"}},"gitHead":"181127dc49e8c5a2448e363ba6e3d918e38b9e6c","scripts":{"build":"tsx scripts/build.ts","build:types":"tsc -p tsconfig.build.json --emitDeclarationOnly","prepublishOnly":"npm run build","generate:keypair":"tsx scripts/generate-keypair.ts","generate:license":"tsx scripts/generate-license.ts"},"_npmUser":{"name":"aetech","email":"contact@aetechlabs.com"},"repository":{"url":"git+https://github.com/aetechlabs/agent-core.git","type":"git"},"_npmVersion":"10.8.2","description":"AETech Labs AI Agent Core — encrypted, license-protected agent orchestration engine","directories":{},"_nodeVersion":"20.20.2","dependencies":{"jose":"^6.0.11"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.23.0","tsx":"^4.19.0","zod":"^4.4.3","esbuild":"^0.25.0","ioredis":"^6.0.0","@types/pg":"^8.23.1","langchain":"^1.5.2","typescript":"^5.9.0","@types/node":"^22.0.0","@langchain/aws":"^1.4.2","better-sqlite3":"^13.0.3","@langchain/core":"^1.2.1","@langchain/ollama":"^1.3.0","@langchain/openai":"^1.5.3","@opentelemetry/api":"^1.9.1","javascript-obfuscator":"^4.1.1"},"peerDependencies":{"pg":">=8.0.0","zod":">=3.20.0","ioredis":">=5.0.0","langchain":">=0.3.0","@langchain/aws":">=0.1.0","better-sqlite3":">=9.0.0","@langchain/core":">=0.3.0","@langchain/ollama":">=0.1.0","@langchain/openai":">=0.3.0","@opentelemetry/api":">=1.0.0"},"peerDependenciesMeta":{"pg":{"optional":true},"ioredis":{"optional":true},"better-sqlite3":{"optional":true},"@langchain/ollama":{"optional":true},"@langchain/openai":{"optional":true},"@opentelemetry/api":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/agent-core_3.2.3_1787474876437_0.679014877999417","host":"s3://npm-registry-packages-npm-production"}},"3.2.4":{"name":"@aetechlabs/agent-core","version":"3.2.4","description":"AETech Labs AI Agent Core — encrypted, license-protected agent orchestration engine","bin":{"agent-core-playground":"dist/cli/playground.js"},"main":"dist/loader.cjs","module":"dist/loader.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/loader.mjs","require":"./dist/loader.cjs"}},"scripts":{"build":"tsx scripts/build.ts","build:types":"tsc -p tsconfig.build.json --emitDeclarationOnly","generate:keypair":"tsx scripts/generate-keypair.ts","generate:license":"tsx scripts/generate-license.ts","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/aetechlabs/agent-core.git"},"author":{"name":"AETech Labs","email":"engineering@aetechlabs.com"},"license":"SEE LICENSE IN LICENSE","dependencies":{"jose":"^6.0.11"},"peerDependencies":{"@langchain/aws":">=0.1.0","@langchain/core":">=0.3.0","@langchain/ollama":">=0.1.0","@langchain/openai":">=0.3.0","@opentelemetry/api":">=1.0.0","better-sqlite3":">=9.0.0","ioredis":">=5.0.0","langchain":">=0.3.0","pg":">=8.0.0","zod":">=3.20.0"},"peerDependenciesMeta":{"@langchain/openai":{"optional":true},"@langchain/ollama":{"optional":true},"ioredis":{"optional":true},"pg":{"optional":true},"better-sqlite3":{"optional":true},"@opentelemetry/api":{"optional":true}},"devDependencies":{"@langchain/aws":"^1.4.2","@langchain/core":"^1.2.1","@langchain/ollama":"^1.3.0","@langchain/openai":"^1.5.3","@opentelemetry/api":"^1.9.1","@types/node":"^22.0.0","@types/pg":"^8.23.1","better-sqlite3":"^13.0.3","esbuild":"^0.25.0","ioredis":"^6.0.0","javascript-obfuscator":"^4.1.1","langchain":"^1.5.2","pg":"^8.23.0","tsx":"^4.19.0","typescript":"^5.9.0","zod":"^4.4.3"},"_id":"@aetechlabs/agent-core@3.2.4","gitHead":"1bb8a6b729396e9bb62f6731a2c1c2c00cf2eabc","bugs":{"url":"https://github.com/aetechlabs/agent-core/issues"},"homepage":"https://github.com/aetechlabs/agent-core#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-FIlBCR9VNkHOpg0CF2Sg8UM1GS8SljY6uHp8Oo59BDI6rt6VyU2zKs45iZwpe2Gq5Stuw+tGKETziwPBkfg8hQ==","shasum":"c7c14925e3de3057829171c1937850158a762f44","tarball":"https://registry.npmjs.org/@aetechlabs/agent-core/-/agent-core-3.2.4.tgz","fileCount":9,"unpackedSize":414380,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCoRaNP12i9mab3aKCSyN8ZoXXmNCtad+FSPB1JP7v9uAIhAOSG4aDNn9wqvfCjY12XC7B8Y8rt2Qc9tF0MGzUrcxai"}]},"_npmUser":{"name":"aetech","email":"contact@aetechlabs.com"},"directories":{},"maintainers":[{"name":"aetech","email":"contact@aetechlabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent-core_3.2.4_1787475447700_0.43032547324195836"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-22T20:33:22.583Z","modified":"2026-08-23T08:57:28.113Z","3.2.0":"2026-08-22T20:33:22.894Z","3.2.1":"2026-08-22T20:43:33.131Z","3.2.2":"2026-08-23T07:37:05.257Z","3.2.3":"2026-08-23T08:47:56.608Z","3.2.4":"2026-08-23T08:57:27.853Z"},"bugs":{"url":"https://github.com/aetechlabs/agent-core/issues"},"author":{"name":"AETech Labs","email":"engineering@aetechlabs.com"},"license":"SEE LICENSE IN LICENSE","homepage":"https://github.com/aetechlabs/agent-core#readme","repository":{"type":"git","url":"git+https://github.com/aetechlabs/agent-core.git"},"description":"AETech Labs AI Agent Core — encrypted, license-protected agent orchestration engine","maintainers":[{"name":"aetech","email":"contact@aetechlabs.com"}],"readme":"<div align=\"center\">\n  <h1>🤖 @aetechlabs/agent-core</h1>\n  <p><b>The Encrypted, License-Protected AI Agent Orchestration Engine</b></p>\n</div>\n\nWelcome to **AETech Labs Agent Core** — a turnkey, highly secure AI agent framework designed for enterprise distribution. \n\nUnlike traditional NPM packages, our core orchestration logic is shipped as an **AES-256-GCM encrypted payload**. It decrypts directly into memory at runtime using a cryptographically verified license key, completely protecting the proprietary business logic from reverse engineering.\n\n---\n\n## 🌟 Why Agent Core?\n\n- 🔒 **Zero-Trust Distribution**: The engine code is never exposed on disk. Perfect for distributing proprietary AI capabilities to B2B clients.\n- 🧠 **Multi-Model Mastery**: Swap seamlessly between AWS Bedrock, OpenAI, Azure OpenAI, and local Ollama models with a single config line.\n- 🎭 **Dynamic Personas**: Fully customize the agent's identity, capabilities, and domain knowledge dynamically per-client.\n- ⚡ **Production Ready**: Built-in support for token quotas, Koa-style middleware pipelines, streaming, and persistent memory (Redis/PostgreSQL/SQLite).\n\n## 🏗️ Architecture\n\n![Architecture Flowchart](https://mermaid.ink/img/eyJjb2RlIjoiZmxvd2NoYXJ0IFREXG4gICAgQ2xpZW50W1wiQ2xpZW50IEFwcFxcbmUuZy4gYWNtZS1jb3JwLWFnZW50XCJdIC0tPnxJbnN0YWxsc3wgQ29yZVtcIkBhZXRlY2hsYWJzL2FnZW50LWNvcmVcIl1cbiAgICBcbiAgICBzdWJncmFwaCBBZ2VudCBDb3JlIEVudmlyb25tZW50XG4gICAgICAgIENvcmUgLS0+IERlY3J5cHRvcltcIkFFUy0yNTYtR0NNIERlY3J5cHRvclwiXVxuICAgICAgICBEZWNyeXB0b3IgLS0+fERlY3J5cHRzIGF0IFJ1bnRpbWV8IEVuZ2luZVtcIkxhbmdHcmFwaCBFbmdpbmVcIl1cbiAgICAgICAgXG4gICAgICAgIEVuZ2luZSAtLT4gSWRlbnRpdHlbXCJEeW5hbWljIEFnZW50IElkZW50aXR5XCJdXG4gICAgICAgIEVuZ2luZSAtLT4gU2VjdXJpdHlbXCJMaWNlbnNlIFZhbGlkYXRvclwiXVxuICAgICAgICBFbmdpbmUgLS0+IFByb3ZpZGVyc1tcIk11bHRpLU1vZGVsIFByb3ZpZGVyc1xcbihCZWRyb2NrLCBPcGVuQUksIEF6dXJlLCBPbGxhbWEpXCJdXG4gICAgICAgIEVuZ2luZSAtLT4gUXVvdGFbXCJUb2tlbiBRdW90YSBUcmFja2VyXCJdXG4gICAgICAgIFxuICAgICAgICBTZWN1cml0eSAtLT58Q2hlY2tzIEV4cGlyeS9SZXZvY2F0aW9ufCBLZXlzW1wiRWQyNTUxOSBQdWJsaWMgS2V5XCJdXG4gICAgZW5kXG4gICAgXG4gICAgUHJvdmlkZXJzIDwtLT58QVBJIENhbGxzfCBMTE1bXCJMTE0gUHJvdmlkZXJcXG4oQ2xhdWRlLCBHUFQtNCwgTGxhbWEsIGV0Yy4pXCJdXG4gICAgXG4gICAgQ2xpZW50IC0tPnxQcm92aWRlc3wgVG9vbHNbXCJDdXN0b20gVG9vbHNcIl1cbiAgICBDbGllbnQgLS0+fFByb3ZpZGVzfCBFbnZbXCJBRVRFQ0hMQUJTX0xJQ0VOU0VfS0VZXCJdXG4gICAgXG4gICAgVG9vbHMgLS0+IEVuZ2luZVxuICAgIEVudiAtLT4gU2VjdXJpdHkiLCJtZXJtYWlkIjoie1widGhlbWVcIjpcImRlZmF1bHRcIn0ifQ==)\n\n![Decryption & Execution Flow](https://mermaid.ink/img/eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggQ2xpZW50QXBwW1wiQ2xpZW50IEFnZW50IChtYWluIHNlcnZlcilcIl1cbiAgICAgICAgSW5kZXhbXCJpbmRleC50c1wiXVxuICAgICAgICBFbnZbXCIuZW52XFxuKEFFVEVDSExBQlNfTElDRU5TRV9LRVk9eHh4KVwiXVxuICAgIGVuZFxuXG4gICAgc3ViZ3JhcGggQWdlbnRDb3JlW1wiQGFldGVjaGxhYnMvYWdlbnQtY29yZSAoZW5jcnlwdGVkIHBhY2thZ2UpXCJdXG4gICAgICAgIEJ1bmRsZVtcImVuY3J5cHRlZC1idW5kbGUuZW5jXFxuKEFFUy0yNTYpXCJdXG4gICAgICAgIExvYWRlcltcImxvYWRlci5qc1xcbihkZWNyeXB0cyBhdCBydW50aW1lKVwiXVxuICAgICAgICBUeXBlc1tcImluZGV4LmQudHNcXG4oVHlwZVNjcmlwdCB0eXBlcylcIl1cbiAgICAgICAgXG4gICAgICAgIEJ1bmRsZSAtLT4gTG9hZGVyXG4gICAgZW5kXG5cbiAgICBJbk1lbW9yeVtcIkluLW1lbW9yeSBKUyBtb2R1bGVcXG4obmV2ZXIgd3JpdHRlbiB0byBkaXNrKVwiXVxuXG4gICAgSW5kZXggLS0+fFwiaW1wb3J0IHsgY3JlYXRlQWdlbnQgfSBmcm9tICdAYWV0ZWNobGFicy9hZ2VudC1jb3JlJ1wifCBMb2FkZXJcbiAgICBFbnYgLS0+fFwibGljZW5zZSBrZXlcInwgTG9hZGVyXG4gICAgTG9hZGVyIC0tPnxcImRlY3J5cHRzICYgZXZhbHVhdGVzXCJ8IEluTWVtb3J5IiwibWVybWFpZCI6IntcInRoZW1lXCI6XCJkZWZhdWx0XCJ9In0=)\n\n---\n\n## 📦 Installation\n\nInstall the package via NPM:\n\n```bash\nnpm install @aetechlabs/agent-core\n```\n\nYou will also need to install the provider bindings for the LLM you plan to use:\n```bash\nnpm install @langchain/openai   # If using OpenAI or Azure\nnpm install @langchain/aws      # If using AWS Bedrock\nnpm install @langchain/ollama   # If using Local LLMs\n```\n\n## 🔐 Prerequisites (Important Security Note)\n\nTo initialize the agent, you must possess an `AETECHLABS_LICENSE_KEY` (a JWT provided by AETech Labs).\n\n> ⚠️ **SECURITY WARNING:** The Agent Core decrypts proprietary code into memory. **It must ONLY be executed in a secure Node.js backend environment.** \n> Never bundle this package into a frontend application (like React/Vite/Next.js client components) and never expose your License Key to the browser.\n\n---\n\n## 💻 Fullstack Quick Start Guide\n\nThe standard architecture involves building a frontend UI (e.g., React/Vite) that communicates with your Node.js backend, where the Agent Core actually runs.\n\n### 1. The Backend (Node.js / Express / Netlify Functions)\n\nSet your environment variables on your server:\n```bash\nexport AETECHLABS_LICENSE_KEY=\"eyJhbG...\"\nexport OPENAI_API_KEY=\"sk-...\"\n```\n\nCreate your agent API endpoint:\n```typescript\nimport { createAgent, runAgent } from '@aetechlabs/agent-core';\n\n// 1. Define the Agent's Persona and Provider\nconst config = {\n  identity: {\n    agentName: 'AETech Projects Assistant',\n    agentDescription: 'Helps users manage and analyze their projects.',\n    capabilities: ['Project Management', 'Data Analysis'],\n  },\n  model: {\n    provider: 'openai',\n    modelId: 'gpt-4o',\n    apiKey: process.env.OPENAI_API_KEY, \n  },\n  licenseKey: process.env.AETECHLABS_LICENSE_KEY,\n};\n\n// 2. Initialize (Decrypts the engine dynamically)\n// You can pass custom LangChain tools into the first argument array!\nconst agent = await createAgent([], config);\n\n// 3. Execute!\nexport async function chatEndpoint(req, res) {\n  try {\n    const result = await runAgent(agent, req.body.message);\n    res.json({ success: true, message: result.output });\n  } catch (error) {\n    res.status(500).json({ error: error.message });\n  }\n}\n```\n\n### 2. The Frontend (React/Vite)\n\nYour frontend simply calls your secure backend endpoint:\n\n```tsx\nconst sendMessage = async (userInput) => {\n  const response = await fetch('/api/chat', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ message: userInput })\n  });\n  const data = await response.json();\n  console.log(\"Agent Says:\", data.message);\n};\n```\n\n---\n\n## 🛠️ Advanced Features\n\nUnlock the full potential of the Agent Core with these built-in enterprise features.\n\n### Switching LLM Providers\nSwitching models is effortless. Just modify the `model` object in your configuration:\n\n**Azure OpenAI:**\n```typescript\nmodel: {\n  provider: 'azure-openai',\n  modelId: 'my-gpt4-deployment',\n  azureEndpoint: 'https://my-instance.openai.azure.com',\n  apiKey: process.env.AZURE_OPENAI_API_KEY,\n  apiVersion: '2024-08-01-preview',\n}\n```\n\n**Local LLM (Ollama):**\n```typescript\nmodel: {\n  provider: 'ollama',\n  modelId: 'llama3',\n  baseUrl: 'http://localhost:11434',\n}\n```\n\n### Streaming Responses (Real-time UI)\nFor a snappy user experience, you can stream tokens back to your frontend via WebSockets or Server-Sent Events (SSE).\n\n```typescript\nimport { createAgent, streamAgent } from '@aetechlabs/agent-core';\n\nconst agent = await createAgent(tools, config);\n\nfor await (const chunk of streamAgent(agent, 'Analyze my data')) {\n  if (chunk.type === 'token') {\n    process.stdout.write(chunk.content); // Send to frontend\n  } else if (chunk.type === 'tool_start') {\n    console.log(`🔧 Calling Tool: ${chunk.toolName}`);\n  }\n}\n```\n\n### Token Quotas & Cost Control\nPrevent runaway LLM costs by enforcing strict token usage limits per session.\n\n```typescript\nconst agent = await createAgent(tools, {\n  ...config,\n  quota: {\n    maxTokens: 100_000,         // Halt execution after 100k tokens\n    resetIntervalMs: 3600_000,  // Reset quota every hour\n  },\n});\n```\n\n### Middleware Pipeline\nProcess requests before and after they reach the agent using the Koa-style middleware pipeline.\n\n```typescript\nimport { \n  timingMiddleware, \n  inputSanitizerMiddleware, \n  rateLimiterMiddleware \n} from '@aetechlabs/agent-core';\n\nconst agent = await createAgent(tools, {\n  ...config,\n  middleware: {\n    middleware: [\n      timingMiddleware(),\n      inputSanitizerMiddleware({ maxLength: 5000 }), // Prevent massive context injection\n      rateLimiterMiddleware({ maxRequests: 20, windowMs: 60000 }),\n    ]\n  },\n});\n```\n\n---\n\n## ⚠️ Troubleshooting & Errors\n\nEvery error thrown by Agent Core includes a machine-readable `code` and an actionable `hint`.\n\n| Error Code | Explanation | How to Fix |\n|------------|-------------|------------|\n| `AGENT_CORE_1001` | Missing License | Pass `licenseKey` in config. |\n| `AGENT_CORE_1002` | License Expired | Request a new license JWT from AETech. |\n| `AGENT_CORE_1003` | Invalid Signature| The license was tampered with or signed incorrectly. |\n| `AGENT_CORE_1004` | License Revoked | The license was revoked by the administrator. |\n| `AGENT_CORE_2001` | Missing Provider | Run `npm install @langchain/openai` (or equivalent). |\n| `AGENT_CORE_5001` | Quota Exceeded | User hit their token limit. Alert the frontend. |\n\n---\n**Proprietary — © AETech Labs. All rights reserved.**  \n*Unauthorised distribution, decompilation, or reverse engineering is strictly prohibited.*\n","readmeFilename":"README.md"}