

# Permissions for evaluations

An evaluation runs with the caller’s identity from start to finish. When you call `StartEvaluation`, AWS Context checks most of the permissions that the run uses, and returns an `AccessDeniedException` that names the permissions to grant. It doesn’t check `bedrock-agentcore:StartBatchEvaluation`, because that call starts a batch evaluation. It also doesn’t check `context:SearchAgentContext`, `context:TraverseAgentContext`, or the caller’s access to your sources. When a check fails, no evaluation is created.

The caller needs the following permissions:
+  `context:StartEvaluation` and `context:AgenticRetrieve` on the Agent Context. Each scenario is an agentic retrieval made as the caller, so after a revocation of `context:AgenticRetrieve` takes effect, which can take a few minutes, the evaluation fails at its next scenario.
+  `context:SearchAgentContext` and `context:TraverseAgentContext` on the Agent Context. Agentic retrieval searches and traverses the Agent Context as the caller. Without these actions, its searches are refused and the scores drop.
+  `context:GetEvaluation` and `context:DeleteEvaluation` on the evaluation, and `context:ListEvaluations` on the Agent Context.
+  `logs:CreateLogGroup`, `logs:CreateLogStream`, and `logs:PutLogEvents` on the sessions log group, for every evaluation.
+ With evaluators selected, the permissions that Amazon Bedrock AgentCore batch evaluation uses. These are `bedrock-agentcore:StartBatchEvaluation`, `bedrock-agentcore:GetBatchEvaluation`, and `logs:DescribeLogGroups`. They also include `logs:StartQuery` and `logs:GetQueryResults` on the sessions log group. On the results log group, they include `logs:CreateLogGroup`, `logs:CreateLogStream`, `logs:PutLogEvents`, and `logs:PutRetentionPolicy`.
+  `logs:FilterLogEvents` on both log groups, so the console can show each scenario’s answer and scores. Without it, the console shows no results for individual scenarios.

The following example policy grants these permissions for one Agent Context. You need the `QuerySessions`, `WriteEvaluationResults`, `DescribeLogGroups`, and batch evaluation statements only with evaluators. The `ConsoleReadLogs` statement lets the console show each scenario’s results.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "StartAndListEvaluations",
      "Effect": "Allow",
      "Action": [
        "context:StartEvaluation",
        "context:AgenticRetrieve",
        "context:SearchAgentContext",
        "context:TraverseAgentContext",
        "context:ListEvaluations"
      ],
      "Resource": "arn:aws:context:us-east-1:111122223333:agent-context/ac-1234567890abcdef"
    },
    {
      "Sid": "ReadAndDeleteEvaluations",
      "Effect": "Allow",
      "Action": [
        "context:GetEvaluation",
        "context:DeleteEvaluation"
      ],
      "Resource": "arn:aws:context:us-east-1:111122223333:agent-context/ac-1234567890abcdef/evaluation/*"
    },
    {
      "Sid": "WriteSessions",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": [
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/context/evaluations/sessions/default",
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/context/evaluations/sessions/default:*"
      ]
    },
    {
      "Sid": "QuerySessions",
      "Effect": "Allow",
      "Action": [
        "logs:StartQuery",
        "logs:GetQueryResults"
      ],
      "Resource": [
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/context/evaluations/sessions/default",
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/context/evaluations/sessions/default:*"
      ]
    },
    {
      "Sid": "WriteEvaluationResults",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents",
        "logs:PutRetentionPolicy"
      ],
      "Resource": [
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/bedrock-agentcore/evaluations/batch-evaluations/results/default",
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/bedrock-agentcore/evaluations/batch-evaluations/results/default:*"
      ]
    },
    {
      "Sid": "ConsoleReadLogs",
      "Effect": "Allow",
      "Action": "logs:FilterLogEvents",
      "Resource": [
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/context/evaluations/sessions/default",
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/context/evaluations/sessions/default:*",
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/bedrock-agentcore/evaluations/batch-evaluations/results/default",
        "arn:aws:logs:us-east-1:111122223333:log-group:/aws/bedrock-agentcore/evaluations/batch-evaluations/results/default:*"
      ]
    },
    {
      "Sid": "DescribeLogGroups",
      "Effect": "Allow",
      "Action": "logs:DescribeLogGroups",
      "Resource": "*"
    },
    {
      "Sid": "StartBatchEvaluation",
      "Effect": "Allow",
      "Action": "bedrock-agentcore:StartBatchEvaluation",
      "Resource": "*"
    },
    {
      "Sid": "ReadBatchEvaluations",
      "Effect": "Allow",
      "Action": "bedrock-agentcore:GetBatchEvaluation",
      "Resource": "arn:aws:bedrock-agentcore:us-east-1:111122223333:batch-evaluate/*"
    }
  ]
}
```

Replace the Region `us-east-1`, the account ID `111122223333`, and the Agent Context ID `ac-1234567890abcdef` with your own values.

When a caller starts an evaluation, AWS Context creates the sessions log group if it doesn’t exist. With evaluators selected, it also creates the results log group if it doesn’t exist, and one log stream in it to check the caller’s access. If AWS Context creates the Amazon Bedrock AgentCore results log group, `/aws/bedrock-agentcore/evaluations/batch-evaluations/results/default`, it sets a 30-day retention period on that log group. If an account-level retention policy applies to the log group, that policy’s retention applies instead.

The policy grants `bedrock-agentcore:StartBatchEvaluation` on `*`. For the permissions that Amazon Bedrock AgentCore batch evaluation needs, see [Prerequisites](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/batch-evaluations-prereqs.html) in the *Amazon Bedrock AgentCore Developer Guide*.

The retrieval itself also reads your sources as the caller. If a connection has no data access role, the caller needs permission to read that source, as for any agentic retrieval. For more information, see [How access controls apply when AWS Context queries data](how-access-controls-apply-when-aws-context-queries-data.md).