Skip to main content

enterprise_ai.loop.plan

Source: sdks/python/src/enterprise_ai/loop/plan.py. Back to the Python SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Model PlanStep​

One step of a RunPlan: identifier, title, dependencies, status and evidence.

Fields:

NameTypeRequiredDescription
idstryesIdentifier of the step, unique in the plan.
titlestryesShort human readable title of the step.
depends_onlist[str]noIdentifiers of the steps that must be done before this one can start; empty by default.
statusstrnoState of the step: pending (default), in_progress, done or skipped.
evidencestr | NonenoEvidence of the measures (logs, timestamps, screenshots references...).

Class RunPlan​

Ordered plan steps with dependencies.

Attributes:

NameTypeRequiredDescription
clientyesEnterprise AI client used to mirror the plan as run steps, or None.
currentPlanStep | NoneyesThe step with status in_progress, or None.
doneboolyesTrue when every step of the plan is done.
run_idyesIdentifier of the run the plan is mirrored to, or None.
stepsdict[str, PlanStep]yesSteps of the plan by identifier (a dict of PlanStep), in insertion order.

Constructor RunPlan​

RunPlan(steps: list[PlanStep | dict[str, Any]] | None = None, client: Any = None, run_id: str | None = None) -> None

Load the steps, then start the first ready one; each change is mirrored as a run step of kind plan when client and run_id are given.

NameTypeDefaultRequiredDescription
stepslist[PlanStep | dict[str, Any]] | NoneNonenoInitial steps, as PlanStep objects or dicts with id, title and depends_on, in order.
clientAnyNonenoParent client.
run_idstr | NoneNonenoIdentifier of the run the plan steps are mirrored to through client.runs.add_step; None keeps the plan local.

RunPlan.add​

add(id: str, title: str, depends_on: list[str] | None = None, **_: Any) -> PlanStep

Add a pending step to the plan, replacing any step with the same identifier; does not start it.

NameTypeDefaultRequiredDescription
idstryesIdentifier of the new step.
titlestryesShort human readable title of the step.
depends_onlist[str] | NoneNonenoIdentifiers of the steps that must be done first; None means no dependency.
**_AnynoOther keys of a step dict, ignored.

Returns: PlanStep. The new PlanStep, with status pending.

RunPlan.advance​

advance() -> PlanStep | None

Start the next ready step when none is in progress.

This element takes no parameter.

Returns: PlanStep \| None. The step in progress (already running or just started), or None when no step is ready.

RunPlan.complete​

complete(step_id: str, evidence: str) -> PlanStep | None

Mark step_id done with its evidence and return the step started next.

NameTypeDefaultRequiredDescription
step_idstryesIdentifier of the step to complete; an unknown one raises KeyError.
evidencestryesProof that the step is done, stored on the step and sent as output_ref; an empty value raises ValueError.

Returns: PlanStep \| None. The step started next, or None when no step is ready.

Raises: ValueError.

RunPlan.ready​

ready() -> list[PlanStep]

Pending steps whose dependencies are all done.

This element takes no parameter.

Returns: list[PlanStep]. List of the ready PlanStep, in insertion order; unknown dependencies are ignored.