Skip to main content
All Python modules · Import and compatibility guidance

Approval request inputs

Exports

ApprovalDenied

Raised inside a suspended execution when its principal denies the call.

ApprovalEnforcementError

Raised when protected work lacks a managed approval boundary.

ApprovalError

Base error for approval policy and state transitions.

ApprovalExecution

Invocation identity and optional grant visible to protected callables.
Fields (— means no declared default):

ApprovalExecution.authorize

Authorize a challenge through a live store or supplied one-time grant.

ApprovalExpired

Raised inside a suspended execution when its decision deadline passes.

ApprovalPolicy

Immutable policy attached to a local tool or MCP client factory.
Fields (— means no declared default):

ApprovalPolicy.applies_to

Report whether this policy protects the named remote tool.

ApprovalRequired

Stop managed execution before a protected action is called.

ApprovalRun

One live invocation whose Python task may suspend at protected calls. Obtain this object from the owning Harnest API; its constructor includes runtime bindings. Fields (— means no declared default):

InMemoryApprovalStore

Development approval store with atomic one-time transitions.

InMemoryApprovalStore.create_run

Create an invocation-scoped approval suspension channel.

InMemoryApprovalStore.request

Register a bounded one-time approval challenge.

InMemoryApprovalStore.suspend

Suspend an invocation until its challenge is approved or rejected.

InMemoryApprovalStore.decide

Commit an approval decision for the matching user-owned challenge.

InMemoryApprovalStore.deliver_decision

Deliver a committed decision to its suspended invocation.

InMemoryApprovalStore.run_for

Return the live invocation associated with a pending challenge.

InMemoryApprovalStore.pending_for

Expose only live challenges owned by this principal and session.

InMemoryApprovalStore.assert_consumed

Require resumed execution to have reached the approved action.

InMemoryApprovalStore.executed

Mark an approved action as successfully executed.

InMemoryApprovalStore.failed

Mark an approved action as failed during execution.

InMemoryApprovalStore.cancel_run

Cancel all unresolved challenges and work for one invocation.

InMemoryApprovalStore.retained_count

Return the number of live challenges and retained tombstones.

PendingApproval

One principal-scoped invocation awaiting a one-time decision. Obtain this object from the owning Harnest API; its constructor includes runtime bindings. Fields (— means no declared default):

PendingApproval.public

Return the client-safe fields needed to present an approval prompt.

approval_execution

Activate approval authority for protected work in this context.

approval_policy

Read the Harnest approval policy attached to a callable, if present.

authorize_mcp

Authorize one MCP tool call when the client policy selects it.

bind_tool_arguments

Bind a tool call to canonical approval-safe argument values.

record_approved_execution

Record successful completion for an optional one-time approval grant.

record_approved_failure

Record failed execution for an optional one-time approval grant.

request_human_approval

Protect only the dynamic operation inside this asynchronous block. Callers may evaluate policy or risk before entering the block. The approval is bound to a stable action name and canonical arguments, while the block boundary lets Harnest audit whether the approved operation completed.

require_human_approval

Declare that a tool or MCP client() factory requires approval.

wrap_approved_tool

Install an execution gate after both decorator orders are known.