Skip to content

API Reference parrot_tools.browsing.models

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

parrot_tools.browsing.models

View source

Catalog models for the Web Browsing subsystem.

A site groups a set of named, parameterized actions ("guiones"): deterministic scripts expressed with the same BrowserAction DSL used by WebScrapingToolkit (parrot_tools.scraping.models). Actions are stored on disk — one folder per site, one JSON file per action — so an agent can resolve a natural-language request ("inicia sesión en Hooba") to a concrete, replayable step sequence.

Attribute ActionKind

Class ActionParam

Declared parameter of a :class:SiteAction.

Parameters are substituted into step string fields via {{name}} placeholders before execution (see :func:parrot_tools.browsing.templating.render_steps).

Fields:

Field Type Default Description
description str ''
required bool True
default Optional[Any] None
example Optional[str] None

Class ActionRunSummary

Outcome of executing ONE resolved action within a sequence.

Fields:

Field Type Default Description
action str
kind ActionKind 'operation'
success bool
error Optional[str] None
extracted_data Dict[str, Any]
elapsed_ms int 0
injected bool False

Class ComposedRef

One entry of a composite action: a reference to a sibling action.

Fields:

Field Type Default Description
action str
params Dict[str, Any]

Attribute RESERVED_PLACEHOLDERS

Class SequenceRunResult

Outcome of a full (possibly composite) action run.

Fields:

Field Type Default Description
success bool
site str
requested List[str]
executed List[ActionRunSummary]
extracted_data Dict[str, Any]
stopped_early bool False

Class SiteAction

A catalogued, deterministic script for one site.

Non-composite actions carry steps — raw dicts in the BrowserAction DSL (the same shape ScrapingPlan.steps uses); call :meth:validate_steps to type-check them. Composite actions carry compose instead: an ordered list of references to sibling actions.

Fields:

Field Type Default Description
site str ''
name str
title str ''
description str
kind ActionKind 'operation'
params Dict[str, ActionParam]
steps List[Dict[str, Any]]
compose List[ComposedRef]
requires List[str]
tags List[str]
version str '1.0'
source str 'user'
created_at datetime
updated_at Optional[datetime] None

Method SiteAction.validate_steps

Type-check steps against the BrowserAction DSL.

Collects every step's validation error and raises once, so a malformed script fails at save time — before any browser opens.

validate_steps() -> None

Raises:

  • ValueError — One or more steps are invalid; the message names each offending step index.

Method SiteAction.summary

Compact projection for catalog listings shown to the LLM.

summary() -> Dict[str, Any]

Returns: Dict[str, Any]

Class SiteInfo

Metadata of a catalogued site (one folder in the catalog).

Fields:

Field Type Default Description
site str ''
base_url str
title str ''
description str ''
aliases List[str]
created_at datetime
updated_at Optional[datetime] None

Attributes:

Attribute Type Description
domain str Netloc of base_url (without credentials/port handling).

Method SiteInfo.model_post_init

Auto-derive slug and title from the base URL when omitted.

model_post_init(__context: Any) -> None

Parameter Type Default Description
__context Any

Method SiteInfo.matches

Check whether query plausibly refers to this site.

Matches (case-insensitive) against slug, aliases, domain (with and without a www. prefix), base URL, and title.

matches(query: str) -> bool

Parameter Type Default Description
query str

Returns: bool

Class WebTaskEntry

One step of a :class:WebTaskRequest plan.

Fields:

Field Type Default Description
action str
data Dict[str, Any]

Class WebTaskRequest

Structured browsing request an LLM prepares from natural language.

This is the single, deterministic contract between an agent and the toolkit: the LLM turns "register a customer at hooba" into {"site": "hooba", "action": "register-customer", "data": {...}} and the toolkit resolves the site's catalog, loads the script and replays it with the provided data — no improvised navigation.

Exactly ONE of action (single intent) or plan (ordered multi-action flow) must be set.

Fields:

Field Type Default Description
site str
action Optional[str] None
data Dict[str, Any]
plan Optional[List[WebTaskEntry]] None
include_requires bool True
stop_on_error bool True

Function slugify

Convert an arbitrary name into a filesystem-safe slug.

slugify(value: str) -> str

Parameter Type Default Description
value str Raw name (site or action).

Returns: str — Lowercase slug containing only [a-z0-9-].

Raises:

  • ValueError — If nothing remains after sanitization.

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