Skip to content

API Reference parrot.squawk.server.promotion

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

parrot.squawk.server.promotion

View source

Promotion loop: LLM-backed call patterns → drafted deterministic capability → human approval (Q10, D12).

Alias CallCost

Re-exported from parrot.interagent.CallCost.

Alias CallerIdentity

Re-exported from parrot.interagent.CallerIdentity.

Alias CapabilityBinding

Re-exported from parrot.squawk.contract.CapabilityBinding.

Class PromotionAnalyzer

Find promotion candidates in the served ledger, draft them, and apply human approval.

Parameter Type Default Description
ledger ServedLedger Served ledger read for candidates and written on approval.
min_calls int 20 Minimum successful LLM-backed calls before a pattern is proposed.

Method PromotionAnalyzer.candidates

Group successful calls by (cap_id, args_digest) and keep frequent LLM-backed ones.

Failed calls are ignored: a pattern that errors is not evidence for promotion.

candidates(entries: Sequence[ServedLedgerEntry] | None = None) -> list[PromotionCandidate]

Parameter Type Default Description
entries Sequence[ServedLedgerEntry] | None None Entries to analyze, defaulting to the ledger's recent window.

Returns: list[PromotionCandidate] — Candidates sorted by LLM-backed call count, descending.

Method PromotionAnalyzer.draft

Draft a deterministic replacement (agent-proposed): same cap_id and I/O, bound to tool_name.

draft(candidate: PromotionCandidate, current: SquawkCapability, *, tool_name: str) -> CapabilityBinding

Parameter Type Default Description
candidate PromotionCandidate The pattern being promoted; must match current.
current SquawkCapability The LLM-backed capability currently published.
tool_name str Deterministic tool that will serve the capability.

Returns: CapabilityBinding — The drafted binding, version bumped.

Raises:

  • ValueError — If the candidate and capability disagree or current is not LLM-backed.

Method PromotionAnalyzer.approve

Apply a human approval: replace the capability, rebuild (re-hash) the contract, ledger it.

approve(contract: SquawkContract, bindings: Sequence[CapabilityBinding], draft: CapabilityBinding, *, approver: str) -> SquawkContract

Parameter Type Default Description
contract SquawkContract Currently published contract.
bindings Sequence[CapabilityBinding] Bindings that produced contract.
draft CapabilityBinding Drafted deterministic binding from :meth:draft.
approver str Identity of the approving human.

Returns: SquawkContract — The rebuilt contract.

Raises:

  • ValueError — If the draft targets an unknown capability, is not deterministic, changes its category, I/O or policy, or violates the version rules.

Class PromotionCandidate

A repeated LLM-backed call pattern worth promoting to a deterministic capability.

Fields:

Field Type Default Description
cap_id str
args_digest str
llm_backed_calls int
deterministic_calls int
ratio float

Alias ServedLedger

Re-exported from parrot.squawk.server.ledger.ServedLedger.

Alias ServedLedgerEntry

Re-exported from parrot.interagent.ServedLedgerEntry.

Alias SquawkCapability

Re-exported from parrot.interagent.SquawkCapability.

Alias SquawkContract

Re-exported from parrot.interagent.SquawkContract.

Alias build_contract

Re-exported from parrot.squawk.contract.build_contract.

Alias check_version_rules

Re-exported from parrot.squawk.contract.bindings.check_version_rules.

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