Skip to content

Pydantic AI API

Install threvo-actions[pydantic-ai] before importing this module.

pydantic_ai

Pydantic AI Capability for confirm-first actions.

SafeReference module-attribute

SafeReference = Annotated[str, StringConstraints(min_length=1, max_length=255), AfterValidator(_validate_safe_reference)]

DepsT module-attribute

DepsT = TypeVar('DepsT')

ScopedDepsT module-attribute

ScopedDepsT = TypeVar('ScopedDepsT')

DepsContraT module-attribute

DepsContraT = TypeVar('DepsContraT', contravariant=True)

CommandContraT module-attribute

CommandContraT = TypeVar('CommandContraT', bound=BaseModel, contravariant=True)

CommandT module-attribute

CommandT = TypeVar('CommandT', bound=BaseModel)

PrivateSnapshotT module-attribute

PrivateSnapshotT = TypeVar('PrivateSnapshotT', bound=BaseModel)

PreviewT module-attribute

PreviewT = TypeVar('PreviewT', bound=BaseModel)

ResultT module-attribute

ResultT = TypeVar('ResultT', bound=BaseModel)

JsonObject module-attribute

JsonObject = dict[str, JsonValue]

_TOOL_NAME_PATTERN module-attribute

_TOOL_NAME_PATTERN = re.compile('^[a-z][a-z0-9_]{0,63}$', flags=re.ASCII)

DEFAULT_INTERNAL_ACTION_ARGUMENTS module-attribute

DEFAULT_INTERNAL_ACTION_ARGUMENTS = frozenset({'authority_evidence', 'organization_id', 'private_snapshot', 'proposal_reference', 'request_id', 'snapshot', 'tenant_reference', 'user_id'})

__all__ module-attribute

__all__ = ['ActionAgentContext', 'ActionCapability', 'ActionContextResolver', 'ActionRecoveryToolBinding', 'ActionRecoveryToolRequest', 'ActionRecoveryToolResult', 'ActionToolBinding', 'ActionToolFailureHandler', 'ActionToolResult', 'DeferredActionRequest', 'DEFAULT_INTERNAL_ACTION_ARGUMENTS', 'ExistingToolActionBinding', 'InlineAuthorityHandler', 'IntegrationOutcome', 'ScopedActionToolBinding', 'build_existing_tool_action_toolset']

ActionApplication

ActionApplication()

Bases: Generic[DepsT]

Minimal registration catalog for experimental action declarations.

is_frozen property

is_frozen: bool

registration_count property

registration_count: int

register

register(specification: ActionSpec[CommandT, PrivateSnapshotT, PreviewT, ResultT], recipe: ActionRecipe[DepsT, CommandT, PrivateSnapshotT, PreviewT, ResultT]) -> RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT]

freeze

freeze() -> None

inspect

inspect(action: RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT]) -> ActionInspection

bind

bind(action: RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, dependencies: DepsT) -> Iterator[BoundAction[CommandT, PrivateSnapshotT, PreviewT, ResultT]]

RegisteredAction dataclass

RegisteredAction(action_type: ActionType, _registration_id: int, _application_token: object)

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

Typed static handle returned by explicit registration.

action_type instance-attribute

action_type: ActionType

ActionType

Bases: ExperimentalModel

A host-defined action name with an explicit contract version.

namespace instance-attribute

namespace: ActionNamespace

name instance-attribute

name: ActionName

version instance-attribute

version: Annotated[int, Field(ge=1)]

EvidenceConsumer

Bases: ExperimentalModel

kind class-attribute instance-attribute

kind: Literal['evidence_consumer'] = 'evidence_consumer'

reference instance-attribute

reference: SafeReference

ExperimentalModel

Bases: ActionModel

Compatibility base for contracts that are explicitly experimental.

LifecycleStatus

Bases: StrEnum

Closed lifecycle vocabulary for proposal execution and verification.

AWAITING_AUTHORITY class-attribute instance-attribute

AWAITING_AUTHORITY = 'awaiting_authority'

DENIED class-attribute instance-attribute

DENIED = 'denied'

EXPIRED class-attribute instance-attribute

EXPIRED = 'expired'

AUTHORIZED class-attribute instance-attribute

AUTHORIZED = 'authorized'

BLOCKED class-attribute instance-attribute

BLOCKED = 'blocked'

STALE class-attribute instance-attribute

STALE = 'stale'

SUPERSEDED class-attribute instance-attribute

SUPERSEDED = 'superseded'

EXECUTING class-attribute instance-attribute

EXECUTING = 'executing'

FAILED_KNOWN class-attribute instance-attribute

FAILED_KNOWN = 'failed_known'

FAILED_UNKNOWN class-attribute instance-attribute

FAILED_UNKNOWN = 'failed_unknown'

VERIFICATION_PENDING class-attribute instance-attribute

VERIFICATION_PENDING = 'verification_pending'

VERIFICATION_UNRESOLVED class-attribute instance-attribute

VERIFICATION_UNRESOLVED = 'verification_unresolved'

PARTIALLY_SUCCEEDED class-attribute instance-attribute

PARTIALLY_SUCCEEDED = 'partially_succeeded'

VERIFIED class-attribute instance-attribute

VERIFIED = 'verified'

ProposingAgent

Bases: ExperimentalModel

kind class-attribute instance-attribute

kind: Literal['proposing_agent'] = 'proposing_agent'

reference instance-attribute

reference: SafeReference

RequestingPrincipal

Bases: ExperimentalModel

kind class-attribute instance-attribute

kind: Literal['requesting_principal'] = 'requesting_principal'

reference instance-attribute

reference: SafeReference

ActionRecoveryView

Bases: ActionModel

Versioned, read-only explanation of one proposal's recovery state.

schema_version class-attribute instance-attribute

schema_version: Literal['threvo.actions.recovery/v1'] = 'threvo.actions.recovery/v1'

proposal_reference instance-attribute

proposal_reference: SafeReference

lifecycle_status instance-attribute

lifecycle_status: LifecycleStatus

revision instance-attribute

revision: int

erased instance-attribute

erased: bool

observed_at instance-attribute

observed_at: AwareDatetime

expires_at class-attribute instance-attribute

expires_at: AwareDatetime | None = None

next_verification_at class-attribute instance-attribute

next_verification_at: AwareDatetime | None = None

verification_attempts class-attribute instance-attribute

verification_attempts: int | None = None

max_verification_attempts class-attribute instance-attribute

max_verification_attempts: int | None = None

last_verification_status class-attribute instance-attribute

last_verification_status: VerificationReceiptStatus | None = None

reason_code class-attribute instance-attribute

reason_code: SafeReference | None = None

condition instance-attribute

condition: ActionRecoveryCondition

effect_ownership instance-attribute

effect_ownership: ActionEffectOwnership

owner class-attribute instance-attribute

owner: ActionRecoveryOwnerView | None = None

recommended_steps class-attribute instance-attribute

recommended_steps: tuple[ActionRecoveryStep, ...] = ()

ActionDefinition dataclass

ActionDefinition(action_type: ActionType, command_model: type[CommandT], private_snapshot_model: type[PrivateSnapshotT], display_preview_model: type[PreviewT], result_model: type[ResultT], preparation: PreparationPort[CommandT, PrivateSnapshotT, PreviewT], authorization: AuthorizationPort[CommandT, PrivateSnapshotT], authority_evaluator: AuthorityEvaluatorPort, state_resolver: StateResolverPort[PrivateSnapshotT, PreviewT], executor: GovernedExecutorPort[PrivateSnapshotT, ResultT], verifier: VerifierPort[ResultT], commitment_provider: CommitmentProviderPort, protection_codec: ProtectionCodecPort, retention: RetentionPort, proposal_ttl: timedelta, executor_identity: GovernedExecutor, target_identity: AuthoritativeTarget, authority_audience: str, authority_channel_assurance: str, recovery_authorization: RecoveryAuthorizationPort | None = None, verification_delay: timedelta = timedelta(0), max_verification_attempts: int = 3, effect_kind: EffectKind = 'single', allow_resend_after_final_absence: bool = False, verification_lease_duration: timedelta = timedelta(minutes=1), semantic_idempotency_strategy: Literal['host_defined'] = 'host_defined')

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

action_type instance-attribute

action_type: ActionType

command_model instance-attribute

command_model: type[CommandT]

private_snapshot_model instance-attribute

private_snapshot_model: type[PrivateSnapshotT]

display_preview_model instance-attribute

display_preview_model: type[PreviewT]

result_model instance-attribute

result_model: type[ResultT]

preparation instance-attribute

authorization instance-attribute

authority_evaluator instance-attribute

authority_evaluator: AuthorityEvaluatorPort

state_resolver instance-attribute

executor instance-attribute

verifier instance-attribute

verifier: VerifierPort[ResultT]

commitment_provider instance-attribute

commitment_provider: CommitmentProviderPort

protection_codec instance-attribute

protection_codec: ProtectionCodecPort

retention instance-attribute

retention: RetentionPort

proposal_ttl instance-attribute

proposal_ttl: timedelta

executor_identity instance-attribute

executor_identity: GovernedExecutor

target_identity instance-attribute

target_identity: AuthoritativeTarget

authority_audience instance-attribute

authority_audience: str

authority_channel_assurance instance-attribute

authority_channel_assurance: str

recovery_authorization class-attribute instance-attribute

recovery_authorization: RecoveryAuthorizationPort | None = None

verification_delay class-attribute instance-attribute

verification_delay: timedelta = timedelta(0)

max_verification_attempts class-attribute instance-attribute

max_verification_attempts: int = 3

effect_kind class-attribute instance-attribute

effect_kind: EffectKind = 'single'

allow_resend_after_final_absence class-attribute instance-attribute

allow_resend_after_final_absence: bool = False

verification_lease_duration class-attribute instance-attribute

verification_lease_duration: timedelta = timedelta(minutes=1)

semantic_idempotency_strategy class-attribute instance-attribute

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

__post_init__

__post_init__() -> None

ReadContext

Bases: ExperimentalModel

tenant_reference instance-attribute

tenant_reference: SafeReference

consumer instance-attribute

consumer: EvidenceConsumer

ActionOperationResult

Bases: ExperimentalModel

proposal_reference instance-attribute

proposal_reference: SafeReference

lifecycle_status instance-attribute

lifecycle_status: LifecycleStatus

outcome instance-attribute

revision instance-attribute

revision: int

display_preview class-attribute instance-attribute

display_preview: JsonObject = Field(default_factory=dict)

safe_result class-attribute instance-attribute

safe_result: JsonObject | None = None

fresh_proposal_reference class-attribute instance-attribute

fresh_proposal_reference: SafeReference | None = None

reason_code class-attribute instance-attribute

reason_code: SafeReference | None = None

is_terminal property

is_terminal: bool

Whether this proposal has no reconciliation or recovery path.

automatic_processing_closed property

automatic_processing_closed: bool

Whether unattended processing should stop for this proposal.

needs_reconciliation property

needs_reconciliation: bool

Whether authoritative reconciliation may advance this proposal.

ActionRuntime

ActionRuntime(*, store: ActionStore, retention_store: RetentionStore | None = None, clock: Clock | None = None, identifiers: IdentifierProvider | None = None, event_sink: EventSink | None = None, runtime_revision: str | None = None)

Coordinates host-owned controls without owning host business truth.

prepare async

prepare(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, tenant_reference: str, command: CommandT, requesting_principal: RequestingPrincipal, proposing_agent: ProposingAgent | None = None, proposal_reference: str | None = None) -> ActionOperationResult

record_authority async

record_authority(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, evidence: AuthorityEvidence, authenticated_authority: ConfirmingAuthority, proposal_reference: str | None = None) -> ActionOperationResult

expire_due async

expire_due(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

Expire an unexecuted proposal once its prepared lifetime has elapsed.

execute async

execute(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

reconcile async

reconcile(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

resume_verification async

resume_verification(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, tenant_reference: str, proposal_reference: str, expected_revision: int, operator: RecoveryOperator, intervention_reference: str) -> ActionOperationResult

Resume observation after a host operator resolves an external ambiguity.

This transition never calls the executor. It records the intervention, advances an unresolved or waiting verification state, and immediately performs one fresh authoritative observation through the action verifier.

read async

read(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, proposal_reference: str, context: ReadContext) -> ProposalView

read_recovery async

read_recovery(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, proposal_reference: str, context: ReadContext) -> ActionRecoveryView

Describe safe recovery options without granting authority or mutating state.

export_evidence async

export_evidence(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, proposal_reference: str, context: ReadContext) -> ActionEvidenceBundle

Export one authorized, minimized proposal revision.

observation_context async

observation_context(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, proposal_reference: str, context: ReadContext) -> ExecutionContext

Authorize a read-only target observation and bind it to stored identity.

erase async

erase(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, proposal_reference: str, context: ReadContext) -> ActionOperationResult

AuthorizationDeniedError

Bases: PermissionError

OperationOutcome

Bases: StrEnum

PREPARED class-attribute instance-attribute

PREPARED = 'prepared'

AUTHORITY_PENDING class-attribute instance-attribute

AUTHORITY_PENDING = 'authority_pending'

AUTHORIZED class-attribute instance-attribute

AUTHORIZED = 'authorized'

DENIED class-attribute instance-attribute

DENIED = 'denied'

BLOCKED class-attribute instance-attribute

BLOCKED = 'blocked'

STALE class-attribute instance-attribute

STALE = 'stale'

IN_PROGRESS class-attribute instance-attribute

IN_PROGRESS = 'in_progress'

EXPIRED class-attribute instance-attribute

EXPIRED = 'expired'

REPLAYED class-attribute instance-attribute

REPLAYED = 'replayed'

CONFLICT class-attribute instance-attribute

CONFLICT = 'conflict'

VERIFICATION_PENDING class-attribute instance-attribute

VERIFICATION_PENDING = 'verification_pending'

VERIFIED class-attribute instance-attribute

VERIFIED = 'verified'

PARTIALLY_SUCCEEDED class-attribute instance-attribute

PARTIALLY_SUCCEEDED = 'partially_succeeded'

FAILED_KNOWN class-attribute instance-attribute

FAILED_KNOWN = 'failed_known'

FAILED_UNKNOWN class-attribute instance-attribute

FAILED_UNKNOWN = 'failed_unknown'

VERIFICATION_UNRESOLVED class-attribute instance-attribute

VERIFICATION_UNRESOLVED = 'verification_unresolved'

RESEND_ALLOWED class-attribute instance-attribute

RESEND_ALLOWED = 'resend_allowed'

ERASED class-attribute instance-attribute

ERASED = 'erased'

ProposalNotFoundError

ProposalNotFoundError()

Bases: LookupError

ProposalView

Bases: ExperimentalModel

proposal_reference instance-attribute

proposal_reference: SafeReference

lifecycle_status instance-attribute

lifecycle_status: LifecycleStatus

revision instance-attribute

revision: int

display_preview instance-attribute

display_preview: JsonObject

receipts instance-attribute

receipts: tuple[Receipt, ...]

safe_result class-attribute instance-attribute

safe_result: JsonObject | None = None

erased instance-attribute

erased: bool

ActionAgentContext

Bases: ExperimentalModel

Trusted host context resolved from authenticated agent dependencies.

tenant_reference instance-attribute

tenant_reference: SafeReference

requesting_principal instance-attribute

requesting_principal: RequestingPrincipal

evidence_consumer instance-attribute

evidence_consumer: EvidenceConsumer

proposing_agent class-attribute instance-attribute

proposing_agent: ProposingAgent | None = None

IntegrationOutcome

Bases: StrEnum

BINDING_UNAVAILABLE class-attribute instance-attribute

BINDING_UNAVAILABLE = 'binding_unavailable'

INVALID_CONTINUATION class-attribute instance-attribute

INVALID_CONTINUATION = 'invalid_continuation'

OPERATION_OUTCOME_UNKNOWN class-attribute instance-attribute

OPERATION_OUTCOME_UNKNOWN = 'operation_outcome_unknown'

PREPARATION_DENIED class-attribute instance-attribute

PREPARATION_DENIED = 'preparation_denied'

PREPARED_NOT_VISIBLE class-attribute instance-attribute

PREPARED_NOT_VISIBLE = 'prepared_not_visible'

ActionToolResult

Bases: ExperimentalModel

Display-safe result returned to the model after a continuation attempt.

proposal_reference class-attribute instance-attribute

proposal_reference: SafeReference | None = None

lifecycle_status class-attribute instance-attribute

lifecycle_status: LifecycleStatus | None = None

outcome instance-attribute

revision class-attribute instance-attribute

revision: int | None = None

display_preview class-attribute instance-attribute

display_preview: JsonObject = Field(default_factory=dict)

safe_result class-attribute instance-attribute

safe_result: JsonObject | None = None

fresh_proposal_reference class-attribute instance-attribute

fresh_proposal_reference: SafeReference | None = None

ActionRecoveryToolRequest

Bases: ExperimentalModel

proposal_reference instance-attribute

proposal_reference: SafeReference

ActionRecoveryToolResult

Bases: ExperimentalModel

visible instance-attribute

visible: bool

recovery class-attribute instance-attribute

recovery: ActionRecoveryView | None = None

DeferredActionRequest

Bases: ExperimentalModel

Safe request passed to an optional server-side inline authority handler.

tool_call_id instance-attribute

tool_call_id: SafeReference

tool_name instance-attribute

tool_name: SafeReference

proposal_reference instance-attribute

proposal_reference: SafeReference

action_type instance-attribute

action_type: ActionType

ActionContextResolver

Bases: Protocol[DepsContraT]

__call__

__call__(deps: DepsContraT) -> ActionAgentContext

InlineAuthorityHandler

Bases: Protocol[DepsContraT]

__call__

__call__(request: DeferredActionRequest, *, deps: DepsContraT) -> bool | Awaitable[bool]

ActionToolFailureHandler

Bases: Protocol

Host-controlled diagnostics for failures hidden from a model caller.

__call__

__call__(failure: BaseException, *, action_type: ActionType, tool_name: str) -> None

ExistingToolActionBinding dataclass

ExistingToolActionBinding(name: str, action_type: ActionType, forbidden_model_arguments: frozenset[str] = DEFAULT_INTERNAL_ACTION_ARGUMENTS)

Bind a host's existing model tool to a durable action identity.

This is the small, brownfield layer: the host keeps its established tool function and confirmation record while the binding makes approval suspension explicit and prevents internal action material from becoming model-controlled input.

name instance-attribute

name: str

action_type instance-attribute

action_type: ActionType

forbidden_model_arguments class-attribute instance-attribute

forbidden_model_arguments: frozenset[str] = DEFAULT_INTERNAL_ACTION_ARGUMENTS

__post_init__

__post_init__() -> None

validate_executor

validate_executor(executor: ToolFuncEither[DepsT, ...]) -> ToolFuncEither[DepsT, ...]

Fail at composition time if a host tool exposes internal authority.

_ContinuationMetadata

Bases: ExperimentalModel

proposal_reference instance-attribute

proposal_reference: SafeReference

tool_name instance-attribute

tool_name: SafeReference

action_type instance-attribute

action_type: ActionType

display_preview instance-attribute

display_preview: JsonObject

_BuildableBinding

Bases: Protocol[DepsContraT]

name property

name: str

build_tool

build_tool(runtime: ActionRuntime | None) -> Tool[DepsContraT]

_ActionOperations

Bases: Protocol[CommandContraT]

prepare async

prepare(*, tenant_reference: str, command: CommandContraT, requesting_principal: RequestingPrincipal, proposing_agent: ProposingAgent | None = None) -> ActionOperationResult

execute async

execute(*, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

reconcile async

reconcile(*, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

read async

read(*, proposal_reference: str, context: ReadContext) -> ProposalView

_FixedActionOperations dataclass

_FixedActionOperations(runtime: ActionRuntime, definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT])

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

runtime instance-attribute

runtime: ActionRuntime

definition instance-attribute

prepare async

prepare(*, tenant_reference: str, command: CommandT, requesting_principal: RequestingPrincipal, proposing_agent: ProposingAgent | None = None) -> ActionOperationResult

execute async

execute(*, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

reconcile async

reconcile(*, tenant_reference: str, proposal_reference: str) -> ActionOperationResult

read async

read(*, proposal_reference: str, context: ReadContext) -> ProposalView

ActionToolBinding dataclass

ActionToolBinding(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], context_resolver: ActionContextResolver[DepsT], name: str, description: str, binding_failure_handler: ActionToolFailureHandler | None = None)

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

Explicitly binds one action definition to one model-visible tool.

definition instance-attribute

context_resolver instance-attribute

context_resolver: ActionContextResolver[DepsT]

name instance-attribute

name: str

description instance-attribute

description: str

binding_failure_handler class-attribute instance-attribute

binding_failure_handler: ActionToolFailureHandler | None = None

__post_init__

__post_init__() -> None

build_tool

build_tool(runtime: ActionRuntime | None) -> Tool[DepsT]

ActionRecoveryToolBinding dataclass

ActionRecoveryToolBinding(definition: ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT], context_resolver: ActionContextResolver[DepsT], name: str, description: str)

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

Opt-in read-only recovery tool for one fixed action definition.

definition instance-attribute

context_resolver instance-attribute

context_resolver: ActionContextResolver[DepsT]

name instance-attribute

name: str

description instance-attribute

description: str

__post_init__

__post_init__() -> None

build_tool

build_tool(runtime: ActionRuntime | None) -> Tool[DepsT]

ScopedActionToolBinding dataclass

ScopedActionToolBinding(application: ActionApplication[ScopedDepsT], action: RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT], dependency_scope: Callable[[DepsT], AbstractAsyncContextManager[ScopedDepsT]], context_resolver: ActionContextResolver[ScopedDepsT], name: str, description: str, binding_failure_handler: ActionToolFailureHandler | None = None)

Bases: Generic[DepsT, ScopedDepsT, CommandT, PrivateSnapshotT, PreviewT, ResultT]

Bind one registered action through fresh host dependencies per tool call.

application instance-attribute

action instance-attribute

dependency_scope instance-attribute

dependency_scope: Callable[[DepsT], AbstractAsyncContextManager[ScopedDepsT]]

context_resolver instance-attribute

name instance-attribute

name: str

description instance-attribute

description: str

binding_failure_handler class-attribute instance-attribute

binding_failure_handler: ActionToolFailureHandler | None = None

__post_init__

__post_init__() -> None

build_tool

build_tool(runtime: ActionRuntime | None) -> Tool[DepsT]

ActionCapability dataclass

ActionCapability(*, bindings: Sequence[_BuildableBinding[DepsT]], runtime: ActionRuntime | None = None, inline_authority_handler: InlineAuthorityHandler[DepsT] | None = None, id: str = 'threvo_actions')

Bases: AbstractCapability[DepsT]

Expose confirm-first actions without trusting framework approval as authority.

id instance-attribute

id = id

description instance-attribute

description = 'Prepare and safely resume confirm-first actions.'

defer_loading instance-attribute

defer_loading = False

get_serialization_name classmethod

get_serialization_name() -> str | None

get_instructions

get_instructions() -> str

get_toolset

get_toolset() -> FunctionToolset[DepsT]

build_continuation_results

build_continuation_results(requests: DeferredToolRequests, *, decisions: Mapping[str, bool]) -> DeferredToolResults

Build framework continuations while preserving safe proposal metadata.

handle_deferred_tool_calls async

handle_deferred_tool_calls(ctx: RunContext[DepsT], *, requests: DeferredToolRequests) -> DeferredToolResults | None

build_existing_tool_action_toolset

build_existing_tool_action_toolset(*, bindings: Sequence[ExistingToolActionBinding], executors: Mapping[str, ToolFuncEither[DepsT, ...]], id: str = 'threvo_actions_existing_tools') -> FunctionToolset[DepsT]

Add approval suspension to validated host-owned tool functions.

Pydantic AI approval remains routing metadata. The tool itself must create and later execute its durable action through the normal runtime authority checks.

_report_tool_failure

_report_tool_failure(handler: ActionToolFailureHandler | None, failure: BaseException, *, action_type: ActionType, tool_name: str) -> None

_safe_failure

_safe_failure(outcome: IntegrationOutcome) -> ActionToolResult

_tool_result

_tool_result(result: ActionOperationResult) -> ActionToolResult

_continuation_metadata

_continuation_metadata(value: object) -> _ContinuationMetadata | None

_contains_json_float_for_decimal

_contains_json_float_for_decimal(annotation: object, value: object) -> bool

Detect JSON numbers that would lose precision at Decimal boundaries.

_invoke_action_tool async

_invoke_action_tool(*, approved: bool, continuation_value: object, arguments: dict[str, object], command_model: type[CommandT], action_type: ActionType, operations: _ActionOperations[CommandT], trusted: ActionAgentContext, tool_name: str) -> ActionToolResult | _ContinuationMetadata