🧩env Option
Also known as Agent SDK environment variables, Claude Agent SDK env
The option that sets env values for the agent.
Think of it like
It is like the bag of things you pack for a helper.
Example
Leo sets env to just his API key in TypeScript, and the agent can no longer find git. He spreads process.env in first, and it works.
Why it matters
With no PATH, each shell command the agent runs fails. The error does not say why.
Definition
Example code
typescript
env: { ...process.env, DEBUG: "1" }Common mistake
Key takeaways
- 1TypeScript replaces. Spread process.env.
- 2Python merges. Over the inherited.
- 3For the agent's process. Not your app.