Skip to content

Add AWS Bedrock provider support - #26

Merged
pufit merged 1 commit into
mainfrom
pufit/bedrock-provider
Apr 3, 2026
Merged

pufit merged 1 commit into
mainfrom
pufit/bedrock-provider

Conversation

@pufit

@pufit pufit commented Apr 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds AWS Bedrock as a first-class LLM provider alongside direct Anthropic API
  • All 4 API call paths now support Bedrock: SDK agent sessions, memU memory ops, source condensation, and session title generation
  • On AWS (EC2/ECS/EKS), only an IAM role with bedrock:InvokeModel* is needed — zero API keys
  • Bootstrap wizard updated with Bedrock option (interactive + non-interactive via NERVE_PROVIDER=bedrock)

Changes

nerve/config.py — New ProviderConfig dataclass (type, aws_region, aws_profile, optional explicit creds). create_anthropic_client() / create_async_anthropic_client() factory methods on NerveConfig that return AnthropicBedrock or standard Anthropic based on config. New title_model field on AgentConfig.

nerve/agent/engine.py — _build_env() sets CLAUDE_CODE_USE_BEDROCK=1 + AWS env vars for the CLI subprocess. Title generation rewritten to use SDK client (removes raw httpx, uses configurable title_model).

nerve/memory/memu_bridge.py — _get_anthropic_client() delegates to config factory.

nerve/sources/runner.py + registry.py — Condense client supports provider=bedrock → AsyncAnthropicBedrock.

nerve/bootstrap.py — Option 3 (Bedrock) in wizard, _step_bedrock_setup(), Bedrock model IDs in generated config, NERVE_PROVIDER=bedrock for non-interactive/Docker setup.

Usage

# config.yaml
provider:
  type: bedrock
  aws_region: us-east-1

agent:
  model: us.anthropic.claude-opus-4-6-v1
  cron_model: us.anthropic.claude-sonnet-4-6

Test plan

  • pytest tests/ -v — 325 passed (1 pre-existing HoA failure, unrelated)
  • Verify config parsing: provider: YAML block → ProviderConfig with defaults
  • Verify _build_env() sets CLAUDE_CODE_USE_BEDROCK=1 when provider is bedrock
  • End-to-end on EC2 with IAM role + Bedrock model access

Generated by Nerve

Route Nerve through AWS Bedrock instead of direct Anthropic API.
All 4 API call paths (SDK sessions, memU, source condensation,
title generation) now support the bedrock provider via a unified
ProviderConfig and client factory methods on NerveConfig.

- Add ProviderConfig dataclass with type/aws_region/aws_profile
- Add create_anthropic_client() / create_async_anthropic_client()
  factory methods that return AnthropicBedrock when configured
- Extend _build_env() to set CLAUDE_CODE_USE_BEDROCK=1 for the
  Claude Code CLI subprocess
- Rewrite title generation to use SDK client (removes raw httpx)
- Add configurable title_model to AgentConfig
- Update bootstrap wizard with Bedrock option (interactive + non-interactive)
- Update source condensation to support bedrock provider
@pufit
pufit merged commit 10151ab into main Apr 3, 2026
@pufit
pufit deleted the pufit/bedrock-provider branch April 3, 2026 05:49
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.

1 participant