Skip to content

list_agent_contexts

list_agent_contexts(
    *,
    config_overrides: Optional[ContextClientConfig] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListAgentContextsResponse

Lists the agent contexts in your account. A page can hold fewer items than maxResults, or none, and still return a nextToken. Keep paging until nextToken is absent.

Parameters:

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

    Maximum number of results per page (upper bound, not a target). Defaults to 50 when absent. The service might return fewer items.

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

    Opaque pagination cursor from a prior response. Omit for the first page.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.

  • InternalServerException –

    The request failed because of an internal error. Retry the request.

  • ThrottlingException –

    The request was denied because it exceeded a request rate quota. Wait, then retry the request.

  • ValidationException –

    The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.

  • UnknownServiceError –

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

Examples:

List agent contexts The following example lists the agent contexts in the account.

>>> client.list_agent_contexts(max_results=10)
Source code in docs_src/capo_context/_services/context.py
def list_agent_contexts(
    self,
    *,
    config_overrides: Optional[ContextClientConfig] = None,
    max_results: Optional["capo_context.types.max_results.MaxResults"] = None,
    next_token: Optional[
        "capo_context.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_context.types.list_agent_contexts_response.ListAgentContextsResponse":
    """<p>Lists the agent contexts in your account. A page can hold fewer items than <code>maxResults</code>, or none, and still return a <code>nextToken</code>. Keep paging until <code>nextToken</code> is absent.</p>

    Args:
        max_results: <p>Maximum number of results per page (upper bound, not a target). Defaults to 50 when absent. The service might return fewer items.</p>
        next_token: <p>Opaque pagination cursor from a prior response. Omit for the first page.</p>

    Raises:
        capo_context.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.</p>
        capo_context.errors.internal_server_exception.InternalServerException: <p>The request failed because of an internal error. Retry the request.</p>
        capo_context.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded a request rate quota. Wait, then retry the request.</p>
        capo_context.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.</p>
        capo_context.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List agent contexts
        The following example lists the agent contexts in the account.

        >>> client.list_agent_contexts(max_results=10)
    """

    def _handler(
        req: "OperationRequest[capo_context.types.list_agent_contexts_request.ListAgentContextsRequest]",
    ) -> OperationResponse[
        "capo_context.types.list_agent_contexts_response.ListAgentContextsResponse"
    ]:
        import capo_context._operations.context.list_agent_contexts

        output, http_response = (
            capo_context._operations.context.list_agent_contexts.list_agent_contexts(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAgentContexts")
    )
    input_: capo_context.types.list_agent_contexts_request.ListAgentContextsRequest = {}
    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