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 22 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | Names the surface that started Claude Code, such as cli, sdk-, claude-, or remote. Many code paths branch on it. | Text. Set by Claude Code at startup when empty (mcp for mcp serve, sdk- for SDK CLI) and set to sdk- by the TS SDK | All sessions |
CLAUDE_ | Undocumented Gated | Overrides a feature flag experiment, which applies a secondary reminder to model requests. | Text. Logs secondary_ when applied | API requests |
CLAUDE_ | Undocumented Gated | Forces the echo behavior on or off ahead of the flag. Probe: 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 | Sets the Bun JIT policy 10 seconds after start. Without it the policy is set 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 Gated | Overrides the larch_ experiment value for the model. Probe: 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 | 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 | 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 | 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 | Tells Claude Code that the SDK host reads session state. Claude Code then sends session_ events marked sdk_. | On or off. Set by Claude Code to 1 in the SDK child env unless the host already set it | SDK and print mode. Set by Claude Code |
CLAUDE_ | Undocumented | 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 | 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 Gated | 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 | 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 switch 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.304 binary) and the Environment Variables page of the official docs.