Skip to content

API Reference parrot.autonomous.transport.filesystem.reservation

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

parrot.autonomous.transport.filesystem.reservation

View source

ReservationManager — cooperative resource reservations via filesystem.

Class ReservationManager

Cooperative resource reservation using JSON files on the filesystem.

Agents declare which resources they are working on so others can avoid collisions. Reservations are advisory (cooperative), not enforced at OS level. They use all-or-nothing semantics: if any requested resource is held by another agent, the entire acquisition fails.

Resource paths are hashed to SHA-256 prefix filenames to avoid filesystem path issues.

Parameter Type Default Description
reservations_dir Path Path to the reservations directory.
agent_id str The agent ID that owns reservations from this manager.

Method ReservationManager.acquire

Acquire reservations on a list of resources (all-or-nothing).

If any resource is held by another agent and not expired, the entire acquisition fails and no reservations are written.

The same agent can re-acquire a resource it already holds.

acquire(paths: List[str], reason: str = '', timeout: Optional[float] = None) -> bool

Parameter Type Default Description
paths List[str] List of resource identifiers to reserve.
reason str '' Human-readable reason for the reservation.
timeout Optional[float] None TTL in seconds for the reservation. Defaults to _DEFAULT_TIMEOUT.

Returns: bool — True if all resources were acquired, False if any conflict.

Method ReservationManager.release

Release reservations on specific resources.

Only removes reservation files owned by this agent.

release(paths: List[str]) -> None

Parameter Type Default Description
paths List[str] List of resource identifiers to release.

Method ReservationManager.release_all

Release all reservations owned by this agent.

release_all() -> None

Method ReservationManager.list_active

List all non-expired reservations.

list_active() -> List[Dict[str, Any]]

Returns: List[Dict[str, Any]] — List of reservation dicts that have not expired.

Attribute logger

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