AWS Security ChangesHomeSearch

AWS bedrock documentation change

Service: bedrock · 2025-05-13 · Documentation low

File: bedrock/latest/userguide/agents-create.md

Summary

Added a code sample demonstrating how to create an Amazon Bedrock agent with IAM role permissions.

Security assessment

The code sample illustrates general API usage and does not directly address security issues or document new security features.

Diff

diff --git a/bedrock/latest/userguide/agents-create.md b/bedrock/latest/userguide/agents-create.md
index 3fd94ace0..ff7138a4c 100644
--- a//bedrock/latest/userguide/agents-create.md
+++ b//bedrock/latest/userguide/agents-create.md
@@ -153,0 +154,31 @@ The response returns an [CreateAgent](https://docs.aws.amazon.com/bedrock/latest
+    
+        def create_agent(self, agent_name, foundation_model, role_arn, instruction):
+            """
+            Creates an agent that orchestrates interactions between foundation models,
+            data sources, software applications, user conversations, and APIs to carry
+            out tasks to help customers.
+    
+            :param agent_name: A name for the agent.
+            :param foundation_model: The foundation model to be used for orchestration by the agent.
+            :param role_arn: The ARN of the IAM role with permissions needed by the agent.
+            :param instruction: Instructions that tell the agent what it should do and how it should
+                                interact with users.
+            :return: The response from Amazon Bedrock Agents if successful, otherwise raises an exception.
+            """
+            try:
+                response = self.client.create_agent(
+                    agentName=agent_name,
+                    foundationModel=foundation_model,
+                    agentResourceRoleArn=role_arn,
+                    instruction=instruction,
+                )
+            except ClientError as e:
+                logger.error(f"Error: Couldn't create agent. Here's why: {e}")
+                raise
+            else:
+                return response["agent"]
+    
+    
+
+For more information, see [Hello Amazon Bedrock Agents](./bedrock-agent_example_bedrock-agent_Hello_section.html).
+