Skip to content

Commit c406f94

Browse files
committed
Restore AWS Bedrock setup path to README
The published agents-langgraph.mdx is API-key-only and never documented the Bedrock SSO path the repo code supports. Re-add the Option A/B provider setup and Bedrock inference-profile guidance to the repo README (docs mdx intentionally left unchanged), using current model IDs.
1 parent 81796b2 commit c406f94

1 file changed

Lines changed: 103 additions & 3 deletions

File tree

README.md

Lines changed: 103 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,17 @@ You'll need:
6969

7070
- **Python 3.9+** with `uv` package manager ([install uv](https://docs.astral.sh/uv/getting-started/installation/))
7171
- **LaunchDarkly account** ([sign up for free](https://app.launchdarkly.com/signup))
72+
73+
**Choose your AI provider setup:**
74+
75+
**Option A: AWS Bedrock (Recommended)**
76+
- **AWS Account** with Bedrock access and SSO configured
77+
- **No API keys required** - uses AWS SSO authentication
78+
- **Cost-effective** - enterprise-grade with cross-region failover
79+
80+
**Option B: Direct API Keys (Traditional)**
7281
- **OpenAI API key** (required for RAG architecture embeddings)
73-
- **Anthropic API key** (required for Claude models) or **OpenAI API key** (for GPT models)
82+
- **Anthropic API key** (for Claude models) or **OpenAI API key** (for GPT models)
7483

7584
## Step 1: Clone and Configure (2 minutes)
7685

@@ -139,15 +148,106 @@ First, you need to get your LaunchDarkly SDK key by creating a project:
139148

140149
</div>
141150

142-
Now edit `.env` with your keys:
151+
Now configure your authentication method in `.env`:
152+
153+
### Option A: AWS Bedrock Setup (Recommended)
154+
143155
```bash
156+
# LaunchDarkly Configuration
144157
LD_SDK_KEY=your-launchdarkly-sdk-key # From step above
158+
159+
# AWS Bedrock Configuration
160+
AUTH_METHOD=sso # Use AWS SSO authentication
161+
AWS_REGION=us-east-1 # Your AWS region
162+
AWS_PROFILE=your-sso-profile-name # Your AWS SSO profile name
163+
164+
# Optional: Bedrock Embedding Configuration
165+
BEDROCK_EMBEDDING_DIMENSIONS=1024 # Options: 256, 512, 1024
166+
BEDROCK_EMBEDDING_MODEL=amazon.titan-embed-text-v2:0
167+
```
168+
169+
**Then configure AWS SSO:**
170+
```bash
171+
# Configure AWS SSO (one-time setup)
172+
aws configure sso --profile your-sso-profile-name
173+
174+
# Login to AWS SSO (run when token expires)
175+
aws sso login --profile your-sso-profile-name
176+
177+
# Test your access
178+
aws bedrock list-foundation-models --region us-east-1 --profile your-sso-profile-name
179+
```
180+
181+
### Option B: Direct API Keys Setup
182+
183+
```bash
184+
# LaunchDarkly Configuration
185+
LD_SDK_KEY=your-launchdarkly-sdk-key # From step above
186+
187+
# Direct API Configuration
188+
AUTH_METHOD=api-key # Use direct API keys (default)
145189
OPENAI_API_KEY=your-openai-key # Required for RAG embeddings
146190
ANTHROPIC_API_KEY=your-anthropic-key # Required for Claude models
147191
```
148192

149193
This sets up a **LangGraph** application that uses LaunchDarkly to control AI behavior. Think of it like swapping actors, directors, even props mid-performance without stopping the show.
150-
Do not check the `.env` into your source control. Keep those secrets safe!
194+
195+
**Security Note:** Do not check the `.env` into your source control. Keep those secrets safe!
196+
197+
### 🚨 **Common AWS SSO Issue:**
198+
199+
If you get `AccessDeniedException` errors, verify your Python code is using the correct AWS profile:
200+
201+
```bash
202+
# Check which AWS account your profile uses
203+
aws sts get-caller-identity --profile your-sso-profile-name
204+
205+
# If the account numbers don't match your error message, add AWS_PROFILE to your .env
206+
```
207+
208+
**The error message will show the account number your Python code is using.** Make sure it matches your SSO profile account.
209+
210+
### 🚨 **Bedrock Model ID Requirements:**
211+
212+
When configuring AI models in LaunchDarkly for Bedrock, you should use **inference profile IDs** (with region prefix):
213+
214+
**✅ BEST PRACTICE - Inference Profile IDs (with region prefix):**
215+
```
216+
us.anthropic.claude-sonnet-4-6-v2:0
217+
us.anthropic.claude-3-7-sonnet-20250219-v1:0
218+
eu.anthropic.claude-haiku-4-5-20251001-v2:0
219+
```
220+
221+
**⚠️ AUTO-CORRECTED - Direct Model IDs (will be fixed automatically):**
222+
```
223+
anthropic.claude-3-7-sonnet-20250219-v1:0 → us.anthropic.claude-3-7-sonnet-20250219-v1:0
224+
anthropic.claude-sonnet-4-6-v2:0 → us.anthropic.claude-sonnet-4-6-v2:0
225+
```
226+
227+
**How Auto-Correction Works:**
228+
229+
The system automatically converts direct model IDs to inference profile IDs to prevent `ValidationException` errors from Bedrock. The region prefix is determined by:
230+
231+
1. **`BEDROCK_INFERENCE_REGION`** env var (if set) - explicit user preference
232+
2. **`AWS_REGION`** env var (e.g., `us-east-1``us` prefix) - automatic detection
233+
3. **Default to `us`** if neither is set
234+
235+
**Configuring Region Prefix:**
236+
237+
To use European inference profiles, add to your `.env`:
238+
```bash
239+
BEDROCK_INFERENCE_REGION=eu # Force EU inference profiles
240+
```
241+
242+
**Finding Available Inference Profiles:**
243+
```bash
244+
# List available Bedrock inference profiles
245+
aws bedrock list-inference-profiles --region us-east-1 --profile your-sso-profile-name
246+
```
247+
248+
**Why Inference Profiles?**
249+
250+
Bedrock requires inference profile IDs for on-demand throughput. The region prefix (`us.`, `eu.`, `ap.`, etc.) enables cross-region inference profiles for better availability and failover.
151251

152252
## Step 2: Add Your Business Knowledge (2 minutes)
153253

0 commit comments

Comments
 (0)