Skip to content

[fix]: Add bedrock to provider enum in Zod schemas and OpenAPI spec#1759

Merged
shrey150 merged 4 commits intomainfrom
shrey/add-bedrock-to-model-config-schema
Feb 25, 2026
Merged

[fix]: Add bedrock to provider enum in Zod schemas and OpenAPI spec#1759
shrey150 merged 4 commits intomainfrom
shrey/add-bedrock-to-model-config-schema

Conversation

@shrey150
Copy link
Contributor

@shrey150 shrey150 commented Feb 25, 2026

Summary

  • Adds "bedrock" to the provider enum in ModelConfigObjectSchema and AgentConfigSchema (Zod schemas in packages/core/lib/v3/types/public/api.ts)
  • Regenerates packages/server/openapi.v3.yaml via pnpm gen:openapi

Context

Bedrock was added to AISDK_PROVIDERS and LLMProvider in PRs #1604 and #1617, but the Zod schemas that feed the OpenAPI spec (and ultimately the Stainless-generated SDKs) were never updated. This means the Python/Go/etc. SDK type definitions don't include "bedrock" as a valid provider option.

Companion PR in bb/core: https://github.com/browserbase/core/pull/7668

Test plan

  • pnpm gen:openapi produces updated spec with bedrock in all 4 provider enum locations
  • Stainless picks up the OpenAPI change and regenerates SDKs with bedrock in the provider literal type

🤖 Generated with Claude Code


Summary by cubic

Add "bedrock" to provider enums in ModelConfigObjectSchema/AgentConfigSchema and regenerate the OpenAPI spec so SDKs accept it and stay in sync with AISDK_PROVIDERS/LLMProvider. Also update AgentType to include "bedrock" to fix a server build type mismatch, and add a patch changeset to publish and unblock Python/Go SDK type generation.

Written for commit 88e3372. Summary will update on new commits. Review in cubic

Adds "bedrock" to the provider enum in ModelConfigObjectSchema and
AgentConfigSchema, and regenerates the OpenAPI spec. This keeps the
schemas in sync with the AISDK_PROVIDERS list (updated in #1604) and
will propagate to generated SDKs (Python, Go, etc.) via Stainless.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: 88e3372

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-server Patch
@browserbasehq/stagehand-evals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

✱ Stainless preview builds

This PR will update the stagehand SDKs with the following commit message.

feat: Add bedrock to provider enum in Zod schemas and OpenAPI spec
stagehand-openapi studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅

stagehand-kotlin studio

Your SDK build had a "fatal" conclusion, and no code was generated.

stagehand-typescript studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/stagehand-typescript/5cea7144b6bc164e36b3a449052cd6901164e207/dist.tar.gz
stagehand-go studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅lint ✅test ✅

go get github.com/stainless-sdks/stagehand-go@199692479d1d2c2ed35d257e147e54639af39953
stagehand-ruby studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅lint ✅test ✅

stagehand-python studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅build ✅lint ✅test ✅

pip install https://pkg.stainless.com/s/stagehand-python/5ace8c9ee306ff8cc09c258500c24b6b55e9562b/stagehand-3.6.0-py3-none-any.whl
stagehand-java studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅build ✅lint ✅test ✅

Add the following URL as a Maven source: 'https://pkg.stainless.com/s/stagehand-java/6094f1e40953452c5bd2c605f26e9a0eb6ffe596/mvn'
stagehand-php studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅lint ✅test ✅

⚠️ stagehand-csharp studio · code

Your SDK build had at least one "warning" diagnostic.
generate ⚠️build ✅lint ❗test ✅


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-02-25 23:08:42 UTC

@shrey150 shrey150 requested a review from monadoid February 25, 2026 21:20
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shrey150 shrey150 changed the title Add bedrock to provider enum in Zod schemas and OpenAPI spec [fix]: Add bedrock to provider enum in Zod schemas and OpenAPI spec Feb 25, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

Added "bedrock" to the provider enum in ModelConfigObjectSchema and AgentConfigSchema, bringing the Zod schemas and OpenAPI spec in sync with the existing AISDK_PROVIDERS and LLMProvider implementations.

Changes:

  • Updated two Zod schema enums in packages/core/lib/v3/types/public/api.ts to include "bedrock" as a valid provider option
  • Regenerated packages/server/openapi.v3.yaml via pnpm gen:openapi, adding bedrock to all 4 provider enum locations

This ensures Python, Go, and other Stainless-generated SDKs will accept "bedrock" as a valid provider value.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are minimal and straightforward: adding a single string literal to existing enums in two locations, plus the auto-generated OpenAPI spec. Bedrock support already exists in AISDK_PROVIDERS and LLMProvider, so this PR simply brings the public API schemas into alignment. No logic changes, no new functionality, just schema completeness.
  • No files require special attention

Important Files Changed

Filename Overview
packages/core/lib/v3/types/public/api.ts Added bedrock to provider enum in ModelConfigObjectSchema and AgentConfigSchema
packages/server/openapi.v3.yaml Regenerated OpenAPI spec with bedrock added to 4 provider enum locations

Last reviewed commit: c334542

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

The provider enum in the Zod schema now includes "bedrock", but the
AgentType TypeScript type (used by ClientOptions.provider) didn't,
causing a type mismatch in the server build.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Confidence score: 3/5

  • A hardcoded provider enum in packages/core/lib/v3/types/public/api.ts is already out of sync with AISDK_PROVIDERS, which can lead to missing or rejected providers and user-facing behavior mismatches.
  • Severity is moderate (7/10) with high confidence, so there’s some regression risk if new providers are added or existing ones differ.
  • Pay close attention to packages/core/lib/v3/types/public/api.ts - hardcoded provider list may drift from AISDK_PROVIDERS.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/core/lib/v3/types/public/api.ts">

<violation number="1" location="packages/core/lib/v3/types/public/api.ts:55">
P1: Custom agent: **Ensure we never check against hardcoded lists of allowed LLM model names**

This hardcoded provider enum is already out of sync with `AISDK_PROVIDERS` (5 vs 14 providers) and will need yet another update for every new provider. Per our guideline against hardcoded allowed-lists, consider switching to `z.string()` here so that validation is left to the LLM provider at runtime. The `modelName` field already accepts a free-form `provider/model-name` string, making this enum redundant as a guardrail. If enum values are needed for SDK documentation/hints, they could be expressed as OpenAPI `examples` rather than a restrictive `enum`.

Alternatively, if the enum must stay for SDK generation reasons, at minimum derive it from the canonical `AISDK_PROVIDERS` array in `packages/server/src/types/model.ts` to keep a single source of truth.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant Dev as Developer / CI
    participant Zod as Core Zod Schemas
    participant Spec as OpenAPI Spec (YAML)
    participant Stainless as Stainless (External)
    participant SDK as Generated SDKs (Py/Go)
    participant API as Server Runtime

    Note over Dev, SDK: Build & Code Generation Flow

    Dev->>Zod: NEW: Add "bedrock" to provider enum
    Dev->>Spec: CHANGED: Run pnpm gen:openapi
    Zod-->>Spec: Export updated schemas
    Spec->>Stainless: Ingest updated OpenAPI YAML
    Stainless-->>SDK: NEW: Regenerate SDKs with "bedrock" literal types

    Note over SDK, API: Runtime Request Flow

    rect rgb(23, 37, 84)
        Note right of SDK: Client Application Usage
        SDK->>SDK: NEW: Allow "bedrock" in type-safe config
        SDK->>API: POST /request (provider: "bedrock")
    end

    API->>Zod: Validate request payload
    
    alt Valid Provider ("bedrock" or existing)
        Zod-->>API: NEW: Validation Success
        API->>API: Resolve LLM Provider Logic
        Note right of API: Handled by existing Bedrock integration
    else Invalid Provider
        Zod-->>API: 400 Bad Request
    end

    API-->>SDK: Response
    SDK-->>Dev: Data
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

.object({
provider: z
.enum(["openai", "anthropic", "google", "microsoft"])
.enum(["openai", "anthropic", "google", "microsoft", "bedrock"])
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Custom agent: Ensure we never check against hardcoded lists of allowed LLM model names

This hardcoded provider enum is already out of sync with AISDK_PROVIDERS (5 vs 14 providers) and will need yet another update for every new provider. Per our guideline against hardcoded allowed-lists, consider switching to z.string() here so that validation is left to the LLM provider at runtime. The modelName field already accepts a free-form provider/model-name string, making this enum redundant as a guardrail. If enum values are needed for SDK documentation/hints, they could be expressed as OpenAPI examples rather than a restrictive enum.

Alternatively, if the enum must stay for SDK generation reasons, at minimum derive it from the canonical AISDK_PROVIDERS array in packages/server/src/types/model.ts to keep a single source of truth.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/lib/v3/types/public/api.ts, line 55:

<comment>This hardcoded provider enum is already out of sync with `AISDK_PROVIDERS` (5 vs 14 providers) and will need yet another update for every new provider. Per our guideline against hardcoded allowed-lists, consider switching to `z.string()` here so that validation is left to the LLM provider at runtime. The `modelName` field already accepts a free-form `provider/model-name` string, making this enum redundant as a guardrail. If enum values are needed for SDK documentation/hints, they could be expressed as OpenAPI `examples` rather than a restrictive `enum`.

Alternatively, if the enum must stay for SDK generation reasons, at minimum derive it from the canonical `AISDK_PROVIDERS` array in `packages/server/src/types/model.ts` to keep a single source of truth.</comment>

<file context>
@@ -52,7 +52,7 @@ export const LocalBrowserLaunchOptionsSchema = z
   .object({
     provider: z
-      .enum(["openai", "anthropic", "google", "microsoft"])
+      .enum(["openai", "anthropic", "google", "microsoft", "bedrock"])
       .optional()
       .meta({
</file context>
Fix with Cubic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok to ignore for now, but we should fix this someday

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update—I'll treat this as non-blocking for now.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor Author

shrey150 commented Feb 25, 2026

Merge activity

  • Feb 25, 11:03 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 25, 11:03 PM UTC: @shrey150 merged this pull request with Graphite.

@shrey150 shrey150 merged commit 505e8c6 into main Feb 25, 2026
335 of 336 checks passed
@github-actions github-actions bot mentioned this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants