Install the package
Choose the package manager your application already uses:JavaScript projects
Save scripts as.mjs, as in the quickstart, or set "type": "module" in your application’s package.json to use ESM in .js files.
--env-file when your provider key is in .env. If you already exported the key in the same shell, node agent.mjs is sufficient.
TypeScript projects
For a Node.js project, install a TypeScript runner and enable ESM:agent.ts, then run:
zod also need it in your application:
Supported local runtimes
The x64 packages use the baseline runtime build. Install dependencies on the target platform instead of copying
node_modules from a different operating system or architecture. See troubleshooting if your package manager omitted the runtime package.
For an environment where you run the server separately, use remote connections.
Upgrade an application
Upgrade the main package and commit the updated lockfile:Custom runtime binaries
Most applications should use the bundled runtime. For a custom runtime build, pass an absolute executable path withspawn.binaryPath or set COGNITIO_BIN_PATH. Explicit overrides bypass the automatic bundled-version check, so the custom runtime must implement the SDK’s protocol.
spawn options give this Agent its own runtime, which close() releases. See lifecycle and cleanup for shared and borrowed clients.