Skip to main content
import 'praisonai' runs no process.env reads and no dotenv.config() at load time, so it works in browsers, Electron renderers, webviews (Tauri), and React Native.

Import safety

Importing praisonai no longer touches the runtime environment.
  • import 'praisonai' performs no process.env reads and no dotenv.config() at load time — safe in browsers, Electron renderers, webviews (Tauri), and React Native.
  • The old dotenv.config() side effect is gone. If you relied on it to auto-load .env in Node, call it yourself (see Migrating from auto-loaded .env).
  • The dotenv and node-fetch npm packages are no longer transitive dependencies of praisonai. Both were unused in the SDK source; dropping them improves tree-shaking and shrinks install size.
Credentials are still read for you — just later. OPENAI_API_KEY is read lazily inside the OpenAI client the moment a client is actually built, mirroring the Python SDK. Env vars set in your shell, systemd, Docker, or CI keep working with zero code changes.

Do I still need dotenv?

Only .env files need a one-line change; every other credential path is untouched.

Quick Start

1

Zero-config Node with shell env vars

No code change needed when OPENAI_API_KEY is set in your shell, .zshrc, or systemd unit.
2

Node with a .env file

Load .env yourself — praisonai no longer does it for you.
3

Browser / webview

No process, no dotenv, no throw. Pass credentials per-agent.

Migrating from auto-loaded .env

praisonai used to call dotenv.config() for you on import — now you call it once yourself. Process env vars set in the shell, systemd, Docker, or CI still work with zero code changes. Only .env files loaded via the dotenv package need this one-line addition.

Best Practices

Set OPENAI_API_KEY in your shell, systemd unit, Docker, or CI. These work at runtime with no code changes and keep secrets out of your bundle.
If you keep credentials in a project-root .env, install dotenv and call dotenv.config() (or import 'dotenv/config') at the very top of your entrypoint.
Browsers and webviews have no process or .env. Provide apiKey (and baseURL/fetch when needed) directly on each Agent using bundle-time constants like import.meta.env.VITE_OPENAI_KEY.
praisonai reads OPENAI_API_KEY only when an OpenAI client is built, and LOGLEVEL only on first log. Importing the package never throws in runtimes without process.The env-only client also rebuilds when OPENAI_API_KEY or OPENAI_BASE_URL changes between calls. A rotated key is picked up without a restart. See JS Credential Rotation for the full contract and resetOpenAIClient().

Node.js Agents

Node.js quick start and examples

TypeScript Agents

TypeScript quick start and examples