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 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.

VariableStatusWhat it doesValues and defaultNotes
ANTHROPIC_ENVIRONMENT_IDUndocumentedThe 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_KEYUndocumentedThe 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_IDUndocumentedThe 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_KEYUndocumentedThe 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_IDUndocumentedThe 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_SECRETUndocumentedThe 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_PROBEUndocumentedIn 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_CODELIVERYUndocumentedLets 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_EVENTSDocumentedAdds 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_ENTRYPOINTUndocumentedNames the surface that started Claude Code, such as cli, sdk-ts, claude-vscode, or remote. Many code paths branch on it.Text. Set by Claude Code at startup when empty (mcp for mcp serve, sdk-cli for SDK CLI) and set to sdk-ts by the TS SDKAll sessions
CLAUDE_CODE_GENTLE_PARASOLUndocumented GatedOverrides a feature flag experiment, which applies a secondary reminder to model requests.Text. Logs secondary_reminder when appliedAPI requests
CLAUDE_CODE_HUMBLE_HAMMOCKUndocumented GatedForces the echoWireToolInputs behavior on or off ahead of the flag. Probe: 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_STARTUPUndocumentedSets 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 valueAll sessions, Bun build
CLAUDE_CODE_LARCH_CISTERNUndocumented GatedOverrides the larch_cistern 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_CODE_AMBER_ASTROLABE. A false value counts as unsetAll sessions
CLAUDE_CODE_POLL_EVENTSUndocumentedLets 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_STRINGSUndocumentedRemoves 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_MARKSUndocumentedTells 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_STATEUndocumentedTells Claude Code that the SDK host reads session state. Claude Code then sends session_state_changed events marked sdk_host_only.On or off. Set by Claude Code to 1 in the SDK child env unless the host already set itSDK and print mode. Set by Claude Code
CLAUDE_CODE_SIMULATE_PROXY_USAGEUndocumentedSimulates 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_SUPERVISEDUndocumentedTells 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_LIVEUndocumented GatedForces 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_BINUndocumentedSets 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 switch on extra stream events or tell Claude Code that a supervisor restarts it.

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