Skip to content

API Reference parrot.tools.execution_plan.models

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

parrot.tools.execution_plan.models

View source

Toolkit-internal models for ExecutionPlanToolkit.

RunRecord/RunningSummary are the run-registry data models (spec §2 Data Models). The live asyncio.Task/AgentsFlow handle for a run is deliberately NOT a field here — it stays out-of-band in the toolkit's own internal dict so this model stays a plain, extra="forbid" serializable record.

Tool-argument schemas (PlanStatusArgs, PlanArtifactsArgs, PlanExecuteArgs, PlanValidateArgs) follow the repo's AbstractToolArgsSchema convention (see .agent/workflows/create-parrot-tool.md).

Attribute ArtifactMode

Attribute PLAN_RUN_SCHEMA_VERSION

Type: int

Attribute PLAN_RUN_SHARED_KEY

Type: str

Class PlanArtifactsArgs

Arguments for the plan_artifacts tool.

Attributes:

Attribute Type Description
run_id str

Class PlanDelta

Replacement nodes for a runtime repair — never a standalone plan (spec §2).

Fields:

Field Type Default Description
nodes List[PlanNode] Replacement PlanNodes keyed by their existing id.

Class PlanExecuteArgs

Arguments for the plan_execute tool.

Exactly one of objective/plan_name must be set.

Attributes:

Attribute Type Description
objective Optional[str]
plan_name Optional[str]
params Optional[Dict[str, Any]]

Class PlanRecoveryConfig

Host-only recovery policy for ExecutionPlanToolkit (spec §2, §8 D1).

Fields:

Field Type Default Description
max_repair_rounds int 2 Runtime repair rounds per run; 0 disables plan_repair.
max_restore_bytes int 67108864 Cumulative exact-version restore budget per continuation.
checkpoint_probe_timeout float 2.0 Seconds for the pre-dispatch store probe.

Class PlanRecoveryEnvelope

Recovery/lineage fields every run response carries (spec §2 Recovery capabilities).

Fields:

Field Type Default Description
run_id str Run id.
root_run_id str Lineage root.
parent_run_id Optional[str] None Parent, for repair children.
checkpoint_enabled bool Whether this run acknowledged checkpoints.
artifact_mode ArtifactMode memory | durable.
resume_level ResumeLevel Storage capability: none | process | cross_restart.
resumable bool Capability AND current status/lease/artifact availability.
recovery_reason Optional[str] None Why resumable is False, when it is.
repair_attempts_used int 0 Repair attempts consumed so far.
max_repair_rounds int 2 Host repair limit.
active_child_run_id Optional[str] None Active child continuation.

Class PlanRepairArgs

Arguments for plan_repair — run id only.

Attributes:

Attribute Type Description
run_id str

Class PlanResumeArgs

Arguments for plan_resume — run id only (spec §2: no scope/allowlist/limits).

Attributes:

Attribute Type Description
run_id str

Class PlanRun

Derived, never-persisted view of one run resolved from its checkpoint (spec §2).

Fields:

Field Type Default Description
metadata PlanRunMetadata The persisted envelope.
checkpoint_id Optional[int] None Checkpoint this view was derived from.
status RunStatus Current run status.
refs List[ArtifactRef] Typed per-node refs in original node order.
nodes_done int 0 Nodes with a terminal per-node status.
checkpoint_enabled bool Whether checkpoints were acknowledged.
resume_level ResumeLevel Storage capability.
resumable bool Whether plan_resume may continue this run now.
recovery_reason Optional[str] None Why not resumable.
dispatched_node_ids List[str] Nodes recorded as dispatched or completed.

Class PlanRunError

Structured, bounded run error that maps to the §2 ToolResult error shape.

Parameter Type Default Description
code str
message str
envelope Optional[PlanRecoveryEnvelope] None
manifest Optional[PlanRunManifest] None

Method PlanRunError.to_tool_result

Build ToolResult(status="error", success=False, error=..., result={"code": ...}).

to_tool_result() -> ToolResult

Returns: ToolResult

Class PlanRunManifest

Terminal response: frozen manifest keys at top level + recovery envelope (additive).

Attributes:

Attribute Type Description
status RunStatus

Class PlanRunMetadata

Versioned plan_run document persisted in the checkpoint shared-data projection.

Fields:

Field Type Default Description
schema_version Literal[1] 1 Envelope schema; mismatch fails closed.
run_id str Opaque UUID run id; equals the AgentsFlow flow_id.
root_run_id str Root of the repair lineage (== run_id for a root run).
parent_run_id Optional[str] None Immediate parent for a repair child.
plan ExecutionPlan Effective validated plan this run executes.
original_plan ExecutionPlan Root plan as originally accepted.
source Literal['objective', 'plan_name', 'repair'] Acquisition mode.
started_at datetime UTC start.
finished_at Optional[datetime] None UTC end, once terminal.
scope_key Optional[str] None TaskScope.cache_key() of the trusted scope, for comparison only.
task_id Optional[str] None Task memory task id, if any.
allowed_tools List[str] Frozen, sorted tool names allowed when the run was accepted.
plan_fingerprint str sha256 of the canonical effective-plan JSON.
artifact_mode ArtifactMode Where artifact bodies live.
process_id Optional[str] None host:pid:nonce for memory-mode artifacts.
repair_attempts_used int 0 Attempts consumed, including interrupted ones.
max_repair_rounds int 2 Snapshot of the host limit at acceptance.
active_child_run_id Optional[str] None Accepted child continuation, if any.
repair_children List[str] Every allocated child id, in order.

Class PlanRunSummary

Live response while a run executes: RunningSummary + recovery envelope.

Attributes:

Attribute Type Description
uncheckpointed_progress bool

Class PlanStatusArgs

Arguments for the plan_status tool.

Attributes:

Attribute Type Description
run_id str

Class PlanValidateArgs

Arguments for the plan_validate tool.

Same shape as :class:PlanExecuteArgs — a dry run never executes.

Attributes:

Attribute Type Description
objective Optional[str]
plan_name Optional[str]
params Optional[Dict[str, Any]]

Attribute ResumeLevel

Class RunRecord

Registry entry for one plan run (toolkit-internal).

Fields:

Field Type Default Description
run_id str Short unique id, e.g. "run_ab12cd".
plan_name str The executed plan's name.
source Literal['objective', 'plan_name'] Which acquisition mode produced the plan.
status Literal['running', 'completed', 'partial', 'failed'] Current run status.
started_at datetime When the run's background task was created.
finished_at Optional[datetime] None When the run reached a terminal status, if it has.
manifest Optional[ExecutionManifest] None The final :class:ExecutionManifest, set on completion.
nodes_total int Total plan nodes (bound for progress reporting).
nodes_done int 0 Nodes that have reached a terminal per-node status (ok/skipped/partial/error) so far.
flow_error Optional[str] None Set when the run failed at the FLOW level (before any manifest could be built) — e.g. an infrastructure error, not a per-node tool failure (those show up inside manifest instead). Bounded to 500 chars.

Attribute RunStatus

Class RunningSummary

What plan_execute returns when soft_timeout elapses first.

Fields:

Field Type Default Description
run_id str
status Literal['running'] 'running'
plan_name str
nodes_total int
nodes_done int
hint str 'poll plan_status(run_id)'

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