File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,21 @@ def __init__(
112
112
session = boto_session or boto3 .Session (
113
113
region_name = region_name or os .getenv ("AWS_REGION" ) or "us-west-2" ,
114
114
)
115
- client_config = boto_client_config or BotocoreConfig (user_agent_extra = "strands-agents" )
115
+
116
+ # Add strands-agents to the request user agent
117
+ if boto_client_config :
118
+ existing_user_agent = getattr (boto_client_config , "user_agent_extra" , None )
119
+
120
+ # Append 'strands-agents' to existing user_agent_extra or set it if not present
121
+ if existing_user_agent :
122
+ new_user_agent = f"{ existing_user_agent } strands-agents"
123
+ else :
124
+ new_user_agent = "strands-agents"
125
+
126
+ client_config = boto_client_config .merge (BotocoreConfig (user_agent_extra = new_user_agent ))
127
+ else :
128
+ client_config = BotocoreConfig (user_agent_extra = "strands-agents" )
129
+
116
130
self .client = session .client (
117
131
service_name = "bedrock-runtime" ,
118
132
config = client_config ,
You can’t perform that action at this time.
0 commit comments