Skip to main content

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.

VariableStatusWhat it doesValues and defaultNotes
ANTHROPIC_ENVIRONMENT_ID
Undocumented: Only the program shows this item. It can change without notice.
The bundled Anthropic SDK EnvironmentWorker 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 sourceBundled SDK work polling. Not set from project env before trust
ANTHROPIC_ENVIRONMENT_KEY
Undocumented: Only the program shows this item. It can change without notice.
The bundled Anthropic SDK EnvironmentWorker reads it as the fallback environment key. A work item needs it when its secret has no sessions_token.TextBundled SDK work polling. Not set from project env before trust
ANTHROPIC_SESSION_ID
Undocumented: Only the program shows this item. It can change without notice.
The bundled Anthropic SDK EnvironmentWorker reads it as the default session ID for a work item.Text. The call fails with an error if no ID comes from any sourceBundled SDK work polling. Not set from project env before trust
ANTHROPIC_WEBHOOK_SIGNING_KEY
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 defaultBundled SDK client. Not set from project env before trust
ANTHROPIC_WORK_ID
Undocumented: Only the program shows this item. It can change without notice.
The bundled Anthropic SDK EnvironmentWorker reads it as the default work item ID.Text. The call fails with an error if no ID comes from any sourceBundled SDK work polling. Not set from project env before trust
ANTHROPIC_WORK_SECRET
Undocumented: Only the program shows this item. It can change without notice.
The bundled Anthropic SDK EnvironmentWorker reads it as the default work secret.TextBundled SDK work polling. Not set from project env before trust
CLAUDE_CODE_CONFIG_PROBE
Undocumented: Only the program shows this item. It can change without notice.
In the IDE config probe, skips the awsAuthRefresh and gcpAuthRefresh commands and the credential helper prefetch.On or off, off by default. Also in a list of host-controlled namesIDE config probe, Bedrock and Vertex auth refresh
CLAUDE_CODE_EDITOR_CODELIVERY
Undocumented: Only the program shows this item. It can change without notice.
Lets a relayed human message carry an artifact_followup ack with an https URL of at most 2048 chars.On or off, off by defaultRelay and remote sessions only
CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS
Documented: An official docs page names this item.
Adds session_state_changed 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_CODE_SDK_READS_SESSION_STATE is setSDK and --print stream-json
CLAUDE_CODE_EMIT_USER_PROMPT_SUBMIT_HOOK_EVENTS
Undocumented: Only the program shows this item. It can change without notice.
Makes Claude Code send hook_started and hook_response system messages for UserPromptSubmit hooks. Added in 2.1.311.On or off, off by default. Claude Code reads it once and removes it from its environmentSDK and print mode
CLAUDE_CODE_ENTRYPOINT
Undocumented: Only the program shows this item. It can change without notice.
Names the surface that started Claude Code, such as cli, sdk-ts, claude-vscode, or remote. Many code paths branch on it.Text. Claude Code sets it at startup when it is empty (mcp for mcp serve, sdk-cli for SDK CLI). The TS SDK sets it to sdk-tsAll sessions
CLAUDE_CODE_ENTRYPOINT_ON_REQUESTS
Undocumented: Only the program shows this item. It can change without notice.
Sets the name that requests go out under in the cc_entrypoint= part of the billing header. Added in 2.1.305. The program reads it only when CLAUDE_CODE_ENTRYPOINT is claude-desktop-3p, 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-z, 0-9, _, and -, start with a letter, not start with sdk, and not be reserved (an entrypoint name, anything starting with remote, or local_projects). The program unsets the variable after reading it.Text. Source: the program strings only, not runClaude Desktop third-party only
CLAUDE_CODE_GENTLE_PARASOL
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_reminder when appliedAPI requests
CLAUDE_CODE_HUMBLE_HAMMOCK
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 echoWireToolInputs behavior on or off ahead of the flag. In a probe, it adds wire_tool_inputs (raw tool_use.input) to the assistant event when a tool runs. See Probes.On, off, or unset. Unset falls back to echoWireToolInputs and then to a feature flagAll sessions
CLAUDE_CODE_JIT_POLICY_AFTER_STARTUP
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 valueAll sessions, Bun build
CLAUDE_CODE_LARCH_CISTERN
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_cistern 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_CODE_AMBER_ASTROLABE. A false value counts as unsetAll sessions
CLAUDE_CODE_PLAIN_DELTA_FAST_PATH
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.1.311.On or off, off by defaultSDK and print mode
CLAUDE_CODE_POLL_EVENTS
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 autoSDK and host sessions
CLAUDE_CODE_REMOVE_PROMPT_STRINGS
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_prompt_strings client data.JSON text. A bad value logs a warning. Telemetry event a feature flagAll sessions
CLAUDE_CODE_SDK_READS_STARTUP_MARKS
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_mark field.On or offSDK and print mode
CLAUDE_CODE_SDK_READS_SESSION_STATE
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_state_changed events marked sdk_host_only.On or off. Claude Code sets it to 1 in the SDK child env unless the host already set itSDK and print mode. Claude Code sets it
CLAUDE_CODE_SIMULATE_PROXY_USAGE
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-beta header.On or offAPI requests
CLAUDE_CODE_SUPERVISED
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 offSupervised or managed runs
CLAUDE_CODE_TETHER_LIVE
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 usersFirst-party provider only
SDK_NATIVE_BIN
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-ai/claude-agent-sdk-<os>-<arch>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.

Source: the program (variable names found in the 2.1.312 binary) and the Environment Variables page of the official docs.