-
Notifications
You must be signed in to change notification settings - Fork 11
Open
@jpshackelford
Description
Problem
Users trying to use the OpenHands Software Agent SDK with AWS Bedrock models (like Claude) often find it tricky to configure. The current documentation doesn't have a dedicated Bedrock guide, and users need to piece together information from the LiteLLM docs.
Common pain points:
- Not knowing that
boto3is required (but doesn't need to be imported in user code) - Confusion about the
bedrock/model prefix format - Understanding which AWS authentication methods are supported
- Finding the correct Bedrock model IDs
Suggestion
Add a Bedrock-specific guide to the LLM provider documentation, similar to the existing guides for Azure, Google, OpenRouter, etc.
Draft Tutorial
I've created a draft HTML tutorial that covers:
- Prerequisites and boto3 installation
- AWS credential configuration (multiple auth methods)
- Bedrock model name format
- Complete working code example
- Environment variable configuration
The key content that should be documented:
Installation
pip install openhands-sdk boto3>=1.28.57Note: boto3 is used internally by LiteLLM - users don't need to import it in their code.
Authentication Options
| Method | Environment Variables |
|---|---|
| Access Keys | AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY |
| Session Token | AWS_SESSION_TOKEN |
| AWS Profile | AWS_PROFILE_NAME |
| IAM Role | AWS_ROLE_NAME, AWS_WEB_IDENTITY_TOKEN |
| Bedrock API Key | AWS_BEARER_TOKEN_BEDROCK |
Model Names
Use the bedrock/ prefix followed by the Bedrock model ID:
bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0bedrock/anthropic.claude-3-opus-20240229-v1:0bedrock/anthropic.claude-3-haiku-20240307-v1:0
Example Code
import os from openhands.sdk import LLM, Agent, Conversation, Tool from openhands.tools.terminal import TerminalTool from openhands.tools.file_editor import FileEditorTool os.environ["AWS_ACCESS_KEY_ID"] = "your-access-key" os.environ["AWS_SECRET_ACCESS_KEY"] = "your-secret-key" os.environ["AWS_REGION_NAME"] = "us-east-1" llm = LLM( model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0", ) agent = Agent( llm=llm, tools=[ Tool(name=TerminalTool.name), Tool(name=FileEditorTool.name), ], ) conversation = Conversation(agent=agent, workspace=os.getcwd()) conversation.send_message("Your task here") conversation.run()
Happy to help with a PR if this would be useful!