feat: add claudeCodeVertex agent provider for Google Vertex AI#635
Open
mikkelhartung wants to merge 1 commit into
Open
feat: add claudeCodeVertex agent provider for Google Vertex AI#635mikkelhartung wants to merge 1 commit into
mikkelhartung wants to merge 1 commit into
Conversation
Adds a new agent provider that routes Claude Code through Google Vertex AI, enabling AFK / unattended runs against models hosted in a customer's GCP project. The provider uses the same `claude` CLI binary as `claudeCode()` and produces an identical session format, so session capture, `--resume`, and `effort` work the same way. The factory only injects non-secret routing config (`CLAUDE_CODE_USE_VERTEX=1`, `CLOUD_ML_REGION`, and `ANTHROPIC_VERTEX_PROJECT_ID`); Google credentials are always supplied via the sandbox environment (`GOOGLE_APPLICATION_CREDENTIALS` or Application Default Credentials), matching the security pattern used by `claudeCode()` for `ANTHROPIC_API_KEY`. README documents three Vertex-specific gotchas that aren't obvious from the Anthropic docs: model IDs must match Model Garden entries (often with a dated suffix), region must match where the model is actually served (newer models are global-only), and Claude Code verifies both a primary and a small/fast haiku model at startup — so `ANTHROPIC_DEFAULT_HAIKU_MODEL` may need to be set via `env`. `sandcastle init` now offers Claude Code (Vertex AI) as a template choice with a matching Dockerfile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@mikkelhartung is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
claudeCodeVertex()agent provider that routes Claude Code through Google Vertex AI, enabling AFK / unattended runs against models hosted in a customer's GCP project.claudeCLI binary asclaudeCode()and produces an identical session format — session capture,--resume, andeffortwork the same way.CLAUDE_CODE_USE_VERTEX=1,CLOUD_ML_REGION,ANTHROPIC_VERTEX_PROJECT_ID). Google credentials are always supplied via the sandbox environment (GOOGLE_APPLICATION_CREDENTIALSor Application Default Credentials), matching the patternclaudeCode()uses forANTHROPIC_API_KEY.sandcastle initoffers a "Claude Code (Vertex AI)" template choice with a matching Dockerfile.API
Vertex-specific gotchas (documented in the README)
These aren't obvious from the Anthropic Vertex docs and tripped me up during smoke testing — surfaced as explicit callouts in the new
ClaudeCodeVertexOptionsREADME section:claude-opus-4-1@20250805). For AFK runs, pin a dated version.region: "global". Wrong region surfaces as "model is not available on your vertex deployment".ANTHROPIC_DEFAULT_HAIKU_MODELviaenv.Test plan
npx vitest run src/AgentProvider.test.ts— 133 tests pass (23 new tests forclaudeCodeVertexcovering name, env vars with/withoutprojectId,envmerging,buildPrintCommandflags,parseStreamLine,parseSessionUsage,captureSessionsdefault/override,buildInteractiveArgs, model independence).npm run typecheck— only pre-existing@daytona/sdkerrors remain (unrelated to this change).region: "global",ANTHROPIC_DEFAULT_HAIKU_MODELoverride). Exit code 0, Claude responded.@ai-hero/sandcastlepatch).🤖 Generated with Claude Code