Skip to content

API Reference parrot.semantic.handoff

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

parrot.semantic.handoff

View source

Guarded host dataset-sink contract and per-read semantic authorization.

Class GovernedDatasetSink

Trusted host adapter; every exposure invokes the registered read authorizer.

Attributes:

Attribute Type Description
scope_id str
owner tuple[str, str, str, str]
guarded_reads Literal[True]

Method GovernedDatasetSink.publish

Publish privately without exposing an unguarded manager or source.

publish(name: str, handle: ResultHandle, authorize_read: ReadAuthorizer) -> dict[str, Any]

Parameter Type Default Description
name str
handle ResultHandle
authorize_read ReadAuthorizer

Returns: dict[str, Any]

Class GovernedSinkRegistry

Explicit host registration of sinks; capability flags alone grant nothing.

Parameter Type Default Description
max_entries int 1024 Maximum registered scopes; the least recently registered is evicted.

Method GovernedSinkRegistry.register

Register or refresh a validated sink keyed by owner and scope.

An equivalent sink re-created for the same owner and scope replaces the previous entry. A scope already bound to a different owner, or an owner already bound to a different scope, is rejected.

register(sink: GovernedDatasetSink) -> None

Parameter Type Default Description
sink GovernedDatasetSink Trusted host adapter.

Raises:

  • SemanticResultError — If validation fails or the scope/owner is bound elsewhere.

Method GovernedSinkRegistry.is_registered

Return whether this exact sink instance was registered.

is_registered(sink: object) -> bool

Parameter Type Default Description
sink object

Returns: bool

Method GovernedSinkRegistry.publish

Publish a handle through a registered sink after all guards pass.

All checks run before the sink is called so no rejected request has side effects.

publish(sink: GovernedDatasetSink, name: str, handle: ResultHandle, authorize_read: ReadAuthorizer, *, identity: SemanticRequestIdentity) -> dict[str, Any]

Parameter Type Default Description
sink GovernedDatasetSink Previously registered sink.
name str Dataset name.
handle ResultHandle Retained result to publish.
authorize_read ReadAuthorizer Callback the sink must invoke on every exposure.
identity SemanticRequestIdentity Current trusted caller identity.

Returns: dict[str, Any] — Sink metadata, never a raw manager, source or dataframe.

Raises:

  • SemanticResultError — When the sink is unregistered, owner differs, or authorization fails.

Alias LoadedModel

Re-exported from parrot.semantic.loader.LoadedModel.

Alias PbacGate

Re-exported from parrot.semantic.governance.pbac.PbacGate.

Alias PhysicalResources

Re-exported from parrot.tools.dataset_manager.sources.resolver.PhysicalResources.

Attribute ReadAuthorizer

Alias ResultHandle

Re-exported from parrot.semantic.results.ResultHandle.

Alias RoleCatalog

Re-exported from parrot.semantic.catalog.RoleCatalog.

Alias SemanticRequestIdentity

Re-exported from parrot.semantic.context.SemanticRequestIdentity.

Alias SemanticResultError

Re-exported from parrot.semantic.errors.SemanticResultError.

Function build_read_authorizer

Close over copied provenance; reload current policy before every read.

build_read_authorizer(handle: ResultHandle, *, models: Callable[[], dict[str, LoadedModel]], catalog: Callable[[], RoleCatalog], pbac: PbacGate) -> ReadAuthorizer

Parameter Type Default Description
handle ResultHandle Retained result whose provenance is copied (never mutated afterwards).
models Callable[[], dict[str, LoadedModel]] Provider of the current model snapshot.
catalog Callable[[], RoleCatalog] Provider of the current role catalog.
pbac PbacGate Fail-closed PBAC gate.

Returns: ReadAuthorizer — An async callback raising :class:SemanticResultError on any denial or failure.

Function handle_owner

Return the immutable (agent, user, tenant, session) owner tuple of a handle.

handle_owner(handle: ResultHandle) -> tuple[str, str, str, str]

Parameter Type Default Description
handle ResultHandle

Returns: tuple[str, str, str, str]

Alias subject_digest

Re-exported from parrot.semantic.governance.pipeline.subject_digest.

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