enterprise_ai.loop.plan
Source: sdks/python/src/enterprise_ai/loop/plan.py. Back to the Python SDK reference index.
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:
| Name | Type | Required | Description |
|---|---|---|---|
id | str | yes | Identifier of the step, unique in the plan. |
title | str | yes | Short human readable title of the step. |
depends_on | list[str] | no | Identifiers of the steps that must be done before this one can start; empty by default. |
status | str | no | State of the step: pending (default), in_progress, done or skipped. |
evidence | str | None | no | Evidence of the measures (logs, timestamps, screenshots references...). |
Class RunPlan
Ordered plan steps with dependencies.
Attributes:
| Name | Type | Required | Description |
|---|---|---|---|
client | yes | Enterprise AI client used to mirror the plan as run steps, or None. | |
current | PlanStep | None | yes | The step with status in_progress, or None. |
done | bool | yes | True when every step of the plan is done. |
run_id | yes | Identifier of the run the plan is mirrored to, or None. | |
steps | dict[str, PlanStep] | yes | Steps 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.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
steps | list[PlanStep | dict[str, Any]] | None | None | no | Initial steps, as PlanStep objects or dicts with id, title and depends_on, in order. |
client | Any | None | no | Parent client. |
run_id | str | None | None | no | Identifier 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.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | str | yes | Identifier of the new step. | |
title | str | yes | Short human readable title of the step. | |
depends_on | list[str] | None | None | no | Identifiers of the steps that must be done first; None means no dependency. |
**_ | Any | no | Other 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.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
step_id | str | yes | Identifier of the step to complete; an unknown one raises KeyError. | |
evidence | str | yes | Proof 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.