Skip to content

API Reference parrot_tools.business_automation.smoke

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

parrot_tools.business_automation.smoke

View source

SmokeCheck — scheduled canary mechanism (FEAT-453, Decision D4).

Every TemplatePlan in this feature is selector-bound to a third-party site nobody controls. When that site's DOM changes, every operation breaks at once, and the operator otherwise finds out only when a real write fails half-way through. A scheduled canary that runs a READ-kind operation turns that into an alert before any write is attempted.

Per Decision D4, the split follows the same public/private seam as the rest of the engine: this mechanism is public and domain-neutral; the actual canary plan it runs (e.g. a login + dashboard read for a specific site) is private, out-of-repo (Deliverable X). Tests exercise the mechanism only, against a mocked flow executor — never a real third-party site.

Alias BusinessAutomationToolkit

Re-exported from parrot_tools.business_automation.toolkit.BusinessAutomationToolkit.

Alias OperationKind

Re-exported from parrot_tools.business_automation.models.OperationKind.

Class SmokeCheck

Scheduled canary: runs one READ-kind operation and alerts on failure.

Fields:

Field Type Default Description
operation str Must resolve to :class:~parrot_tools.business_automation.models.OperationKind.READ — enforced at :func:register_smoke registration time, not run time (Decision D4 / Key Constraint: a canary must never write).
cron str 5-field cron expression forwarded to :meth:~parrot.scheduler.inprocess.InProcessScheduler.add_cron.
alert_channel str 'telegram' Channel label carried for operator reference; the actual :class:HumanChannel instance is injected into :func:register_smoke separately (this field documents intent, e.g. for a runbook, rather than resolving a channel by name).

Attribute logger

Function register_smoke

Register a :class:SmokeCheck canary job on scheduler.

Refuses at registration time — before any job is scheduled — to accept an operation that is not :class:OperationKind.READ. A canary that fires a SUBMIT or DRAFT operation on a schedule is not a smoke test, it is an unattended write, which is exactly what Decision D2 exists to prevent.

register_smoke(scheduler: InProcessScheduler, toolkit: BusinessAutomationToolkit, check: SmokeCheck, *, channel: Optional[HumanChannel] = None, recipient: str = _DEFAULT_RECIPIENT) -> str

Parameter Type Default Description
scheduler InProcessScheduler The :class:~parrot.scheduler.inprocess.InProcessScheduler to register the job on.
toolkit BusinessAutomationToolkit The :class:BusinessAutomationToolkit whose operation registry is consulted (and whose run_operation executes the canary).
check SmokeCheck The :class:SmokeCheck definition.
channel Optional[HumanChannel] None Optional :class:HumanChannel to alert on failure.
recipient str _DEFAULT_RECIPIENT Alert recipient label.

Returns: str — The APScheduler job id.

Raises:

  • ValueError — If check.operation is unregistered, or is not OperationKind.READ.

Function run_smoke_check

Run check once and alert over channel on failure — silent on pass.

run_smoke_check(toolkit: BusinessAutomationToolkit, check: SmokeCheck, *, channel: Optional[HumanChannel] = None, recipient: str = _DEFAULT_RECIPIENT, poll_interval: float = 0.1, poll_timeout: float = 30.0) -> Dict[str, Any]

Parameter Type Default Description
toolkit BusinessAutomationToolkit The :class:BusinessAutomationToolkit to run the canary operation through.
check SmokeCheck The :class:SmokeCheck to execute.
channel Optional[HumanChannel] None Optional :class:HumanChannel to alert on failure.
recipient str _DEFAULT_RECIPIENT Alert recipient label.
poll_interval float 0.1 Seconds between polls of the background run's status.
poll_timeout float 30.0 Maximum seconds to wait for the run to finish before treating it as a (alerted) timeout.

Returns: Dict[str, Any] — The final run record ({"status": ..., ...}).

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