Skip to content

API Reference parrot_tools.scraping.plan

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

parrot_tools.scraping.plan

View source

ScrapingPlan & PlanRegistryEntry Models.

Pydantic v2 models for declarative scraping plans and registry index entries. ScrapingPlan is a value object — immutable once saved to disk.

Alias BrowserAction

Re-exported from parrot_tools.scraping.models.BrowserAction.

Class PlanRegistryEntry

Entry in the PlanRegistry index mapping a plan to its disk location.

Fields:

Field Type Default Description
name str
plan_version str
url str
domain str
fingerprint str ''
path str
created_at datetime
last_used_at Optional[datetime] None
use_count int 0
tags List[str]
consecutive_failures int 0

Class ScrapingPlan

Declarative scraping plan — value object, immutable once saved.

Auto-populates domain, name, and fingerprint from the URL in model_post_init.

Fields:

Field Type Default Description
name Optional[str] None
version str '1.0'
tags List[str]
url str
domain str ''
objective str
steps List[Dict[str, Any]]
selectors Optional[List[Dict[str, Any]]] None
browser_config Optional[Dict[str, Any]] None
follow_selector Optional[str] None
follow_pattern Optional[str] None
max_depth Optional[int] None
created_at datetime
updated_at Optional[datetime] None
source str 'llm'
fingerprint str ''

Attributes:

Attribute Type Description
normalized_url str Strip query params and fragments for stable fingerprinting.

Method ScrapingPlan.model_post_init

Auto-populate domain, name, and fingerprint from URL.

model_post_init(__context: Any) -> None

Parameter Type Default Description
__context Any

Method ScrapingPlan.validate_steps

Parse self.steps into typed :class:BrowserAction instances.

Opt-in: never called automatically (construction/deserialization does not validate), so no existing caller of the untyped steps: List[ Dict[str, Any]] field breaks. Intended to be called explicitly before a driver is created (FEAT-453, Module 3, Goal G2), so a malformed plan fails before the browser opens rather than half-way through an accounting workflow.

validate_steps(*, strict: bool = True) -> List[BrowserAction]

Parameter Type Default Description
strict bool True If True (default), raises on the first invalid step. If False, collects every step's error and raises once with all of them — a lint-style report over an entire plans directory.

Returns: List[BrowserAction] — The typed actions, in step order.

Raises:

  • ValueError — One or more steps are invalid. The message names the step index and the underlying Pydantic validation error (which itself names the offending field, e.g. a missing required field or an unrecognized action value).

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