Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/model-discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
``anthropic`` publisher.

Required env vars:
GCP_REGION - GCP region (e.g. us-east5)
GCP_REGION - GCP region (e.g. global)
GCP_PROJECT - GCP project ID

Optional env vars:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-reviews.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
s3_bucket: pull-reviews
gcp_project_id: ambient-code-platform
gcp_region: us-east5
gcp_region: global
gcp_workload_identity_provider: projects/888214980327/locations/global/workloadIdentityPools/github/providers/ambient-code-github-actions
secrets:
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
Expand Down
2 changes: 1 addition & 1 deletion components/ambient-control-plane/internal/config/config.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Load() (*ControlPlaneConfig, error) {
AnthropicAPIKey: os.Getenv("ANTHROPIC_API_KEY"),
VertexEnabled: os.Getenv("USE_VERTEX") == "1" || os.Getenv("USE_VERTEX") == "true",
VertexProjectID: os.Getenv("ANTHROPIC_VERTEX_PROJECT_ID"),
VertexRegion: envOrDefault("CLOUD_ML_REGION", "us-east5"),
VertexRegion: envOrDefault("CLOUD_ML_REGION", "global"),
VertexCredentialsPath: envOrDefault("GOOGLE_APPLICATION_CREDENTIALS", "/app/vertex/ambient-code-key.json"),
VertexSecretName: envOrDefault("VERTEX_SECRET_NAME", "ambient-vertex"),
VertexSecretNamespace: envOrDefault("VERTEX_SECRET_NAMESPACE", "ambient-code"),
Expand Down
7 changes: 2 additions & 5 deletions components/backend/handlers/display_name.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,11 @@ func getAnthropicClient(ctx context.Context, projectName string) (anthropic.Clie
// Check if Vertex AI is enabled (cluster-wide setting)
if isVertexEnabled() {
// For Vertex AI, use the vertex package with Google Application Default Credentials
// Required env vars: GOOGLE_APPLICATION_CREDENTIALS, ANTHROPIC_VERTEX_PROJECT_ID, CLOUD_ML_REGION
region := os.Getenv("CLOUD_ML_REGION")
gcpProjectID := os.Getenv("ANTHROPIC_VERTEX_PROJECT_ID")

// Default to us-east5 - claude-haiku-4-5 is not available in global region
// See: https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude
if region == "" || region == "global" {
region = "us-east5"
if region == "" {
region = "global"
}
if gcpProjectID == "" {
return anthropic.Client{}, false, fmt.Errorf("ANTHROPIC_VERTEX_PROJECT_ID is required when USE_VERTEX is enabled (check backend deployment env vars)")
Expand Down
4 changes: 2 additions & 2 deletions components/backend/handlers/display_name_test.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ var _ = Describe("Display Name Handler", Label(test_constants.LabelUnit, test_co
It("Should detect Vertex AI enabled configuration", func() {
os.Setenv("USE_VERTEX", "1")
os.Setenv("ANTHROPIC_VERTEX_PROJECT_ID", "test-gcp-project")
os.Setenv("CLOUD_ML_REGION", "us-east5")
os.Setenv("CLOUD_ML_REGION", "global")

// This tests the environment detection logic
// We can't easily test the full getAnthropicClient without real credentials
// but we can verify the environment variables are read correctly
Expect(os.Getenv("USE_VERTEX")).To(Equal("1"))
Expect(os.Getenv("ANTHROPIC_VERTEX_PROJECT_ID")).To(Equal("test-gcp-project"))
Expect(os.Getenv("CLOUD_ML_REGION")).To(Equal("us-east5"))
Expect(os.Getenv("CLOUD_ML_REGION")).To(Equal("global"))
})

It("Should handle missing Vertex configuration gracefully", func() {
Expand Down
2 changes: 1 addition & 1 deletion components/manifests/overlays/mpp-openshift/ambient-control-plane.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
- name: ANTHROPIC_VERTEX_PROJECT_ID
value: "ambient-code-platform"
- name: CLOUD_ML_REGION
value: "us-east5"
value: "global"
- name: GOOGLE_APPLICATION_CREDENTIALS
value: "/app/vertex/ambient-code-key.json"
- name: VERTEX_SECRET_NAME
Expand Down
4 changes: 2 additions & 2 deletions docs/internal/design/control-plane.guide.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -726,14 +726,14 @@ acpctl session events <id> CLI open
| File | Change |
|------|--------|
| `runners/ambient_runner/platform/context.py` | Added `current_user_id`, `current_user_name`, `caller_token` fields + `set_current_user()` method to `RunnerContext` |
| `overlays/mpp-openshift/ambient-control-plane.yaml` | Added `USE_VERTEX=1`, `ANTHROPIC_VERTEX_PROJECT_ID=ambient-code-platform`, `CLOUD_ML_REGION=us-east5`, `GOOGLE_APPLICATION_CREDENTIALS=/app/vertex/ambient-code-key.json`, `VERTEX_SECRET_NAME=ambient-vertex`, `VERTEX_SECRET_NAMESPACE=ambient-code--runtime-int`; added `vertex-credentials` volumeMount + volume from `ambient-vertex` secret |
| `overlays/mpp-openshift/ambient-control-plane.yaml` | Added `USE_VERTEX=1`, `ANTHROPIC_VERTEX_PROJECT_ID=ambient-code-platform`, `CLOUD_ML_REGION=global`, `GOOGLE_APPLICATION_CREDENTIALS=/app/vertex/ambient-code-key.json`, `VERTEX_SECRET_NAME=ambient-vertex`, `VERTEX_SECRET_NAMESPACE=ambient-code--runtime-int`; added `vertex-credentials` volumeMount + volume from `ambient-vertex` secret |

**Vertex invariants for MPP:**
- Secret: `secret/ambient-vertex` in `ambient-code--runtime-int` — contains `ambient-code-key.json` (GCP SA key)
- CP reads it via `nsKube()` (tenant SA) and copies to session namespace via `ensureVertexSecret()`
- Runner pod mounts it at `/app/vertex/` — set `GOOGLE_APPLICATION_CREDENTIALS=/app/vertex/ambient-code-key.json`
- `VERTEX_SECRET_NAMESPACE` must be `ambient-code--runtime-int` (not default `ambient-code`)
- GCP project: `ambient-code-platform`, region: `us-east5`
- GCP project: `ambient-code-platform`, region: `global`

**acpctl session commands:**
```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/internal/developer/local-development/kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ make kind-up LOCAL_VERTEX=true GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-a
```bash
make kind-up LOCAL_VERTEX=true \
ANTHROPIC_VERTEX_PROJECT_ID=my-project \
CLOUD_ML_REGION=us-east5 \
CLOUD_ML_REGION=global \
GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
```

Expand Down
8 changes: 4 additions & 4 deletions scripts/setup-vertex-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#
# CLOUD_ML_REGION
# GCP region for Vertex AI API calls.
# Example: us-east5 (Claude is available in limited regions)
# Example: global (recommended for cost optimization)
#
# SETUP:
# Add these to your shell profile (~/.zshrc or ~/.bashrc):
#
# export GOOGLE_APPLICATION_CREDENTIALS="$HOME/.config/gcloud/your-sa-key.json"
# export ANTHROPIC_VERTEX_PROJECT_ID="your-gcp-project-id"
# export CLOUD_ML_REGION="us-east5"
# export CLOUD_ML_REGION="global"
#
# Then reload your shell: source ~/.zshrc
#
Expand Down Expand Up @@ -109,7 +109,7 @@ fi

if [ -z "$CLOUD_ML_REGION" ]; then
echo " [MISSING] CLOUD_ML_REGION"
echo " GCP region (e.g., us-east5)"
echo " GCP region (e.g., global)"
echo ""
missing_vars=1
else
Expand All @@ -122,7 +122,7 @@ if [ $missing_vars -eq 1 ]; then
echo ""
echo ' export GOOGLE_APPLICATION_CREDENTIALS="$HOME/.config/gcloud/your-sa-key.json"'
echo ' export ANTHROPIC_VERTEX_PROJECT_ID="your-gcp-project-id"'
echo ' export CLOUD_ML_REGION="us-east5"'
echo ' export CLOUD_ML_REGION="global"'
echo ""
echo "Then reload: source ~/.zshrc"
exit 1
Expand Down
Loading