Skip to content

API Reference parrot.squawk.server.ledger

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.squawk.server.ledger

View source

Signed served ledger with fail-closed durable persistence.

Alias AbstractKMSSigner

Re-exported from parrot.security.audit_ledger.AbstractKMSSigner.

Class LedgerUnavailable

Indicate that a required durable ledger commit failed.

Class ServedLedger

Sign served entries and retain only successfully acknowledged records.

Parameter Type Default Description
signer AbstractKMSSigner Asynchronous signer used for every entry.
sink Sink | None None Optional durable JSON storage callable.
max_entries int 10000 Maximum number of signed entries retained in memory.

Attributes:

Attribute Type Description
durable bool Return whether a durable sink is configured.

Method ServedLedger.append

Sign and durably commit an entry before acknowledging it.

append(entry: ServedLedgerEntry, *, required: bool = True) -> ServedLedgerEntry

Parameter Type Default Description
entry ServedLedgerEntry Unsigned served-ledger record.
required bool True Whether a sink failure must prevent acknowledgment.

Returns: ServedLedgerEntry — The signed entry.

Raises:

  • LedgerUnavailable — If a required durable commit fails.

Method ServedLedger.verify

Verify an entry signature against its canonical bytes.

verify(entry: ServedLedgerEntry) -> bool

Parameter Type Default Description
entry ServedLedgerEntry

Returns: bool

Method ServedLedger.recent

Return at most the newest limit retained entries.

recent(*, limit: int = 100) -> list[ServedLedgerEntry]

Parameter Type Default Description
limit int 100

Returns: list[ServedLedgerEntry]

Alias ServedLedgerEntry

Re-exported from parrot.interagent.ServedLedgerEntry.

Attribute Sink

Function postgres_ledger_sink

Build an asyncpg sink that inserts signed entries idempotently.

postgres_ledger_sink(dsn_or_pool: str | Any, *, table: str = 'squawk_served_ledger') -> Sink

Parameter Type Default Description
dsn_or_pool str | Any PostgreSQL DSN or an existing asyncpg-compatible pool.
table str 'squawk_served_ledger' Destination table created by squawk_served_ledger.sql.

Returns: Sink — An asynchronous JSON storage callable. It exposes sink.aclose(), which closes the pool only when this sink created it from a DSN.

Raises:

  • ValueError — If table is not a plain (optionally schema-qualified) identifier.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally