Overview
AWSBedrockLLMService provides access to Amazon’s foundation models including Anthropic Claude and Amazon Nova, with streaming responses, function calling, and multimodal capabilities through Amazon’s managed AI service for enterprise-grade LLM deployment.
AWS Bedrock LLM API Reference
Pipecat’s API methods for AWS Bedrock integration
Example Implementation
Complete example with function calling
AWS Bedrock Documentation
Official AWS Bedrock documentation and features
AWS Console
Access foundation models and manage IAM
Installation
To use AWS Bedrock services, install the required dependencies:Prerequisites
AWS Account Setup
Before using AWS Bedrock LLM services, you need:- AWS Account: Sign up at AWS Console
- IAM User: Create an IAM user with Amazon Bedrock permissions
- Model Access: Request access to foundation models in your AWS region
- Credentials: Set up AWS access keys and region configuration
Required Environment Variables
AWS_ACCESS_KEY_ID: Your AWS access key IDAWS_SECRET_ACCESS_KEY: Your AWS secret access keyAWS_SESSION_TOKEN: Session token (if using temporary credentials)AWS_REGION: AWS region (defaults to “us-east-1”)
Configuration
str
default:"None"
deprecated
AWS Bedrock model identifier (e.g.,
"us.anthropic.claude-sonnet-4-5-20250929-v1:0",
"us.amazon.nova-pro-v1:0"). Deprecated in v0.0.105. Use
settings=AWSBedrockLLMService.Settings(...) instead.str
default:"None"
AWS access key ID. If
None, falls back to environment variables and the
default botocore credential chain (instance profiles, IRSA, ECS task roles,
SSO, etc.).str
default:"None"
AWS secret access key. Same fallback behaviour as
aws_access_key.str
default:"None"
AWS session token for temporary credentials.
str
default:"None"
AWS region for the Bedrock service. If
None, uses the AWS_REGION
environment variable, defaulting to "us-east-1".AWSBedrockLLMService.Settings
default:"None"
Runtime-configurable model settings. See Settings below.
InputParams
default:"None"
deprecated
Runtime-configurable model settings. See Settings below.
Deprecated in v0.0.105. Use
settings=AWSBedrockLLMService.Settings(...)
instead.List[str]
default:"None"
deprecated
List of strings that stop generation when encountered. Deprecated in
v0.0.105. Use
settings=AWSBedrockLLMService.Settings(stop_sequences=...)
instead.botocore.config.Config
default:"None"
Custom botocore client configuration. If
None, uses defaults with 5-minute
connect/read timeouts and 3 retry attempts.float
default:"5.0"
Request timeout in seconds. Used when
retry_on_timeout is enabled to
determine when to retry.bool
default:"False"
Whether to retry the request once if it times out. The retry attempt has no
timeout limit.
Settings
Runtime-configurable settings passed via thesettings constructor argument using AWSBedrockLLMService.Settings(...). These can be updated mid-conversation with LLMUpdateSettingsFrame. See Service Settings for details.
NOT_GIVEN values are omitted from the inference config, letting the Bedrock
API use its own defaults. Only parameters that are explicitly set are included
in the request. This avoids conflicts with models that don’t allow certain
parameter combinations (e.g., temperature and top_p together).Usage
Basic Setup
With Custom Settings
Updating Settings at Runtime
Model settings can be changed mid-conversation usingLLMUpdateSettingsFrame:
Notes
- Credential resolution: Credentials are resolved via a fallback chain: explicit parameters → environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) → botocore credential provider chain (instance profiles, IRSA, ECS task roles, SSO, credential files). Services running with IAM roles no longer need to export static credentials. - No-op tool handling: AWS Bedrock requires at least one tool to be defined when tool content exists in the conversation. The service automatically adds a placeholder tool when needed to prevent API errors.
- Model-specific parameters: Some models (e.g., Claude Sonnet 4.5) don’t allow certain parameter combinations. The service only includes explicitly set parameters in the inference config to avoid conflicts.
- Retry behavior: When
retry_on_timeout=True, the first attempt uses theretry_timeout_secstimeout. If it times out, a second attempt is made with no timeout limit. - System instruction precedence: If both
system_instruction(from the constructor) and a system message in the context are set, the constructor’ssystem_instructiontakes precedence and a warning is logged.
Event Handlers
AWSBedrockLLMService supports the following event handlers, inherited from LLMService: