Skip to content

delete_agent_context async

delete_agent_context(
    agent_context_id: AgentContextIdentifier,
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
) -> DeleteAgentContextResponse

Deletes an agent context. Deletion is asynchronous. An agent context that does not exist or is already being deleted returns ResourceNotFoundException.

Parameters:

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.

  • ConflictException –

    The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.

  • ResourceNotFoundException –

    The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.

  • UnknownServiceError –

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

Examples:

Delete an agent context The following example deletes the agent context ac-8d2b6f1e4a9c4e37b5d0a2c8f6e1b394; deletion is asynchronous, and the agent context no longer appears in GetAgentContext or ListAgentContexts as soon as deletion starts.

>>> await client.delete_agent_context(agent_context_id='ac-8d2b6f1e4a9c4e37b5d0a2c8f6e1b394')
Source code in docs_src/capo_context/_services/async_context.py
async def delete_agent_context(
    self,
    agent_context_id: "capo_context.types.agent_context_identifier.AgentContextIdentifier",
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
) -> "capo_context.types.delete_agent_context_response.DeleteAgentContextResponse":
    """<p>Deletes an agent context. Deletion is asynchronous. An agent context that does not exist or is already being deleted returns ResourceNotFoundException.</p>

    Args:
        agent_context_id: <p>The agent context to delete, by its ID or ARN.</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.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.</p>
        capo_context.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.</p>
        capo_context.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Delete an agent context
        The following example deletes the agent context ac-8d2b6f1e4a9c4e37b5d0a2c8f6e1b394; deletion is asynchronous, and the agent context no longer appears in GetAgentContext or ListAgentContexts as soon as deletion starts.

        >>> await client.delete_agent_context(agent_context_id='ac-8d2b6f1e4a9c4e37b5d0a2c8f6e1b394')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_context.types.delete_agent_context_request.DeleteAgentContextRequest]",
    ) -> AsyncOperationResponse[
        "capo_context.types.delete_agent_context_response.DeleteAgentContextResponse"
    ]:
        import capo_context._operations.context.delete_agent_context

        (
            output,
            http_response,
        ) = await capo_context._operations.context.delete_agent_context.async_delete_agent_context(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAgentContext")
    )
    input_: capo_context.types.delete_agent_context_request.DeleteAgentContextRequest = {
        "agent_context_id": agent_context_id
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output