Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions content/docs/configuration/dotenv.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,12 @@ The Code Interpreter API provides a secure environment for executing code and ma
'Default Code Interpreter base URL for highly experimental stateful Agent sessions when no named statefulCodeSessions environment is selected. The service must advertise the stateful profile.',
'# LIBRECHAT_CODE_BASEURL_STATEFUL=https://your-stateful-code-domain.com',
],
[
'LIBRECHAT_CODE_DEFAULT_PROFILE',
'string',
'Code execution profile for chat users: default or stateful. Set to stateful to run every Agent with code execution, including normal chats with the Code toggle on, on the stateful profile, overriding an Agent\'s saved stateful sessions setting. Requires the stateful_code_sessions capability; without it, code and its downloads stay on the default profile. Agents whose code machine is an attached environment, or names one that is not configured, keep their saved setting, as do Agents whose stateful scope is not in statefulCodeSessions.allowedEnvironments (normal chats use the user scope). Unrecognized values are ignored with a warning. Default: default.',
'# LIBRECHAT_CODE_DEFAULT_PROFILE=default',
],
[
'CODE_SANDBOX_PREWARM',
'boolean',
Expand Down Expand Up @@ -1576,6 +1582,8 @@ For a multi-tenant deployment, enable `TENANT_ISOLATION_STRICT=true` in LibreCha

[`stateful_code_sessions`](/docs/configuration/librechat_yaml/object_structure/agents#capabilities) is highly experimental and requires a separate Code Interpreter route. Configure the default route with `LIBRECHAT_CODE_BASEURL_STATEFUL`, or define named managed or attached backends under [`endpoints.agents.statefulCodeSessions.environments`](/docs/configuration/librechat_yaml/object_structure/agents#statefulcodesessions). The selected service must run the `stateful` profile; LibreChat sends `X-CodeAPI-Expected-Profile: stateful` with stateful requests.

On a deployment whose Code Interpreter runs only the `stateful` profile, set `LIBRECHAT_CODE_DEFAULT_PROFILE=stateful`. Saved Agents, normal chats with the Code toggle on, and subagents then all run stateful without anyone switching on stateful sessions per Agent; an Agent's saved setting no longer opts it out, and a code-output download with no named profile uses the stateful route. Agents that run on an attached environment, or whose stateful scope is not in `allowedEnvironments`, keep their saved setting, and with the `stateful_code_sessions` capability off the setting has no effect.

Stateful requests never fall back to `LIBRECHAT_CODE_BASEURL`. If the selected named environment is unavailable, or neither a named default nor `LIBRECHAT_CODE_BASEURL_STATEFUL` is configured, LibreChat stops the Agent run with a configuration error. Stateless agents continue using `LIBRECHAT_CODE_BASEURL`, and the two execution profiles do not share a live workspace.

Each Agent can scope its stateful workspace to the signed-in user, the user and Agent together, or the user and conversation. See [Stateful Code Sessions](/docs/features/code_interpreter#stateful-code-sessions) for setup and persistence limitations.
Expand Down