feat: add Amazon Bedrock as alternative AI provider (AI_PROVIDER flag)#20
Open
tobigs wants to merge 4 commits intoserithemage:mainfrom
Open
feat: add Amazon Bedrock as alternative AI provider (AI_PROVIDER flag)#20tobigs wants to merge 4 commits intoserithemage:mainfrom
tobigs wants to merge 4 commits intoserithemage:mainfrom
Conversation
Add environment-variable-driven provider selection (AI_PROVIDER, AI_MODEL) enabling Bedrock's bedrock-converse-stream API via IAM role credentials. - Add shared provider-config module with validation and defaults - Lambda path: conditional SSM skip, Bedrock discovery, parameterized provider/api/model - Fargate path: Bedrock LLM config, discovery, AWS_PROFILE workaround - CDK: Bedrock IAM permissions (always provisioned), conditional Anthropic secret - Document AI_PROVIDER and AI_MODEL in .env.example
…very - resolveBedrockModel() derives CRIS prefix from AWS_REGION at runtime: eu-* → eu., us-*/ca-* → us., ap-* → apac., unknown → no prefix - bedrockDiscovery always disabled in Lambda config init — model selection is explicit; dynamic discovery caused wrong provider path errors (anthropic/ prefix on Bedrock CRIS profile IDs) - 27 new unit tests covering resolveCrisPrefix, resolveBedrockModel, resolveProviderConfig for all region groups and AI_MODEL override - docs: deployment.md + CLAUDE.md updated to reflect CRIS resolution Fixes: Unknown model: anthropic/eu.anthropic.claude-sonnet-4-20250514-v1:0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…el.primary OpenClaw v2026.2.13 does not have a top-level 'llm' key. Set the model via agents.defaults.model.primary in provider/model format, delete any legacy llm section, and disable bedrockDiscovery to avoid ~56s startup scan. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Adds
AI_PROVIDERenvironment variable (anthropic|bedrock, defaultanthropic) enabling Amazon Bedrock as an alternative AI backend — no API key required, uses IAM role credentials.Changes
Shared
packages/shared/src/provider-config.ts—resolveProviderConfig()validates and defaults provider/model,resolveBedrockModel()derives the correct Bedrock CRIS model ID fromAWS_REGION(eu/us/apac geographic prefixes)Lambda path (
packages/lambda-agent/)config-init.ts: conditional SSM skip, disablebedrockDiscovery(model selection is explicit), parameterised provider/api/modelagent-runner.ts: wire provider config into the agenthandler.ts: pass AI_PROVIDER and AI_MODEL from envFargate path (
packages/container/)patch-config.ts: inject Bedrock LLM config, disable discovery, add AWS_PROFILE workaroundCDK (
packages/cdk/)secrets-stack.ts: skipAnthropicApiKeySSM param whenAI_PROVIDER=bedrockcompute-stack.ts,lambda-agent-stack.ts: provisionbedrock:InvokeModelIAM permissions (always, to avoid drift on switch).env.example: documentAI_PROVIDERandAI_MODELDocs & tests — 27 new unit tests for
resolveProviderConfigandresolveBedrockModel;docs/deployment.md§10 AI Provider Configuration guide;CLAUDE.mdupdated.Test plan
🤖 Generated with Claude Code