Skip to content

Action authoring and approval requirements

Action is an authoring facade. It compiles to ActionDefinition; the runtime continues to accept definitions only.

action

Thin authoring facade that compiles to the public action definition.

Action

Action(*, authority_evaluator: AuthorityEvaluatorPort, commitment_provider: CommitmentProvider, protection_codec: ProtectionCodec)

Bases: ABC, Generic[CommandT, PrivateSnapshotT, PreviewT, ResultT]

Author an action as one typed object without creating a second runtime path.

Deployment services remain constructor-injected. Immutable action metadata stays visible on the subclass. to_definition is the only bridge to the runtime.

action_type class-attribute

action_type: ActionType

proposal_ttl class-attribute

proposal_ttl: timedelta

executor_identity class-attribute

executor_identity: GovernedExecutor

target_identity class-attribute

target_identity: AuthoritativeTarget

authority_audience class-attribute

authority_audience: str

authority_channel_assurance class-attribute

authority_channel_assurance: str

verification_delay class-attribute

verification_delay: timedelta = timedelta(0)

max_verification_attempts class-attribute

max_verification_attempts: int = 3

effect_kind class-attribute

effect_kind: EffectKind = 'single'

allow_resend_after_final_absence class-attribute

allow_resend_after_final_absence: bool = False

verification_lease_duration class-attribute

verification_lease_duration: timedelta = timedelta(minutes=1)

semantic_idempotency_strategy class-attribute

semantic_idempotency_strategy: Literal['host_defined'] = 'host_defined'

__init_subclass__

__init_subclass__(**kwargs: object) -> None

to_definition

to_definition() -> ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT]

Compile this authoring facade to the runtime's public plumbing.

prepare abstractmethod async

prepare(command: CommandT, *, context: PreparationContext) -> PreparedAction[PrivateSnapshotT, PreviewT]

can_prepare abstractmethod async

can_prepare(command: CommandT, *, context: PreparationContext) -> AuthorizationResult

can_decide abstractmethod async

can_decide(evidence: AuthorityEvidence, *, context: DecisionContext) -> AuthorizationResult

can_execute abstractmethod async

can_execute(snapshot: PrivateSnapshotT, *, context: ExecutionContext) -> AuthorizationResult

can_read abstractmethod async

can_read(proposal_reference: str, *, context: ReadContext) -> bool

resolve abstractmethod async

resolve(snapshot: PrivateSnapshotT, *, context: ExecutionContext) -> ResolvedState[PrivateSnapshotT, PreviewT]

execute abstractmethod async

execute(snapshot: PrivateSnapshotT, *, context: ExecutionContext, execution_precondition: str) -> ExecutionResult[ResultT]

verify abstractmethod async

verify(*, context: ExecutionContext) -> VerificationResult[ResultT]

authorize_erasure async

authorize_erasure(proposal_reference: str, *, context: ReadContext) -> bool

ActionConfigurationError

Bases: TypeError

Raised when an Action subclass cannot compile to ActionDefinition.

Approval requirements evaluate evidence after the host has authenticated and authorized each decision. They are not authorization policies.

approvals

Evidence-only approval requirements.

These helpers evaluate already authenticated and host-authorized authority evidence. They never decide whether an authority is currently permitted to act.

SingleApproval dataclass

SingleApproval(authority: ConfirmingAuthority)

Require one specific authority after the host authorizes the decision.

authority instance-attribute

evaluate async

evaluate(*, binding: AuthorityBinding, evidence: tuple[AuthorityEvidence, ...]) -> AuthorityEvaluation

AnyApproval dataclass

AnyApproval(authorities: tuple[ConfirmingAuthority, ...])

Require one distinct authority from a declared set.

authorities instance-attribute

authorities: tuple[ConfirmingAuthority, ...]

__post_init__

__post_init__() -> None

evaluate async

evaluate(*, binding: AuthorityBinding, evidence: tuple[AuthorityEvidence, ...]) -> AuthorityEvaluation

MOfNApprovals dataclass

MOfNApprovals(required: int, authorities: tuple[ConfirmingAuthority, ...])

Require approvals from a distinct M-of-N set of authorities.

required instance-attribute

required: int

authorities instance-attribute

authorities: tuple[ConfirmingAuthority, ...]

__post_init__

__post_init__() -> None

evaluate async

evaluate(*, binding: AuthorityBinding, evidence: tuple[AuthorityEvidence, ...]) -> AuthorityEvaluation

ApprovalReasonCode

Bases: StrEnum

Reason codes generated by the evidence-only approval requirements.

MORE_AUTHORITY_REQUIRED class-attribute instance-attribute

MORE_AUTHORITY_REQUIRED = 'more_authority_required'