From 43760649223c2901d799a71814af96a3f72c19eb Mon Sep 17 00:00:00 2001 From: TomasPalsson Date: Fri, 16 Oct 2026 11:24:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs:=20Document=20LIBRECHAT=5FC?= =?UTF-8?q?ODE=5FDEFAULT=5FPROFILE=20for=20stateful-only=20code=20deployme?= =?UTF-8?q?nts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the setting to the Code Interpreter env table and explains, in the stateful endpoint section, that `stateful` makes saved Agents, normal chats with the Code toggle on, subagents and profile-less downloads run on the stateful profile without a per-Agent toggle. --- content/docs/configuration/dotenv.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/content/docs/configuration/dotenv.mdx b/content/docs/configuration/dotenv.mdx index 12637a783..cbd8dc304 100644 --- a/content/docs/configuration/dotenv.mdx +++ b/content/docs/configuration/dotenv.mdx @@ -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', @@ -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.