Skip to main content
praisonai ships both ESM and CommonJS builds, so it works out-of-the-box with modern bundlers and legacy Node projects alike.

Quick Start

1

Install

2

Create an agent (ESM or CommonJS)

Requires Node.js 18 or later (engines.node >= 18).

How It Works

The package.json entry points tell each runtime and bundler which build to load. import resolves to the ESM build, require resolves to the CJS build, and TypeScript reads the shared type declarations — no configuration needed on your side. The ESM build is produced by a small shim that rewrites relative specifiers, adds a createRequire banner for interop, and drops a dist/esm/package.json marked { "type": "module" }.

Using in Different Environments

Pick the entry point that matches where you run praisonai.
Deno and Bun resolve the ESM entry automatically from the import condition.

Subpath Imports

Import from a subpath to load only the module you need.

Best Practices

Use import { Agent } from 'praisonai' for new code. ESM is the default for bundlers and edge runtimes, and it preserves await import() as a lazy chunk instead of forcing a synchronous require().
The root barrel (praisonai) still pulls in the CLI and other Node-only code, so a raw import 'praisonai' in a browser or React Native bundle drags in Node built-ins. Use deep imports — for example praisonai/agent/simple — to keep browser and React Native bundles Node-safe.
Contributors can run npm run verify:dist to confirm both the CJS and ESM entry points load in a real Node process before publishing.
The package sets engines.node >= 18. The bundled openai dependency needs Node 18, so older runtimes are not supported.
The package is not marked sideEffects: false, so aggressive tree-shaking is limited today. Deep imports remain the best way to keep bundles small.

Node.js Agents

Build agents in Node.js with ESM or CommonJS

TypeScript SDK

Full TypeScript agent framework reference