Skip to content

API Reference parrot_tools.browsing.composer

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

parrot_tools.browsing.composer

View source

Composer — deterministic expansion of catalogued actions into a flat, executable sequence.

Handles:

  • Prerequisites (SiteAction.requires): injected before the action the first time they are needed; a prerequisite already satisfied earlier in the sequence (e.g. login) is never re-run.
  • Composite actions (kind="composite"): expanded depth-first in declared order, binding child parameters from the parent's parameters.
  • Safety: cycle detection and a hard recursion depth cap, so a broken catalog can never produce an unbounded plan.

Alias ActionCatalog

Re-exported from parrot_tools.browsing.catalog.ActionCatalog.

Attribute MAX_COMPOSE_DEPTH

Class ResolvedAction

One executable entry of an expanded sequence.

Parameter Type Default Description
action SiteAction
params Dict[str, Any]
injected bool False

Fields:

Field Type Default Description
action SiteAction The catalogued action (non-composite by construction).
params Dict[str, Any] Fully-resolved parameter values for this execution.
injected bool False True when the entry was injected as a prerequisite rather than requested explicitly.

Alias SiteAction

Re-exported from parrot_tools.browsing.models.SiteAction.

Function expand_action

Expand one action into a flat list of executable entries.

expand_action(catalog: ActionCatalog, site: str, action_name: str, params: Optional[Dict[str, Any]] = None, *, include_requires: bool = True, _state: Optional[_ExpandState] = None, _depth: int = 0, _injected: bool = False) -> List[ResolvedAction]

Parameter Type Default Description
catalog ActionCatalog Source catalog.
site str Site reference (slug/alias/domain).
action_name str Action to expand.
params Optional[Dict[str, Any]] None Caller-provided parameter values.
include_requires bool True Inject requires prerequisites (deduplicated across the whole expansion).
_state Optional[_ExpandState] None
_depth int 0
_injected bool False

Returns: List[ResolvedAction] — Ordered, flat list of :class:ResolvedAction (composites fully expanded away).

Raises:

  • ValueError — On composition cycles, excessive nesting depth, or missing required parameters.
  • KeyError — When the action (or a referenced action) is missing.

Function expand_sequence

Expand an ordered plan of actions into one flat sequence.

Prerequisites are deduplicated across the WHOLE plan: if the first entry already performed login, later entries requiring it will not re-run it.

expand_sequence(catalog: ActionCatalog, site: str, plan: Sequence[Union[str, Dict[str, Any]]], shared_params: Optional[Dict[str, Any]] = None, *, include_requires: bool = True) -> List[ResolvedAction]

Parameter Type Default Description
catalog ActionCatalog Source catalog.
site str Site reference (slug/alias/domain).
plan Sequence[Union[str, Dict[str, Any]]] Ordered entries — either an action name or a dict of the form {"action": name, "params": {...}}.
shared_params Optional[Dict[str, Any]] None Parameter values applied to every entry (entry params take precedence).
include_requires bool True Inject requires prerequisites.

Returns: List[ResolvedAction] — Ordered, flat list of :class:ResolvedAction.

Raises:

  • ValueError — On malformed plan entries or expansion errors.

Alias render_value

Re-exported from parrot_tools.browsing.templating.render_value.

Alias resolve_params

Re-exported from parrot_tools.browsing.templating.resolve_params.

Alias slugify

Re-exported from parrot_tools.browsing.models.slugify.

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