View a markdown version of this page

Viewing AI agent activity in AWS Assurance - AWS Assurance

Viewing AI agent activity in AWS Assurance

With AWS Assurance, you can audit what your AI agents on Amazon Bedrock AgentCore Runtime (AgentCore Runtime) do in AWS. For each agent runtime in your environment, you can see which services and API actions it called, which resources it read from or wrote to, how many calls succeeded and failed, and in which sessions. You don’t need to search raw API logs to find an agent’s calls.

For example, you can verify that an agent only reads the resources that it’s meant to, or find which session made an unexpected change to a resource.

AWS Assurance processes the calls every hour. A call appears after AWS Assurance processes the hour in which the agent made it. Activity is kept for 7 days. You can view the activity in the AWS Assurance web application or query it with the API.

Note
  • Agent activity is available only for agent runtimes on AgentCore Runtime version 2.

  • Agent activity isn’t supported in opt-in Regions, the AWS Regions that are disabled by default.

  • You can view the activity of agent runtimes in other accounts. For which calls you see, see What agent activity shows.

What agent activity shows

You can view an agent’s activity in three groupings:

  • API actions – For each AWS service and API action that the agent called, the number of calls that succeeded and failed. The total number of calls is the sum of these entries.

  • Resources – For each resource that the agent’s calls named, the number of calls that succeeded and failed, and whether the agent only read the resource (Read) or made at least one call that could change it (Write). For how AWS Assurance tells them apart, see How AWS Assurance identifies reads and writes. Some API actions, such as list and describe actions, don’t name a resource, so their calls appear under API actions only. A call that names several resources counts once for each of them, so don’t add the resource counts to the API action counts.

  • Sessions – The agent sessions in which the calls were made.

The activity that you see is scoped to the project:

  • Resources – If the project has resource filters, AWS Assurance shows only the resources that match them. For more information about project scope, see Managing environments and projects.

  • Agents in another account – You can view the activity of an agent runtime in any account. When the environment covers the agent runtime’s account, you see all of the agent’s activity, including its calls into other accounts. When it doesn’t, you see only the calls that the agent made into the environment’s own account. An organization environment covers the accounts in the organization, limited to the environment’s organizational units (OUs) when it has any. Any other environment covers the accounts that you connected with an accepted invitation. For more information, see Organizations and Cross-account assessments.

How AWS Assurance identifies reads and writes

Agent activity includes the agent’s management events, the calls that manage resources in your AWS account. It doesn’t include data events, such as Amazon S3 object-level calls. AWS Assurance takes the access of each call from AWS CloudTrail, which records in the readOnly field of each event whether the API action only reads. For more information, see CloudTrail record contents in the AWS CloudTrail User Guide.

  • Read – The call reads resources without changing them. These are typically actions that describe, list, or get, such as DescribeFileSystems, ListBuckets, and GetCallerIdentity.

  • Write – The call creates, changes, or deletes resources, or might change them. These are typically actions that create, update, put, or delete, and actions such as start, stop, and run. Examples are CreateLogStream, UpdateTrail, PutBucketPolicy, and DeleteApplication. A call whose event doesn’t record whether it’s read-only also counts as a write.

A resource’s access covers every call that named it in the time range. The resource is Write if at least one of those calls was a write, and Read otherwise.

Required permissions

To view agent activity, you need the assurance:StartResourceActivitiesQuery and assurance:GetResourceActivitiesQueryResults actions. Both actions use the environment as the resource.

If you sign in to the web application with AWS IAM Identity Center, your permission set must also grant permission to view assessments. For more information, see Identity and access management for AWS Assurance.

View agent activity in the web application

To view an agent’s activity for a day
  1. In the AWS Assurance web application, in the navigation pane, under Compliance Readiness, choose the Resources tab.

  2. Choose the agent runtime.

  3. Under Agent activity, review the agent’s calls for the selected day, in Coordinated Universal Time (UTC). The Agent calls graph shows each service that the agent called, whether it read, wrote, or both, and how many calls and resources it had. To list the same services in a table, choose Table. To show only the services that the agent read from or wrote to, choose Read, Write, or Read and write.

To view an agent’s activity for the last 7 days
  1. On the agent runtime’s page, choose View agent activity.

  2. Review the totals for the last 7 UTC days, and then choose a tab:

    • Resources – The resources that the agent read from or wrote to.

    • AWS API calls – The API actions that the agent called.

    • Sessions – The agent’s sessions, with their calls and the resources that each session read from or wrote to.

  3. To narrow the results, choose a session, or show only failed calls.

Query agent activity with the API

Querying agent activity takes two operations. StartResourceActivitiesQuery starts a query and returns a query ID. GetResourceActivitiesQueryResults returns the status of the query and one page of its results. Both operations require the Amazon Resource Name (ARN) of the environment and the project.

Start a query

The following AWS Command Line Interface (AWS CLI) example starts a query. Specify the ARN of the agent runtime, and optionally a time range, the groupings to return, and a session filter. Replace <region>, <account-id>, <environment-id>, <project-name>, and <runtime-id> with your own values.

aws assurance start-resource-activities-query \ --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \ --project <project-name> \ --actor-arn arn:aws:bedrock-agentcore:<region>:<account-id>:runtime/<runtime-id> \ --start-time 2026-11-18T00:00:00Z \ --end-time 2026-11-19T00:00:00Z \ --aggregation-levels ACTION RESOURCE SESSION
  • startTime and endTime – The time range to query. The start time must be within the last 7 days and can’t be in the future, the end time must be later than the start time, and the range can’t be longer than 7 days. If you omit the end time, it’s the time of the request. If you omit the start time, it’s 24 hours before the end time.

  • aggregationLevels – The groupings to return: ACTION, RESOURCE, SESSION, or any combination. If you omit it, the results include every grouping.

  • filters – To return only the activity of specific sessions, specify a filter with the name sessionId and up to 20 session IDs. You can specify up to 5 filters.

The response contains the query ID.

{ "queryId": "AbCdEf0123456789-EXAMPLE" }

The query ID is valid for 24 hours. It doesn’t give access to the results: AWS Assurance checks your permissions again each time you call GetResourceActivitiesQueryResults.

Get the results

The following AWS CLI example gets the results. Pass the query ID with the same environment ARN and project that you used to start the query.

aws assurance get-resource-activities-query-results \ --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \ --project <project-name> \ --query-id AbCdEf0123456789-EXAMPLE
{ "status": "COMPLETE", "entries": [ { "actionDetail": { "service": "dynamodb.amazonaws.com", "api": "UpdateTable", "successCount": 12, "failureCount": 1 } }, { "resourceDetail": { "resourceType": "AWS::DynamoDB::Table", "arn": "arn:aws:dynamodb:us-east-1:111122223333:table/example-table", "accessType": "WRITE", "successCount": 12, "failureCount": 1 } }, { "sessionDetail": { "sessionId": "example-session-id" } } ] }

The response includes the following fields:

  • status – COMPLETE when the results are available. EXPIRED when the query ID is more than 24 hours old; start a new query.

  • entries – One page of results. Each entry has one of actionDetail, resourceDetail, or sessionDetail, in the order of the groupings that you requested.

    • actionDetail – One API action: the service endpoint, the api name, and the successCount and failureCount of its calls.

    • resourceDetail – One resource: its arn, its resourceType when known, its accessType (READ when the agent only read it, WRITE when at least one call could change it), and the successCount and failureCount of the calls that named it.

    • sessionDetail – One agent session, by its sessionId.

  • nextToken – Present when more results are available. To get the next page, call the operation again with this token. To set the page size, use maxResults, from 1 to 1,000. The default is 50.

Errors

Besides the common errors, such as ThrottlingException and InternalServerException, the operations can return the following errors:

  • AccessDeniedException – You don’t have the required permissions, or the query ID wasn’t issued to you. For more information, see Required permissions.

  • ValidationException – The time range is outside the limits, the agent runtime ARN doesn’t name an account, or the environment ARN or project doesn’t match the ones that the query was started with.

  • ResourceNotFoundException – The environment or the project doesn’t exist.