agora.plan

Plan package — declarative v2.0 plan format layered on top of agora.core.flow.

A plan is a Flow (existing YAML template with agents + task DAG) extended with:

  • Typed postcondition references resolved via agora.plan.predicate_registry.

  • Optional stage templates for per-task staged execution.

  • output_path hints that travel with the task.

The loader returns the triple (agents, tasks, staged_tasks) that agora.fleet.orchestrator.Orchestrator.run_project() already consumes — no orchestrator changes required.

class agora.plan.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.build_predicate(name, args=None)[source]

Construct a Predicate by registered name + kwargs.

agora.plan.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.list_registered_predicates()[source]

Sorted list of registered predicate names (useful for generating docs + planner KB).

agora.plan.load_plan(path)[source]

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

agora.plan.register_predicate(name)[source]

Decorator: register factory under name.

Factories must accept only JSON-serializable kwargs (str, int, float, bool, list, dict). Callers should not register from within tests at import time — see tests/plan/conftest.py for the cleanup pattern if a test needs to add a predicate temporarily.

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

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

Modules

api_spec

Parse the plan-builder's shared API spec into structured module specs.

builder

Mutable in-memory plan state for tool-driven plan authoring.

handoff

Agora handoff — mechanical PROJECT_STATE.md assembly (integration run 2.4).

harness

Reusable orchestrator harness for plan runners.

loader

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

module_editor

AST-aware upsert helpers for Python source files.

predicate_registry

Named-predicate registry: the bridge between YAML plan references and runtime Predicates.

probe_predicates

Probe-specific postconditions for the tool-call fidelity probe (axis 1).

run_check

run_check postcondition predicate — execute a command, gate on its result.

structure

Structural models of plan artifacts + comparators for cross-layer drift.

test_scaffolder

Pure helpers for the plan_scaffold_tests framework stage.