Skip to content

Commit fc2cfa9

Browse files
committed
Add VPC endpoint support to BedrockModel class - Add optional endpoint_url parameter to BedrockModel constructor - Pass endpoint_url to boto3 client for VPC endpoint connectivity - Maintains backward compatibility with existing code Resolves: Issue strands-agents#496
1 parent 9faadbf commit fc2cfa9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/strands/models/bedrock.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class BedrockConfig(TypedDict, total=False):
7272
streaming: Flag to enable/disable streaming. Defaults to True.
7373
temperature: Controls randomness in generation (higher = more random)
7474
top_p: Controls diversity via nucleus sampling (alternative to temperature)
75+
endpoint_url: Custom endpoint URL for VPC endpoints (PrivateLink)
7576
"""
7677

7778
additional_args: Optional[dict[str, Any]]
@@ -93,6 +94,7 @@ class BedrockConfig(TypedDict, total=False):
9394
streaming: Optional[bool]
9495
temperature: Optional[float]
9596
top_p: Optional[float]
97+
endpoint_url: Optional[str] #Adding Endpoint URL
9698

9799
def __init__(
98100
self,
@@ -110,6 +112,7 @@ def __init__(
110112
region_name: AWS region to use for the Bedrock service.
111113
Defaults to the AWS_REGION environment variable if set, or "us-west-2" if not set.
112114
**model_config: Configuration options for the Bedrock model.
115+
Use endpoint_url for VPC endpoint connectivity.
113116
"""
114117
if region_name and boto_session:
115118
raise ValueError("Cannot specify both `region_name` and `boto_session`.")
@@ -140,6 +143,7 @@ def __init__(
140143
self.client = session.client(
141144
service_name="bedrock-runtime",
142145
config=client_config,
146+
endpoint_url=self.config.get("endpoint_url"),
143147
region_name=resolved_region,
144148
)
145149

0 commit comments

Comments
 (0)