From 1a5f9c5bd0e824d1663ce3c54c2a1b11dc9c7a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Titsworth-Morin?= Date: Tue, 21 Jul 2026 09:56:44 +0000 Subject: [PATCH] feat(self-improving-mastra): explicit per-cloud models (GLM 5 / Gemini 3.5 Flash) Replace the chat-default alias with explicit model IDs in the committed env files: - AWS: CHAT_MODEL=zai.glm-5 (z.ai GLM 5; GA on Bedrock, available in us-east-1) - GCP: CHAT_MODEL=gemini-3.5-flash (GA on Vertex AI) Refresh the README model references to match. GCP caveat: Gemini 3.x is served via Vertex's global endpoint and is not offered on-demand in every region (europe-west2 is provisioned-throughput only). Defang sets VERTEXAI_LOCATION to the compute region for explicit models (only the chat-large alias forces global), so the GCP deploy needs a location that serves gemini-3.5-flash: a full on-demand region, or a CLI change routing gemini-3.x to the global endpoint. Co-Authored-By: Claude Opus 4.8 --- samples/self-improving-mastra/.env.aws | 2 +- samples/self-improving-mastra/.env.gcp | 2 +- samples/self-improving-mastra/README.md | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/samples/self-improving-mastra/.env.aws b/samples/self-improving-mastra/.env.aws index 9bb52864..12e1c84d 100644 --- a/samples/self-improving-mastra/.env.aws +++ b/samples/self-improving-mastra/.env.aws @@ -1,5 +1,5 @@ # Non-secret Compose interpolation values selected by cli for aws provider. -CHAT_MODEL=chat-default +CHAT_MODEL=zai.glm-5 PUBLISH_ENABLED=true PUBLISH_POLICY=arn:aws:iam::aws:policy/AdministratorAccess PUBLISH_PROVIDER=aws diff --git a/samples/self-improving-mastra/.env.gcp b/samples/self-improving-mastra/.env.gcp index 6002fda7..5d2cccce 100644 --- a/samples/self-improving-mastra/.env.gcp +++ b/samples/self-improving-mastra/.env.gcp @@ -1,5 +1,5 @@ # Non-secret Compose interpolation values selected by cli for gcp provider. -CHAT_MODEL=chat-default +CHAT_MODEL=gemini-3.5-flash PUBLISH_ENABLED=true PUBLISH_POLICY=roles/owner PUBLISH_PROVIDER=gcp diff --git a/samples/self-improving-mastra/README.md b/samples/self-improving-mastra/README.md index bc8c7414..88eefba3 100644 --- a/samples/self-improving-mastra/README.md +++ b/samples/self-improving-mastra/README.md @@ -23,8 +23,8 @@ environment: - `dev` contains the source, Caddy, the Next.js dev server, and the Mastra agent. - `db` is shared PostgreSQL for auth, todos, and feedback. - `chat` is the managed model used by the coding agent, declared as a top-level - `models:` entry with the `chat-default` alias, so Defang maps it to the - cloud's native inference — Gemini on GCP Vertex AI, Amazon Nova on AWS Bedrock. + `models:` entry; each cloud's env file selects an explicit model — z.ai GLM 5 + on AWS Bedrock, Gemini 3.5 Flash on GCP Vertex AI. The **admin console is served by the agent server, not the Next.js app** — it lives outside the source tree the coding agent edits. Caddy routes `/admin` to @@ -87,8 +87,8 @@ defang config set ADMIN_TOKEN --random ## Deployment -The `chat` model is `chat-default`, so the same Compose project deploys to -either cloud — Defang resolves it to that provider's managed inference. The +The same Compose project deploys to either cloud; each cloud's env file selects +an explicit managed model (z.ai GLM 5 on AWS, Gemini 3.5 Flash on GCP). The first deployment creates managed PostgreSQL and can take about 20 minutes. Defang reports separate URLs for `app` and `dev`: @@ -107,7 +107,7 @@ stack files select different non-secret interpolation files: | `aws` | `.env.aws` | `AdministratorAccess` | | `gcp` | `.env.gcp` | `roles/owner` | -The two env files are the place to customize the managed-model alias and other +The two env files are the place to customize the managed model and other cloud-specific scalar settings. Secrets still belong in `defang config`, never in these committed files. @@ -117,8 +117,10 @@ this demo for production. ### GCP (Vertex AI) -`chat-default` resolves to Gemini on Vertex AI. The `gcp` stack selects -`europe-west2`; provide the target project when deploying: +The `gcp` env file selects `gemini-3.5-flash` on Vertex AI. Gemini 3.x is +reachable through Vertex's **global** endpoint and is not offered on-demand in +every region, so deploy to a location that serves it. Provide the target project +when deploying: ```bash export GCP_PROJECT_ID=your-gcp-project @@ -127,7 +129,7 @@ defang compose up --stack gcp ### AWS (Bedrock) -`chat-default` resolves to an Amazon Nova model on Bedrock. Enable model access +The `aws` env file selects z.ai GLM 5 (`zai.glm-5`) on Bedrock. Enable model access for it in the Bedrock console first. The `aws` stack selects `us-east-1`: ```bash