Execution Plan API¶
plan ¶
Execution plan primitive for multi-step agent workflows.
PlanStatus
module-attribute
¶
Task status values understood by the frontend plan UI.
ExecutionPlan ¶
Ordered list of tasks + helpers to emit status updates.
Tasks are mutable: set_task_status rewrites a task (or subtask)
in place and returns the payload the consumer should forward to the
frontend. When an EventBus is attached, the same payload is also
emitted as an :class:AgentEvent so any subscriber (e.g. the SSE
sidecar) can observe the change.
enable_ui_events ¶
Opt into dual-emission of typed ui.plan.{init,delta} events.
When enabled, :meth:set_task_status and :meth:emit_init
emit a parallel typed event alongside the legacy plan.init
/ plan.task.updated events. The legacy events stay
identical so existing consumers continue to work; new
consumers subscribe to the typed channel via
:class:UIEmitter conventions.
Returns self for chaining.
Source code in orqest/plan/execution_plan.py
to_sse_init ¶
as_component ¶
Wrap this plan as a :class:PlanComponent for the
generative-UI pipeline.
Source code in orqest/plan/execution_plan.py
set_task_status
async
¶
set_task_status(
task_id: str,
status: PlanStatus,
*,
subtask_id: str | None = None,
bus: EventBus | None = None,
agent_name: str = "unknown",
) -> dict[str, Any]
Flip a task (or subtask) status and return the update payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
str
|
ID of the :class: |
required |
status
|
PlanStatus
|
New status value. |
required |
subtask_id
|
str | None
|
If provided, update the matching subtask rather than the parent task. |
None
|
bus
|
EventBus | None
|
Optional :class: |
None
|
agent_name
|
str
|
Tagged on emitted events for source attribution. |
'unknown'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dict carrying |
dict[str, Any]
|
|
dict[str, Any]
|
consumer forwards to the frontend, so it must remain stable. |
Source code in orqest/plan/execution_plan.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
emit_init
async
¶
Publish the initial plan to bus as a plan.init event.
Convenience for consumers that always want the plan mirrored to
the bus right after construction. Returns the same payload as
:meth:to_sse_init so the caller can also stream it inline.
Source code in orqest/plan/execution_plan.py
from_tasks_json
classmethod
¶
Construct from either a JSON string, a bare task list, or a
{"tasks": [...]} dict. Useful when an LLM produces the plan
as an opaque JSON string.
Source code in orqest/plan/execution_plan.py
PlanSubtask ¶
A subtask nested under a :class:PlanTask.
PlanTask ¶
A top-level task in an :class:ExecutionPlan.