You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9a94213
Browse filesBrowse the repository at this point in the historyBrowse files
Enhance Azure DevOps Pull Request Agent to support both direct Anthropic API and Microsoft Foundry providers, updating environment variable handling and documentation accordingly.
The agent supports two Claude Code providers, selected at runtime. Set one group:
77
+
76
78
| Variable | Required | Description |
77
79
|---|---|---|
78
-
|`ANTHROPIC_API_KEY`| Yes | Anthropic API key — used by Claude Code CLI for authentication |
80
+
|**Direct Anthropic API**|||
81
+
|`ANTHROPIC_API_KEY`| Conditional | Anthropic API key — required when using direct Anthropic API |
82
+
|**Microsoft Foundry**|||
83
+
|`CLAUDE_CODE_USE_FOUNDRY`| Conditional | Set to `1` to enable Microsoft Foundry provider |
84
+
|`ANTHROPIC_FOUNDRY_RESOURCE`| Conditional | Foundry resource name — used when Foundry is enabled |
85
+
|`ANTHROPIC_FOUNDRY_API_KEY`| Conditional | Foundry API key — used when Foundry is enabled with API key auth |
86
+
|`ANTHROPIC_DEFAULT_SONNET_MODEL`| No | Optional model deployment name override for Foundry |
87
+
|`ANTHROPIC_DEFAULT_HAIKU_MODEL`| No | Optional model deployment name override for Foundry |
88
+
|**Internal**|||
79
89
|`ADO_MCP_AUTH_TOKEN`| Runtime | Azure DevOps access token — set internally by `PullRequestAgent` for the MCP server; passed via `--ado-token` CLI arg |
80
90
81
91
## Key Architecture Decisions
82
92
83
93
-**Claude Code CLI invocation:**`PullRequestAgent.RunAsync()` shells out to `claude -p` (non-interactive mode) via `System.Diagnostics.Process`. It builds an MCP config JSON at runtime with two MCP servers (Azure DevOps for PR data, Microsoft Learn for best practices) and passes the system prompt via `--system-prompt-file`.
84
94
-**System prompt:** The review persona and checklist live in `pullreview.prompt`, which is loaded at runtime. Edits to the review behavior should target this file, not C# code.
85
95
-**MCP server configuration:** The Azure DevOps MCP server is configured in a JSON file passed to `--mcp-config`. The ADO authentication token is passed through the `env` field in the MCP config, keeping it out of command-line arguments.
96
+
-**Provider selection:** The agent supports both direct Anthropic API and Microsoft Foundry as Claude Code providers, selected at runtime via environment variables. The `ConfigureProviderEnvironment` method in `PullRequestAgent.cs` detects `CLAUDE_CODE_USE_FOUNDRY=1` for Foundry mode, otherwise falls back to `ANTHROPIC_API_KEY`.
86
97
-**Output:** The review is written to stdout and optionally to `pull_request_<id>_review.md` in the specified output directory. Claude also saves structured review files (`review/code_review.md` and optionally `review/code_review_summary.md`) as instructed by the system prompt.
0 commit comments