Expand description
The Amazon Bedrock model provider, behind the bedrock feature (on by default).
BedrockModel talks to the Bedrock Converse and ConverseStream APIs through the AWS SDK for
Rust. Requests are built in the Converse JSON shape and converted to the AWS SDK types only at the
transport boundary.
An agent on a Bedrock model, with credentials and region from the AWS default chain:
use strands::Agent;
use strands::models::bedrock::BedrockModel;
let model = BedrockModel::builder()
.model_id("global.anthropic.claude-sonnet-4-6")
.max_tokens(4096)
.build();
let mut agent = Agent::builder().model(model).build()?;
let result = agent.invoke("Why is the sky blue?").await?;
println!("{result}");Structs§
- Bedrock
Guardrail Config - Bedrock guardrail configuration (
BedrockGuardrailConfig). - Bedrock
Guardrail Config Builder - Use builder syntax to set the inputs and finish with
build(). - Bedrock
Guardrail Redaction Config - Whether and how content a guardrail blocked is replaced (
BedrockGuardrailRedactionConfig). - Bedrock
Guardrail Redaction Config Builder - Use builder syntax to set the inputs and finish with
build(). - Bedrock
Model - The Amazon Bedrock model provider (
BedrockModel), on the Converse and ConverseStream APIs. - Bedrock
Model Config - Configuration of a
BedrockModel(BedrockModelConfig): theBaseModelConfigfields plus the Bedrock knobs. - Bedrock
Model Config Builder - Use builder syntax to set the inputs and finish with
build(). - Bedrock
Model Options - Options for creating a
BedrockModel(BedrockModelOptions): theBedrockModelConfigfields plus how the AWS client is built. - Bedrock
Model Options Builder - Use builder syntax to set the inputs and finish with
build_options(). - Credentials
- AWS SDK Credentials
- SdkConfig
- AWS Shared Configuration
- Shared
Credentials Provider - Credentials Provider wrapper that may be shared
Enums§
- Bedrock
Guardrail Stream Processing Mode - Guardrail stream processing mode (
BedrockGuardrailConfig.streamProcessingMode). - Bedrock
Guardrail Trace - Guardrail trace mode (
BedrockGuardrailConfig.trace). - Include
Tool Result Status - Whether tool results carry their
statusfield.
Constants§
- DEFAULT_
REQUEST_ TIMEOUT - Default per-attempt and stream inactivity timeout (
DEFAULT_REQUEST_TIMEOUT_MS). The AWS SDK has none, so a stuck connection would otherwise hang forever.
Type Aliases§
- Bedrock
Cache Config - Prompt-caching configuration for the Bedrock provider (
BedrockCacheConfig). - Bedrock
Cache Ttl - TTL of a Bedrock prompt-cache checkpoint (
BedrockCacheTTL), such as"5m"or"1h".