-
Notifications
You must be signed in to change notification settings - Fork 56
feat(working-dir): working_dir for LLM agents and their MCP servers #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jason Robert (jrob5756)
merged 13 commits into
microsoft:main
from
hertznsk:feat/agent-mcp-working-dir
Jul 16, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
afba6e3
feat(working-dir): working_dir schema for LLM agents, runtime default…
hertznsk 075436b
feat(working-dir): resolve working_dir in the engine for linear/paral…
hertznsk c0194a5
feat(working-dir): apply working_dir to session and MCP in the Copilo…
hertznsk eb8c1b3
feat(working-dir): pool MCP connections by directory in the Claude pr…
hertznsk f56e732
feat(working-dir): validator inherits working_dir from the primary agent
hertznsk 2329aeb
feat(working-dir): resolved working_dir in agent lifecycle events
hertznsk 6d4ad9a
docs(working-dir): documentation and example for agent working_dir
hertznsk f0246e6
test(claude): seed MCP manager pool in tool-filter integration tests
hertznsk 4849fbf
fix(claude): don't pool zero-server MCP managers and drop dead guard …
hertznsk 178eecb
fix(copilot): log legacy-checkpoint session resume with no recorded cwd
hertznsk 79a57b4
refactor(engine): extract is_llm_agent flag in agent_started emission
hertznsk 3bd94ca
docs(working-dir): clarify script-step working_dir semantics
hertznsk 14aa7aa
Merge remote-tracking branch 'upstream/main' into pr297head
jrob5756 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Working Directory Example | ||
| # | ||
| # Demonstrates dynamically setting the working directory for an agent and its | ||
| # MCP servers using the outputs of a set step. | ||
| # | ||
| # The workflow: | ||
| # 1. set_step - a set step that calculates the target directory path. | ||
| # 2. llm_agent - an LLM agent running with its `working_dir` bound to the | ||
| # path output of the set step, using an MCP tool in that directory. | ||
| # | ||
| # Usage: | ||
| # conductor run examples/working-dir.yaml | ||
|
|
||
| workflow: | ||
| name: working-dir-demo | ||
| description: "Demonstrates dynamic working directory configuration for agents and MCP servers" | ||
| version: "1.0.0" | ||
| entry_point: set_step | ||
|
|
||
| runtime: | ||
| provider: copilot | ||
| mcp_servers: | ||
| mock-search: | ||
| command: npx | ||
| args: ["-y", "open-websearch@latest"] | ||
| tools: ["*"] | ||
|
|
||
| agents: | ||
| - name: set_step | ||
| type: set | ||
| description: Calculate the directory path for the LLM agent | ||
| values: | ||
| path: "." # Resolves to the directory containing the workflow YAML (examples/) | ||
| routes: | ||
| - to: llm_agent | ||
|
|
||
| - name: llm_agent | ||
| description: Runs in the dynamically calculated working directory | ||
| model: claude-haiku-4.5 | ||
| working_dir: "{{ set_step.output.path }}" | ||
| prompt: | | ||
| You are running in the working directory: {{ set_step.output.path }}. | ||
| Please analyze the files in this directory. | ||
| routes: | ||
| - to: $end | ||
|
|
||
| output: | ||
| resolved_path: "{{ set_step.output.path }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lists rejected step types and implies every other step type resolves
working_dirthe same way the LLM-agent path does.scriptsteps don't --ScriptExecutorrendersagent.working_diron its own, with noruntime.working_dirfallback, no absolutize-against-the-workflow-file, and no pre-flight existence check (a missing directory surfaces as a raw subprocess error, not theExecutionErrorthe LLM path raises). A one-line callout here would keep someone who setsruntime.working_dirglobally from assuming it also reachesscriptsteps.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 3bd94ca — added a Script Steps bullet right after Rejected Step Types, documenting that script steps honor only their own
working_dir(noruntime.working_dirfallback, relative paths resolve against the conductor process cwd, missing dirs surface as a subprocess startup error).On the behavioral divergence itself: do you think it's worth a separate issue to decide whether
ScriptExecutorshould be brought to parity with the LLM-agent resolution (runtime fallback + workflow-file-relative absolutize + pre-flight existence check)? That's a behavior change beyond docs, and I'm happy to do the corresponding work if you and the maintainers want it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a good follow-up on its own -- please go ahead and open an issue for it, and thanks for offering to pick it up. I'd rather keep this PR scoped to LLM agents and their MCP servers as it stands.