Skip to main content

Module bedrock

Module bedrock 

Source
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§

BedrockGuardrailConfig
Bedrock guardrail configuration (BedrockGuardrailConfig).
BedrockGuardrailConfigBuilder
Use builder syntax to set the inputs and finish with build().
BedrockGuardrailRedactionConfig
Whether and how content a guardrail blocked is replaced (BedrockGuardrailRedactionConfig).
BedrockGuardrailRedactionConfigBuilder
Use builder syntax to set the inputs and finish with build().
BedrockModel
The Amazon Bedrock model provider (BedrockModel), on the Converse and ConverseStream APIs.
BedrockModelConfig
Configuration of a BedrockModel (BedrockModelConfig): the BaseModelConfig fields plus the Bedrock knobs.
BedrockModelConfigBuilder
Use builder syntax to set the inputs and finish with build().
BedrockModelOptions
Options for creating a BedrockModel (BedrockModelOptions): the BedrockModelConfig fields plus how the AWS client is built.
BedrockModelOptionsBuilder
Use builder syntax to set the inputs and finish with build_options().
Credentials
AWS SDK Credentials
SdkConfig
AWS Shared Configuration
SharedCredentialsProvider
Credentials Provider wrapper that may be shared

Enums§

BedrockGuardrailStreamProcessingMode
Guardrail stream processing mode (BedrockGuardrailConfig.streamProcessingMode).
BedrockGuardrailTrace
Guardrail trace mode (BedrockGuardrailConfig.trace).
IncludeToolResultStatus
Whether tool results carry their status field.

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§

BedrockCacheConfig
Prompt-caching configuration for the Bedrock provider (BedrockCacheConfig).
BedrockCacheTtl
TTL of a Bedrock prompt-cache checkpoint (BedrockCacheTTL), such as "5m" or "1h".