agora.plan.loader

Plan loader — (agents, tasks, staged_tasks) from a v2.0 plan YAML.

This is the Flow loader layered with staging + predicate-registry plumbing. It reuses every piece of agora.core.flow (YAML I/O, include resolution, variable substitution, Pydantic validation) and adds:

  • Preserved string task ids — needed so a staged_tasks: dict[str, StagedTask] keyed by the YAML’s id still matches after instantiation.

  • StagedTask construction — for every task with stages in the template, build a StagedTask and key it by the task id.

  • Test-task auto-staging (v2.4) — tasks that write a file under tests/ and expect pytest_passes get three framework stages injected (scaffold → llm → run_pytest) so the 7B tester stops guessing imports.

The return triple matches what agora.fleet.orchestrator.Orchestrator.run_project() already consumes, so no orchestrator changes are required.

Functions

instantiate_plan(plan, project_name[, variables])

Build the triple Orchestrator.run_project consumes.

load_plan(path)

Load + validate + resolve includes for a plan YAML, returning a Plan.

save_plan(plan, path)

Serialize a Plan back to YAML (auto-picks v1.0 or v2.0).

Classes

Plan

Thin wrapper over Flow exposing the richer plan shape.

class agora.plan.loader.Plan[source]

Bases: object

Thin wrapper over Flow exposing the richer plan shape.

Currently just the Flow plus convenience accessors; kept as a separate type so future plan-level metadata (version tags, authorship, cost estimates, decision-point lists) can be added without touching the Flow dataclass.

flow: Flow
property name: str
property description: str
property agents: tuple[AgentConfig, ...]
property task_graph
__init__(flow)
agora.plan.loader.instantiate_plan(plan, project_name, variables=None)[source]

Build the triple Orchestrator.run_project consumes.

String task ids are preserved (unlike instantiate_flow() default) so the staged_tasks dict keys match the task.id values downstream. Variable substitution (${project_name} etc.) applies to task descriptions and agent instructions just like a v1.0 flow.

v2.4: transparently wraps test-authoring tasks with a scaffold → llm → verify 3-stage pipeline so the 7B tester stops guessing imports.

agora.plan.loader.load_plan(path)[source]

Load + validate + resolve includes for a plan YAML, returning a Plan.

agora.plan.loader.save_plan(plan, path)[source]

Serialize a Plan back to YAML (auto-picks v1.0 or v2.0).