SDK and Automation
These variables help a program that runs Claude Code as a child process. They say which surface started it, how session events reach the host, and which binary the Agent SDK looks for. Most people never set them. Hosts such as the Agent SDK set them for you.
This page lists 25 variables. These are for a host program that starts Claude Code. Set them in the child process environment. Project env cannot set most of them before trust.
Example
CLAUDE_CODE_ENTRYPOINT=sdk-cli claude -p "List the files" --output-format stream-json
CLAUDE_CODE_ENTRYPOINT tells Claude Code which host started it. The host sets it before the process starts.
Variables
The table is sorted by name. See Environment Variables for what each column and badge means.
| Variable | Status | What it does | Values and default | Notes |
|---|---|---|---|---|
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled Anthropic SDK Environment reads it as the default environment ID when a work item call passes none. | Text. The call fails with an error if no ID comes from any source | Bundled SDK work polling. Not set from project env before trust |
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled Anthropic SDK Environment reads it as the fallback environment key. A work item needs it when its secret has no sessions_. | Text | Bundled SDK work polling. Not set from project env before trust |
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled Anthropic SDK Environment reads it as the default session ID for a work item. | Text. The call fails with an error if no ID comes from any source | Bundled SDK work polling. Not set from project env before trust |
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled SDK client reads it as the default webhook signing key. It is null when unset. | Text. SDK constructor default | Bundled SDK client. Not set from project env before trust |
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled Anthropic SDK Environment reads it as the default work item ID. | Text. The call fails with an error if no ID comes from any source | Bundled SDK work polling. Not set from project env before trust |
ANTHROPIC_ | Undocumented: Only the program shows this item. It can change without notice. | The bundled Anthropic SDK Environment reads it as the default work secret. | Text | Bundled SDK work polling. Not set from project env before trust |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | In the IDE config probe, skips the aws and gcp commands and the credential helper prefetch. | On or off, off by default. Also in a list of host-controlled names | IDE config probe, Bedrock and Vertex auth refresh |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Lets a relayed human message carry an artifact_ ack with an https URL of at most 2048 chars. | On or off, off by default | Relay and remote sessions only |
CLAUDE_ | Documented: An official docs page names this item. | Adds session_ system messages to the output stream. | On or off, off by default. Code emits a normal event when set, else a host-only event when CLAUDE_ is set | SDK and -- stream-json |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Makes Claude Code send hook_ and hook_ system messages for User hooks. Added in 2.. | On or off, off by default. Claude Code reads it once and removes it from its environment | SDK and print mode |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Names the surface that started Claude Code, such as cli, sdk-, claude-, or remote. Many code paths branch on it. | Text. Claude Code sets it at startup when it is empty (mcp for mcp serve, sdk- for SDK CLI). The TS SDK sets it to sdk- | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the name that requests go out under in the cc_ part of the billing header. Added in 2.. The program reads it only when CLAUDE_ is claude-, and ignores it (with a debug message) when requests already go out under an entrypoint name. The name must be 1 to 32 characters of a-, 0-, _, and -, start with a letter, not start with sdk, and not be reserved (an entrypoint name, anything starting with remote, or local_). The program unsets the variable after reading it. | Text. Source: the program strings only, not run | Claude Desktop third-party only |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. A feature flag or server gate decides by default. This variable overrides it | Overrides a feature flag experiment, which applies a secondary reminder to model requests. | Text. Logs secondary_ when applied | API requests |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. A feature flag or server gate decides by default. This variable overrides it | Forces the echo behavior on or off ahead of the flag. In a probe, it adds wire_ (raw tool_) to the assistant event when a tool runs. See Probes. | On, off, or unset. Unset falls back to echo and then to a feature flag | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the Bun JIT policy 10 seconds after start. Without it, Claude Code sets the policy to 1. | On or off. Whole number 1 to 100, digits only. A truthy value loads a module that applies the value | All sessions, Bun build |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. A feature flag or server gate decides by default. This variable overrides it | Overrides the larch_ experiment value for the model. In a probe, it adds a "Corrections" section to the system prompt (avoid excessive self-correction). See Probes. | On or off. Passed to the same per-model helper as CLAUDE_. A false value counts as unset | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Lets streamed text deltas go straight to output in a headless run when nothing else needs them. The debug log counts them for each turn. Added in 2.. | On or off, off by default | SDK and print mode |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Lets a host send poll events to the session as <event> envelopes. The code rejects them when the host did not set it. | On or off. Poll events also need permission mode auto | SDK and host sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Removes listed strings from prompts for prompt ablation tests. It overrides the remove_ client data. | JSON text. A bad value logs a warning. Telemetry event a feature flag | All sessions |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Tells Claude Code that the SDK host reads startup marks. The Agent SDK sets it for startup() and prewarm(). The CLI then writes lines with a startup_ field. | On or off | SDK and print mode |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Tells Claude Code that the SDK host reads session state. Claude Code then sends session_ events marked sdk_. | On or off. Claude Code sets it to 1 in the SDK child env unless the host already set it | SDK and print mode. Claude Code sets it |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Simulates proxy use in request shaping. Claude Code then skips steps such as the thinking display update. A Probes run saw no anthropic- header. | On or off | API requests |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. | Tells Claude Code that a supervisor restarts it. On an uncaught exception it then exits at once instead of staying alive. | On or off | Supervised or managed runs |
CLAUDE_ | Undocumented: Only the program shows this item. It can change without notice. Gated: Works only behind a flag or a server gate. A feature flag or server gate decides by default. This variable overrides it | Forces the tether-live gate on or off. It replaces the feature flag and also gates the kept-reminder delivery. | On or off. Needs the first-party provider. Without it, the flag decides, and only for some builds or users | First-party provider only |
SDK_ | Undocumented: Only the program shows this item. It can change without notice. | Sets the native binary file name that the Agent SDK looks for. | Text, claude by default. Joined to the platform package path @anthropic- | Agent SDK launch. Not set from project env before trust |
How It Works
A host starts claude with its own environment.
Claude Code sets CLAUDE_CODE_ENTRYPOINT itself when it is empty (mcp for mcp serve, sdk-cli for the SDK command line).
Other variables here turn on extra stream events or tell Claude Code that a supervisor restarts it.
Related Pages
- Environment Variables: how Claude Code reads variables and which value wins.
- Headless and Print Mode
- Remote and Cloud Sessions
- Undocumented Items: every item that only the program shows.
Source: the program (variable names found in the 2.1.312 binary) and the Environment Variables page of the official docs.