Trace analysis role
AWS Context evaluates the learnings that it extracts from your traces before it proposes them. To evaluate a learning, AWS Context runs retrieval on your Agent Context, and that requires an IAM role that it can assume: the trace analysis role. AWS Context reads the data behind the Agent Context with the role’s permissions, so the role decides which data trace analysis can read. Trace analysis runs without a caller, so it has no caller’s credentials to use. It doesn’t use a connection’s data access role either.
Without a role that AWS Context can use, learnings are proposed unverified. For more information, see How trace analysis evaluates learnings.
You must set a trace analysis role to turn on trace analysis. The role must meet these requirements:
-
The role is in the same AWS account as the Agent Context.
-
The role’s trust policy allows the AWS Context service principal,
context.amazonaws.com, to assume the role. -
The principal that sets the role on the Agent Context has the
iam:PassRolepermission for the role.
The following trust policy lets AWS Context assume the role for one Agent Context only.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowAWSContextToAssumeRole", "Effect": "Allow", "Principal": { "Service": "context.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" }, "ArnLike": { "aws:SourceArn": "arn:aws:context:us-east-1:111122223333:agent-context/ac-EXAMPLE11111" } } } ] }
Replace the Region us-east-1, the account ID 111122223333, and the Agent Context ID ac-EXAMPLE11111 with your own values.
The following permissions policy lets the role run retrieval on the Agent Context.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "RetrieveFromAgentContext", "Effect": "Allow", "Action": [ "context:SearchAgentContext", "context:TraverseAgentContext", "context:AgenticRetrieve" ], "Resource": "arn:aws:context:us-east-1:111122223333:agent-context/ac-EXAMPLE11111" } ] }
Replace the same values as in the trust policy.
The role also needs read access to the data that the Agent Context’s connections reach. Grant the role the same read permissions that a data access role for each connection needs:
-
AWS Glue Data Catalog connections – See Data access role.
-
Amazon Bedrock knowledge base connections – See the permissions for queries in Connect a managed knowledge base to AWS Context.