apiKey property
The Anthropic credential, handed to the child in its environment.
Given, it is the only credential the child can use: the child starts
with a configuration directory of its own and none of the parent's
Anthropic or Claude Code variables, so neither an ambient Claude Code
login nor an inherited key answers in its place
(agentSdkChildEnvironment). Null means "the child inherits
whatever is already in the environment", which is how a developer machine
with ANTHROPIC_API_KEY exported, or logged in to Claude Code, already
works. The app never reads the value back out of the child.
An empty key is refused when the transport is built: it can never authenticate, and as the only credential it would cut the child off from the ambient login and fail at the far end as a rejected credential.
Implementation
final String? apiKey;