Skip to content

API Reference parrot_formdesigner.services.sandbox.broker

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

parrot_formdesigner.services.sandbox.broker

View source

Host broker: manifest-allowlisted I/O for tier BROKERED/TOOLKIT (FEAT-459 / M11).

Runs in the TRUSTED process. Tier 3/4 workers issue typed BrokerRequests over the worker channel (TASK-3168's protocol) instead of touching a socket directly; this class validates each request against the snippet's declared CapabilityManifest.allowlist and performs the I/O itself.

Deny-by-default: any request kind/target not explicitly present in the allowlist raises CapabilityDenied and is logged as a security event.

Alias BrokerRequest

Re-exported from parrot_formdesigner.services.sandbox.protocol.BrokerRequest.

Alias BrokerResponse

Re-exported from parrot_formdesigner.services.sandbox.protocol.BrokerResponse.

Alias CapabilityDenied

Re-exported from parrot_formdesigner.core.snippets.CapabilityDenied.

Alias CapabilityManifest

Re-exported from parrot_formdesigner.core.snippets.CapabilityManifest.

Alias CapabilityTier

Re-exported from parrot_formdesigner.core.snippets.CapabilityTier.

Class HostBroker

Validates and executes BrokerRequests against a manifest allowlist.

Parameter Type Default Description
max_calls_per_invocation int 10 Hard cap on handle() calls for a single snippet execution. 10 is a conservative starting default (not spec-mandated — the spec's OQ-6 table covers pool sizing, not broker call limits) chosen so a misbehaving or compromised-manifest snippet cannot loop indefinitely against an allowlisted host; tune via a follow-up if real broker traffic patterns justify a different number. A NEW HostBroker instance (or an explicit reset) is required per snippet invocation — this counter is NOT request-scoped by itself.

Method HostBroker.handle

Validate and execute one BrokerRequest.

Note: extends the spec §2 skeleton's handle(request, manifest) signature with required tenant/handler_ref keyword-only args — needed to satisfy the spec's own §5 AC that a denial log include both, which BrokerRequest itself does not carry.

handle(request: BrokerRequest, manifest: CapabilityManifest, *, tenant: str | None, handler_ref: str) -> BrokerResponse

Parameter Type Default Description
request BrokerRequest The typed request from a tier 3/4 worker.
manifest CapabilityManifest The executing snippet's CapabilityManifest.
tenant str | None For the security log event only.
handler_ref str For the security log event only.

Returns: BrokerResponse — BrokerResponse with the I/O result.

Raises:

  • CapabilityDenied — request is outside the allowlist, OR the per-invocation call cap has been exceeded.

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