Skip to main content
Environment variables move the data directory, isolate secrets, and keep the engine’s output readable on non-English locales.
An empty value is treated as unset — PRAISONAI_DESKTOP_HOME="" no longer picks a different directory for the Rust shell than for the Python engine.

Quick Start

1

Override the data directory

Set PRAISONAI_DESKTOP_HOME to a folder before launching to keep a separate profile.
2

Isolate secrets

Set PRAISONAI_KEYCHAIN_SERVICE to keep test keys out of your real keychain entry.
3

Leave the encoding vars alone

PYTHONUTF8 and PYTHONIOENCODING are set by the shell for the engine. You do not need to set them yourself.

How the engine gets its environment

The Desktop shell rebuilds the engine’s environment from the resolved venv before spawning it — it does not hand the engine your shell untouched. Most variables pass through unchanged — provider keys (OPENAI_API_KEY, TAVILY_API_KEY), Desktop vars (PRAISONAI_DESKTOP_HOME, PRAISONAI_KEYCHAIN_SERVICE, PRAISONAI_AGENTS_SOURCE, PRAISONAI_TRAIN_CMD, PRAISONAI_MODEL), and platform vars (HOME, APPDATA, XDG_DATA_HOME). Three variables are stripped by the shell before the engine spawns: PYTHONHOME, PYTHONPATH, PYTHONSTARTUP. Setting them in your shell does nothing for the engine — they would otherwise redirect the engine’s stdlib or site-packages away from the venv the shell just resolved. Two variables are always set by the shell: VIRTUAL_ENV (points at the resolved venv root) and PATH (the venv’s bin/Scripts prepended to whatever PATH you exported).
PYTHONHOME, PYTHONPATH, and PYTHONSTARTUP set in your shell do not reach the engine. If you need the engine to import a local praisonaiagents checkout, set PRAISONAI_AGENTS_SOURCE instead.

Reference


Per-provider variables the engine writes

The app does not send your credential fields to OpenAI only. It writes them to the variables named for the selected provider — the base_url field is exported as <PROVIDER>_API_BASE, and api_key as <PROVIDER>_API_KEY. The provider is taken from the model id’s slashed prefix; a bare id is treated as OpenAI. The specific overrides encoded in PROVIDER_ENV_OVERRIDES in the engine’s server.py: The OpenAI pair is always kept in step, so switching back to a bare id after using a slashed one does not leave a stale endpoint behind.
Clearing Base URL only clears what the app itself exported (via _unset_if_ours). A shell-exported credential you had before launching the app survives — the app never unsets a variable it did not set.

Data Directory Precedence

The data directory follows one order per platform, and both the Rust shell and the Python engine derive it the same way.
An empty string counts as unset. XDG_DATA_HOME="" used to make the shell join onto an empty path and look in the working directory while the engine used the home directory — so the two disagreed on every launch.

Encoding on Non-English Locales

The shell exports PYTHONUTF8=1 and PYTHONIOENCODING=utf-8 to the engine so its output decodes cleanly on CP932 (Japanese) or CP1252 (Western European) systems. Setting these yourself is redundant — the shell already does it.

Best Practices

An empty value is unset. To fall back to the platform default, remove the variable rather than setting it to "".
Set PRAISONAI_KEYCHAIN_SERVICE to a distinct name so a test run never overwrites the key you actually use — PRAISONAI_DESKTOP_HOME isolates data, not the system keyring. The engine’s own redaction test suite makes this a hard rule: it refuses to run unless the service is set away from the default ai.praison.desktop, so a test can never touch your real keychain entry.
Export OPENAI_API_KEY and leave the settings api_key blank to keep the credential out of the app entirely.
PYTHONPATH is stripped by design before the engine spawns, so it never reaches the engine. Set PRAISONAI_AGENTS_SOURCE to your praisonaiagents checkout instead — that variable passes through unchanged.
The shell already sets PYTHONUTF8=1 and PYTHONIOENCODING=utf-8 so the engine starts on non-English locales. Overriding them reintroduces the startup-timeout bug they fix.

Data & Privacy

Where the data directory lives and what it holds

Models & API Keys

How provider keys and the keychain interact

Engine API

Read the true data_dir from /health

Troubleshooting

The non-UTF-8 startup timeout