Skip to content

cayu.storage.PostgresAgentWorkContextStore

Part of cayu.storage.postgres. Read the Python API overview and install the required extra.

from cayu.storage import PostgresAgentWorkContextStore

PostgreSQL work-context/checkpoint store with transaction-fenced CAS.

Bases: _PostgresStoreBase, AgentWorkContextStore.

PostgresAgentWorkContextStore.__init__(conninfo: str | None=None, *, pool: AsyncConnectionPool | None=None, min_size: int=1, max_size: int=8, schema_mode: schema.SchemaMode=schema.SchemaMode.VALIDATE, clock: Callable[[], datetime] | None=None) -> None
async PostgresAgentWorkContextStore.ensure_schema() -> None

Open the pool and reconcile the schema now (per schema_mode).

Normally reconciliation happens lazily on first use; the cayu storage CLI calls this to run a migrate (or validate) as an explicit step.

async PostgresAgentWorkContextStore.close() -> None

Release store-owned resources, if any.

async PostgresAgentWorkContextStore.publish_work_context(context: AgentWorkContext, *, expected_revision: int | None) -> AgentWorkContextPublicationReceipt
async PostgresAgentWorkContextStore.load_work_context(task_id: str, *, revision: int | None=None) -> AgentWorkContext | None
async PostgresAgentWorkContextStore.load_work_context_publication(operation_id: str) -> AgentWorkContextPublicationReceipt | None
async PostgresAgentWorkContextStore.advance_recall_checkpoint(checkpoint: AgentRecallCheckpoint, *, expected_revision: int | None) -> AgentRecallCheckpoint
async PostgresAgentWorkContextStore.load_recall_checkpoint(key: AgentRecallCheckpointKey, *, revision: int | None=None) -> AgentRecallCheckpoint | None
async PostgresAgentWorkContextStore.stage_recall_delivery(delivery: AgentRecallDelivery) -> AgentRecallDeliveryRecord
async PostgresAgentWorkContextStore.load_recall_delivery(delivery_id: str) -> AgentRecallDeliveryRecord | None
async PostgresAgentWorkContextStore.claim_recall_delivery(key: AgentRecallCheckpointKey, *, claim_id: str, worker_id: str, lease_seconds: float) -> AgentRecallDeliveryRecord | None
async PostgresAgentWorkContextStore.renew_recall_delivery(claim: AgentRecallDeliveryClaim, *, lease_seconds: float) -> AgentRecallDeliveryRecord
async PostgresAgentWorkContextStore.release_recall_delivery(claim: AgentRecallDeliveryClaim, *, release_id: str, reason: str, released_at: datetime) -> AgentRecallDeliveryRecord
async PostgresAgentWorkContextStore.acknowledge_recall_delivery(claim: AgentRecallDeliveryClaim, *, acknowledgement_id: str, evidence_kind: AgentRecallDeliveryEvidenceKind, evidence_ref: str, acknowledged_at: datetime) -> AgentRecallDeliveryRecord
async PostgresAgentWorkContextStore.publish_recall_subscription(subscription: AgentRecallSubscription, *, expected_revision: int | None) -> AgentRecallSubscriptionPublicationReceipt
async PostgresAgentWorkContextStore.load_recall_subscription(subscription_id: str, *, revision: int | None=None) -> AgentRecallSubscription | None
async PostgresAgentWorkContextStore.claim_due_recall_subscription(key: AgentRecallCheckpointKey, *, claim_id: str, runner_id: str, lease_seconds: float) -> AgentRecallSubscriptionRecord | None
async PostgresAgentWorkContextStore.renew_recall_subscription(claim: AgentRecallSubscriptionClaim, *, lease_seconds: float) -> AgentRecallSubscriptionRecord
async PostgresAgentWorkContextStore.release_recall_subscription(claim: AgentRecallSubscriptionClaim, *, release_id: str, reason: str, released_at: datetime) -> AgentRecallSubscriptionRecord

commit_recall_subscription_evaluation (method)

Section titled “commit_recall_subscription_evaluation (method)”
async PostgresAgentWorkContextStore.commit_recall_subscription_evaluation(claim: AgentRecallSubscriptionClaim, result, *, evaluation_id: str, delivery_id: str | None, staged_by: str, evaluated_at: datetime) -> AgentRecallSubscriptionEvaluation

load_recall_subscription_evaluation (method)

Section titled “load_recall_subscription_evaluation (method)”
async PostgresAgentWorkContextStore.load_recall_subscription_evaluation(evaluation_id: str) -> AgentRecallSubscriptionEvaluation | None
async PostgresAgentWorkContextStore.claim_recall_subscription_wake(key: AgentRecallCheckpointKey, *, claim_id: str, runner_id: str, lease_seconds: float) -> AgentRecallSubscriptionWake | None
async PostgresAgentWorkContextStore.load_recall_subscription_wake(wake_id: str) -> AgentRecallSubscriptionWake | None
async PostgresAgentWorkContextStore.renew_recall_subscription_wake(claim: AgentRecallSubscriptionWakeClaim, *, lease_seconds: float) -> AgentRecallSubscriptionWake
async PostgresAgentWorkContextStore.release_recall_subscription_wake(claim: AgentRecallSubscriptionWakeClaim, *, release_id: str, reason: str, released_at: datetime) -> AgentRecallSubscriptionWake

acknowledge_recall_subscription_wake (method)

Section titled “acknowledge_recall_subscription_wake (method)”
async PostgresAgentWorkContextStore.acknowledge_recall_subscription_wake(claim: AgentRecallSubscriptionWakeClaim, *, acknowledgement_id: str, acknowledged_at: datetime) -> AgentRecallSubscriptionWake

Release source · Runtime guarantees · Capability guides