Skip to content

API Reference parrot.handlers.studio.storage.services._common

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

parrot.handlers.studio.storage.services._common

View source

Shared foundation of the Studio services (spec §2.5/§2.5b): limits, allowlists, validators, gate, container.

Attribute ALLOWLIST_APP_KEY

Attribute MAX_ASSET_NAME_LENGTH

Alias NormalizedTooling

Re-exported from parrot.tools.spec.NormalizedTooling.

Class StudioAgentAssetsQuota

The agent's total asset bytes would exceed the quota (413 agent_assets_quota).

Alias StudioAgentDefinition

Re-exported from parrot.handlers.studio.storage.models.StudioAgentDefinition.

Alias StudioAgentService

Re-exported from parrot.handlers.studio.storage.services.agents.StudioAgentService.

Class StudioAssetFileTooLarge

One asset over its per-kind cap (413 asset_too_large).

Alias StudioAssetInput

Re-exported from parrot.handlers.studio.storage.models.StudioAssetInput.

Alias StudioAssetService

Re-exported from parrot.handlers.studio.storage.services.assets.StudioAssetService.

Alias StudioAssetTooLarge

Re-exported from parrot.handlers.studio.storage.models.StudioAssetTooLarge.

Class StudioBinaryAssetRefused

Assets are text only (415 binary_assets_unsupported).

Class StudioClassAllowlist

Bot classes a tenant partition may use: parrot.bots.__all__ plus host additions.

Parameter Type Default Description
extra Iterable[str] ()

Method StudioClassAllowlist.from_app

Host additions come from app["studio_class_allowlist"].

from_app(app: Any) -> 'StudioClassAllowlist'

Parameter Type Default Description
app Any

Returns: 'StudioClassAllowlist'

Method StudioClassAllowlist.names

Every class name a tenant partition may use.

names() -> frozenset[str]

Returns: frozenset[str]

Method StudioClassAllowlist.allows

Tenant partitions: allowlist only. The non-tenant partition keeps get_bot_class resolution.

allows(part: StudioPartition, bot_class: str) -> bool

Parameter Type Default Description
part StudioPartition
bot_class str

Returns: bool

Alias StudioDraftService

Re-exported from parrot.handlers.studio.storage.services.drafts.StudioDraftService.

Class StudioLimits

Asset size limits (spec §2.5 table).

Parameter Type Default Description
identity_max int 64 * _KIB
kb_max int 256 * _KIB
skills_max int 128 * _KIB
agent_total_max int 4 * _KIB * _KIB

Fields:

Field Type Default Description
identity_max int 64 * _KIB
kb_max int 256 * _KIB
skills_max int 128 * _KIB
agent_total_max int 4 * _KIB * _KIB

Method StudioLimits.from_config

Read the STUDIO_ASSET_MAX_BYTES_* / STUDIO_AGENT_MAX_ASSET_BYTES settings.

from_config() -> 'StudioLimits'

Returns: 'StudioLimits'

Method StudioLimits.max_for

Per-file cap of an asset kind.

max_for(kind: str) -> int

Parameter Type Default Description
kind str

Returns: int

Alias StudioPartition

Re-exported from parrot.handlers.studio.storage.models.StudioPartition.

Alias StudioRepositories

Re-exported from parrot.handlers.studio.storage.repositories.StudioRepositories.

Class StudioServices

The services of one app, built over one :class:StudioRepositories.

Parameter Type Default Description
repos StudioRepositories
agents 'StudioAgentService'
assets 'StudioAssetService'
tooling 'StudioToolingService'
drafts 'StudioDraftService'
skills 'StudioSkillCatalogService'

Fields:

Field Type Default Description
repos StudioRepositories
agents 'StudioAgentService'
assets 'StudioAssetService'
tooling 'StudioToolingService'
drafts 'StudioDraftService'
skills 'StudioSkillCatalogService'

Alias StudioSkillCatalogService

Re-exported from parrot.handlers.studio.storage.services.catalog.StudioSkillCatalogService.

Class StudioToolingGate

Storage-side call into the host-owned tenant tooling policy (spec §2.5b).

Parameter Type Default Description
app web.Application

Method StudioToolingGate.enforce

enforce_tenant_tooling on the FINAL normalised tooling; TenantToolingRefused → StudioToolingRefused.

before is the tooling stored ahead of this write: what it leaves unchanged is not re-validated against the tenant toolkit allow-list (only toolkits added or re-configured are); None checks everything.

enforce(part: StudioPartition, tooling: NormalizedTooling, *, agent_id: UUID | None, actor: str | None, phase: Literal['write', 'activate', 'build'], before: NormalizedTooling | None = None) -> None

Parameter Type Default Description
part StudioPartition
tooling NormalizedTooling
agent_id UUID | None
actor str | None
phase Literal['write', 'activate', 'build']
before NormalizedTooling | None None

Alias StudioToolingRecord

Re-exported from parrot.handlers.studio.storage.models.StudioToolingRecord.

Alias StudioToolingRefused

Re-exported from parrot.handlers.studio.storage.models.StudioToolingRefused.

Alias StudioToolingService

Re-exported from parrot.handlers.studio.storage.services.tooling.StudioToolingService.

Class StudioValidationError

A request-shape refusal; code is the X14 error code the handlers map (422 unless status says so).

Parameter Type Default Description
message str
code str | None None
status int | None None

Attributes:

Attribute Type Description
code str
status int

Attribute VISIBILITY_DOMAIN

Function build_studio_services

Wire every service (modules are imported here: they land in later tasks).

build_studio_services(app: web.Application, repos: StudioRepositories) -> StudioServices

Parameter Type Default Description
app web.Application
repos StudioRepositories

Returns: StudioServices

Attribute logger

Alias normalize_tooling

Re-exported from parrot.tools.spec.normalize_tooling.

Function normalized_tooling_for

The tooling the builder will see: definition.tools plus the stored rows, via normalize_tooling.

normalized_tooling_for(definition: StudioAgentDefinition, tooling_rows: Sequence[StudioToolingRecord]) -> NormalizedTooling

Parameter Type Default Description
definition StudioAgentDefinition
tooling_rows Sequence[StudioToolingRecord]

Returns: NormalizedTooling

Function studio_runtime_dir

STUDIO_RUNTIME_DIR (default <tempdir>/parrot-studio-<pid>); never under AGENTS_DIR.

studio_runtime_dir() -> Path

Returns: Path

Function validate_asset_input

Validate one asset (text only, safe name, per-kind filename rules, size cap, skill frontmatter).

validate_asset_input(limits: StudioLimits, asset: StudioAssetInput) -> int

Parameter Type Default Description
limits StudioLimits
asset StudioAssetInput

Returns: int — The UTF-8 byte size of the content.

Raises:

  • StudioBinaryAssetRefused — content_type is not text/* (415).
  • StudioValidationError — unsafe or kind-invalid name, NUL/lone-surrogate content, invalid skill frontmatter (422).
  • StudioAssetFileTooLarge — over the per-kind cap (413).

Function validate_definition_for

Bot class (tenant allowlist), tenant config keys (422 unsupported_config_key) and visibility domain.

validate_definition_for(part: StudioPartition, definition: StudioAgentDefinition, *, allowlist: StudioClassAllowlist | None = None, visibility: str = 'private', allowed_groups: Sequence[str] = ()) -> None

Parameter Type Default Description
part StudioPartition
definition StudioAgentDefinition
allowlist StudioClassAllowlist | None None
visibility str 'private'
allowed_groups Sequence[str] ()

Function validate_visibility

Visibility domain; the non-tenant partition is always private (mirrors the DB CHECKs).

validate_visibility(part: StudioPartition, visibility: str, allowed_groups: Sequence[str] = ()) -> None

Parameter Type Default Description
part StudioPartition
visibility str
allowed_groups Sequence[str] ()

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