Skip to content

update_approval_action async

update_approval_action(
    agent_space_id: AgentSpaceIdentifier,
    approval_id: ApprovalId,
    action: ApprovalActionType,
    *,
    config_overrides: Optional[AsyncDevOpsAgentClientConfig] = None,
    final_pattern: Optional[ApprovalPattern] = None,
    reason: Optional[ApprovalReason] = None,
    ttl_seconds: Optional[int] = None,
    single_use: Optional[bool] = None,
) -> UpdateApprovalActionResponse

Updates an approval request with the terminal decision (APPROVED or REJECTED). A single operation handles both verbs via the action enum.

Parameters:

  • agent_space_id (AgentSpaceIdentifier) –

    The agent space identifier — multi-tenant workspace scope. Bound from the request URI.

  • approval_id (ApprovalId) –

    Identifier of the approval request being resolved. A UUID. Bound from the request URI.

  • action (ApprovalActionType) –

    The action to take on the approval request — APPROVED or REJECTED.

  • final_pattern (Optional[ApprovalPattern], default: None ) –

    The finalized pattern (tool + argumentPins) that scopes the approval. Required when `action` is APPROVED; must be absent when `action` is REJECTED. The pattern narrows, and must not widen, the invocation originally requested by the agent. This cross-field invariant is enforced by service-side validation.

  • reason (Optional[ApprovalReason], default: None ) –

    Optional free-text rationale for the decision. Permitted when `action` is REJECTED; ignored when `action` is APPROVED.

  • ttl_seconds (Optional[int], default: None ) –

    Approval lifetime in seconds, starting from when the decision is submitted. Required when `action` is APPROVED AND `singleUse` is false; must be absent when `action` is REJECTED or when `singleUse` is true (a single-use approval backs one executed action and the redemption window collapses). Cross-field invariants are enforced by service-side validation; the @range bound here is the operation-boundary check that always applies (a maximum of 4 hours).

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

    Whether the approved action backs a single executed tool call (true) or is reusable within ttlSeconds (false). Required when `action` is APPROVED; must be absent when `action` is REJECTED. When true, ttlSeconds must be absent (the redemption window collapses to the single use). When false, ttlSeconds is required and bounds the reuse window. Cross-field invariants are enforced by service-side validation.

Raises:

Source code in docs_src/capo_devops_agent/_services/async_dev_ops_agent.py
async def update_approval_action(
    self,
    agent_space_id: "capo_devops_agent.types.agent_space_identifier.AgentSpaceIdentifier",
    approval_id: "capo_devops_agent.types.approval_id.ApprovalId",
    action: "capo_devops_agent.types.approval_action_type.ApprovalActionType",
    *,
    config_overrides: Optional[AsyncDevOpsAgentClientConfig] = None,
    final_pattern: Optional[
        "capo_devops_agent.types.approval_pattern.ApprovalPattern"
    ] = None,
    reason: Optional[
        "capo_devops_agent.types.approval_reason.ApprovalReason"
    ] = None,
    ttl_seconds: Optional[int] = None,
    single_use: Optional[bool] = None,
) -> "capo_devops_agent.types.update_approval_action_response.UpdateApprovalActionResponse":
    """<p>Updates an approval request with the terminal decision (APPROVED or REJECTED). A single operation handles both verbs via the action enum.</p>

    Args:
        agent_space_id: <p>The agent space identifier — multi-tenant workspace scope. Bound from the request URI.</p>
        approval_id: <p>Identifier of the approval request being resolved. A UUID. Bound from the request URI.</p>
        action: <p>The action to take on the approval request — APPROVED or REJECTED.</p>
        final_pattern: <p>The finalized pattern (tool + argumentPins) that scopes the approval. Required when `action` is APPROVED; must be absent when `action` is REJECTED. The pattern narrows, and must not widen, the invocation originally requested by the agent. This cross-field invariant is enforced by service-side validation.</p>
        reason: <p>Optional free-text rationale for the decision. Permitted when `action` is REJECTED; ignored when `action` is APPROVED.</p>
        ttl_seconds: <p>Approval lifetime in seconds, starting from when the decision is submitted. Required when `action` is APPROVED AND `singleUse` is false; must be absent when `action` is REJECTED or when `singleUse` is true (a single-use approval backs one executed action and the redemption window collapses). Cross-field invariants are enforced by service-side validation; the @range bound here is the operation-boundary check that always applies (a maximum of 4 hours).</p>
        single_use: <p>Whether the approved action backs a single executed tool call (true) or is reusable within ttlSeconds (false). Required when `action` is APPROVED; must be absent when `action` is REJECTED. When true, ttlSeconds must be absent (the redemption window collapses to the single use). When false, ttlSeconds is required and bounds the reuse window. Cross-field invariants are enforced by service-side validation.</p>

    Raises:
        capo_devops_agent.errors.access_denied_exception.AccessDeniedException: <p>Access to the requested resource is denied due to insufficient permissions.</p>
        capo_devops_agent.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_devops_agent.errors.content_size_exceeded_exception.ContentSizeExceededException: <p>This exception is thrown when the content size exceeds the allowed limit.</p>
        capo_devops_agent.errors.internal_server_exception.InternalServerException: <p>This exception is thrown when an unexpected error occurs in the processing of a request.</p>
        capo_devops_agent.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters provided in the request are invalid.</p>
        capo_devops_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_devops_agent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed the service quota limit.</p>
        capo_devops_agent.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests. Please slow down and try again.</p>
        capo_devops_agent.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_devops_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_devops_agent.types.update_approval_action_request.UpdateApprovalActionRequest]",
    ) -> AsyncOperationResponse[
        "capo_devops_agent.types.update_approval_action_response.UpdateApprovalActionResponse"
    ]:
        import capo_devops_agent._operations.dev_ops_agent.update_approval_action

        (
            output,
            http_response,
        ) = await capo_devops_agent._operations.dev_ops_agent.update_approval_action.async_update_approval_action(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateApprovalAction")
    )
    input_: capo_devops_agent.types.update_approval_action_request.UpdateApprovalActionRequest = {
        "agent_space_id": agent_space_id,
        "approval_id": approval_id,
        "action": action,
    }
    if final_pattern is not None:
        input_["final_pattern"] = final_pattern
    if reason is not None:
        input_["reason"] = reason
    if ttl_seconds is not None:
        input_["ttl_seconds"] = ttl_seconds
    if single_use is not None:
        input_["single_use"] = single_use

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