🧩cwd Option
Also known as Agent SDK cwd, Agent SDK working directory, Claude Agent SDK cwd
The option that sets which folder the agent works in.
Think of it like
It is like telling a helper which room to work in.
Example
A service runs one agent for each customer. Each call gets its own folder, so no agent sees the files of another.
Why it matters
The working folder decides what the agent can see and change. The wrong one can touch the wrong files.
Definition
Example code
typescript
cwd: "/work/session-a"Common mistake
Key takeaways
- 1The agent's folder. Where its tools start.
- 2Defaults to yours. Your program's folder.
- 3One per session. When many share a machine.