Skip to content

SDK API Reference / ClaudeAgentEnvironment

Interface: ClaudeAgentEnvironment

Environment abstraction for Claude Agent SDK

Implementations provide platform-specific paths and configuration:

  • CLI: Uses process.cwd(), PATH, etc.
  • Electron: Uses app.isPackaged, process.resourcesPath, etc.

Methods

getClaudeCodePath()

getClaudeCodePath(): string

Get the path to the Claude Code CLI executable This is passed to the SDK as pathToClaudeCodeExecutable

Returns

string


getNodeBinPath()?

optional getNodeBinPath(): string | undefined

Get the directory containing the Node.js binary (for PATH)

In packaged Electron apps, returns the directory with bundled Node.js. Added to PATH so spawned processes can find node.

Returns

string | undefined

Path to Node.js bin directory, or undefined to use system PATH


getTdxBinPath()

getTdxBinPath(): string

Get the path to the tdx CLI bin directory This is added to PATH for the Bash tool

Returns

string


getWorkingDirectory()

getWorkingDirectory(): string

Get the working directory for the agent

Returns

string

Current working directory


hasClaudeCodeCli()

hasClaudeCodeCli(): boolean

Check if Claude Code CLI exists at the expected path

Returns

boolean

true if the CLI executable exists