Skip to content

API Reference parrot.interagent.handles

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

parrot.interagent.handles

View source

Owner-bound artifact handles for transport-free inter-agent exchange.

Class ArtifactHandle

Reference artifact bytes through bounded metadata and provenance.

Fields:

Field Type Default Description
key str
media_type MediaType
byte_size int
ttl_s int
expires_at datetime
owner HandleOwner
grants tuple[str, ...] ()
descriptor HandleDescriptor
provenance HandleProvenance
affordances tuple[str, ...] ()

Attribute HANDLE_UNAVAILABLE

Class HandleClaimError

Report every failed handle claim without revealing why it failed.

Alias HandleDescriptor

Re-exported from parrot.interagent.descriptors.HandleDescriptor.

Class HandleOwner

Identify the agent, user, tenant, and session that own a handle.

Fields:

Field Type Default Description
agent_id str
user_id str
tenant_id str
session_id str

Alias HandleProvenance

Re-exported from parrot.interagent.provenance.HandleProvenance.

Class HandleStore

Store owner-bound handles and enforce claim and grant authorization.

Method HandleStore.put

Store a handle and return its content key.

put(handle: ArtifactHandle) -> str

Parameter Type Default Description
handle ArtifactHandle

Returns: str

Method HandleStore.claim

Return an unexpired handle to its owner or an explicitly granted agent.

claim(key: str, *, owner: HandleOwner, grantee: str | None = None) -> ArtifactHandle

Parameter Type Default Description
key str
owner HandleOwner
grantee str | None None

Returns: ArtifactHandle

Method HandleStore.grant

Grant access to an agent when requested by the handle owner.

grant(key: str, *, owner: HandleOwner, grantee: str) -> ArtifactHandle

Parameter Type Default Description
key str
owner HandleOwner
grantee str

Returns: ArtifactHandle

Class InMemoryHandleStore

Provide a bounded, asyncio-safe handle store for one process.

Records are keyed by (key, owner): handle keys are content addresses, so two owners producing identical bytes share a key but never a record. One owner can never replace, reset or revoke another owner's handle.

Parameter Type Default Description
max_entries int 4096

Method InMemoryHandleStore.put

Store a handle for its owner, evicting the oldest entry when at capacity.

Re-putting the same key for the same owner refreshes that owner's record and keeps its existing grants; other owners' records are untouched.

put(handle: ArtifactHandle) -> str

Parameter Type Default Description
handle ArtifactHandle Handle to store.

Returns: str — The stored handle key.

Method InMemoryHandleStore.claim

Claim an unexpired handle without disclosing failure details.

The caller's own record wins; otherwise a record of another owner that explicitly granted grantee is returned.

claim(key: str, *, owner: HandleOwner, grantee: str | None = None) -> ArtifactHandle

Parameter Type Default Description
key str Content-addressed handle key.
owner HandleOwner Full owner tuple asserted by the caller.
grantee str | None None Agent identity used for explicit grant access.

Returns: ArtifactHandle — The claimed handle.

Raises:

  • HandleClaimError — If the handle is missing, expired, or unauthorized.

Method InMemoryHandleStore.grant

Grant handle access to an agent when requested by its owner.

grant(key: str, *, owner: HandleOwner, grantee: str) -> ArtifactHandle

Parameter Type Default Description
key str Content-addressed handle key.
owner HandleOwner Full owner tuple asserted by the caller.
grantee str Agent identity to authorize.

Returns: ArtifactHandle — The updated immutable handle.

Raises:

  • HandleClaimError — If the caller holds no record for the key.

Alias MediaType

Re-exported from parrot.interagent.descriptors.MediaType.

Function handle_key

Build a content-addressed SHA-256 handle key.

handle_key(data: bytes) -> str

Parameter Type Default Description
data bytes Exact artifact bytes.

Returns: str — A key prefixed with sha256:.

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