Skip to content

list_events

list_events(
    memory_id: MemoryId,
    session_id: SessionId,
    actor_id: ActorId,
    *,
    config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
    include_payloads: Optional[bool] = None,
    filter: Optional[FilterInput] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListEventsOutput

Lists events in an AgentCore Memory resource based on specified criteria. We recommend using pagination to ensure that the operation returns quickly and successfully.

To use this operation, you must have the bedrock-agentcore:ListEvents permission.

Parameters:

  • memory_id (MemoryId) –

    The identifier of the AgentCore Memory resource for which to list events.

  • session_id (SessionId) –

    The identifier of the session for which to list events.

  • actor_id (ActorId) –

    The identifier of the actor for which to list events.

  • include_payloads (Optional[bool], default: None ) –

    Specifies whether to include event payloads in the response. Set to true to include payloads, or false to exclude them.

  • filter (Optional[FilterInput], default: None ) –

    Filter criteria to apply when listing events.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return in a single call. The default value is 20.

  • next_token (Optional[PaginationToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Raises:

  • AccessDeniedException –

    The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.

  • InvalidInputException –

    The input fails to satisfy the constraints specified by AgentCore. Check your input values and try again.

  • ResourceNotFoundException –

    The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.

  • ServiceException –

    The service encountered an internal error. Try your request again later.

  • ServiceQuotaExceededException –

    The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.

  • ThrottledException –

    The request was denied due to request throttling. Reduce the frequency of requests and try again.

  • ValidationException –

    The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock_agentcore/_services/bedrock_agent_core.py
def list_events(
    self,
    memory_id: "capo_bedrock_agentcore.types.memory_id.MemoryId",
    session_id: "capo_bedrock_agentcore.types.session_id.SessionId",
    actor_id: "capo_bedrock_agentcore.types.actor_id.ActorId",
    *,
    config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
    include_payloads: Optional[bool] = None,
    filter: Optional[
        "capo_bedrock_agentcore.types.filter_input.FilterInput"
    ] = None,
    max_results: Optional[
        "capo_bedrock_agentcore.types.max_results.MaxResults"
    ] = None,
    next_token: Optional[
        "capo_bedrock_agentcore.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_bedrock_agentcore.types.list_events_output.ListEventsOutput":
    """<p>Lists events in an AgentCore Memory resource based on specified criteria. We recommend using pagination to ensure that the operation returns quickly and successfully.</p> <p>To use this operation, you must have the <code>bedrock-agentcore:ListEvents</code> permission.</p>

    Args:
        memory_id: <p>The identifier of the AgentCore Memory resource for which to list events.</p>
        session_id: <p>The identifier of the session for which to list events.</p>
        actor_id: <p>The identifier of the actor for which to list events.</p>
        include_payloads: <p>Specifies whether to include event payloads in the response. Set to true to include payloads, or false to exclude them.</p>
        filter: <p>Filter criteria to apply when listing events.</p>
        max_results: <p>The maximum number of results to return in a single call. The default value is 20.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>

    Raises:
        capo_bedrock_agentcore.errors.access_denied_exception.AccessDeniedException: <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p>
        capo_bedrock_agentcore.errors.invalid_input_exception.InvalidInputException: <p>The input fails to satisfy the constraints specified by AgentCore. Check your input values and try again.</p>
        capo_bedrock_agentcore.errors.resource_not_found_exception.ResourceNotFoundException: <p>The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.</p>
        capo_bedrock_agentcore.errors.service_exception.ServiceException: <p>The service encountered an internal error. Try your request again later.</p>
        capo_bedrock_agentcore.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.</p>
        capo_bedrock_agentcore.errors.throttled_exception.ThrottledException: <p>The request was denied due to request throttling. Reduce the frequency of requests and try again.</p>
        capo_bedrock_agentcore.errors.validation_exception.ValidationException: <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p>
        capo_bedrock_agentcore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock_agentcore.types.list_events_input.ListEventsInput]",
    ) -> OperationResponse[
        "capo_bedrock_agentcore.types.list_events_output.ListEventsOutput"
    ]:
        import capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.list_events

        output, http_response = (
            capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.list_events.list_events(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_bedrock_agentcore.types.list_events_output.ListEventsOutput",
    ) -> dict[str, Any]:
        import capo_bedrock_agentcore.types.list_events_output

        return capo_bedrock_agentcore.types.list_events_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListEvents", redact_output=_redact_output),
    )
    input_: capo_bedrock_agentcore.types.list_events_input.ListEventsInput = {
        "memory_id": memory_id,
        "session_id": session_id,
        "actor_id": actor_id,
    }
    if include_payloads is not None:
        input_["include_payloads"] = include_payloads
    if filter is not None:
        input_["filter"] = filter
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output