Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/claude_code_sdk/_internal/transport/subprocess_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
self._options = options
self._cli_path = str(cli_path) if cli_path else self._find_cli()
self._cwd = str(options.cwd) if options.cwd else None
self._envvars = options.envvars if options.envvars else {}
self._process: Process | None = None
self._stdout_stream: TextReceiveStream | None = None
self._stderr_stream: TextReceiveStream | None = None
Expand Down Expand Up @@ -129,7 +130,7 @@ async def connect(self) -> None:
stdout=PIPE,
stderr=PIPE,
cwd=self._cwd,
env={**os.environ, "CLAUDE_CODE_ENTRYPOINT": "sdk-py"},
env={**os.environ, **self._envvars, "CLAUDE_CODE_ENTRYPOINT": "sdk-py"},
)

if self._process.stdout:
Expand Down
3 changes: 2 additions & 1 deletion src/claude_code_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Literal, TypedDict
from typing import Any, Literal, TypedDict, Dict

from typing_extensions import NotRequired # For Python < 3.11 compatibility

Expand Down Expand Up @@ -127,3 +127,4 @@ class ClaudeCodeOptions:
model: str | None = None
permission_prompt_tool_name: str | None = None
cwd: str | Path | None = None
envvars: Dict[str, str] | None = None