docs: update session export panels and plan executor subplan wiring
CI / lint (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 49s
CI / quality (pull_request) Successful in 45s
CI / security (pull_request) Successful in 56s
CI / helm (pull_request) Successful in 26s
CI / build (pull_request) Successful in 32s
CI / unit_tests (pull_request) Failing after 7m5s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Failing after 11m14s
CI / integration_tests (pull_request) Failing after 23m7s
CI / coverage (pull_request) Successful in 11m9s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m59s

- docs/reference/session_cli.md: add Rich output panels documentation
  for agents session export (Session Export, Contents, Integrity panels
  with example output); update success message to 'Export completed';
  add stdout export note and example (#3424)
- docs/reference/plan_execute.md: add Subplan Spawning section
  documenting SubplanService and SubplanExecutionService injection into
  PlanExecutor, execution flow (_spawn_subplans, _execute_subplans,
  _apply_subplan_results_to_plan), failure handling, and updated
  architecture diagram (#3561)
This commit is contained in:
2026-04-05 21:09:42 +00:00
parent 13eb2a7c8c
commit ddc6fb7372
2 changed files with 113 additions and 6 deletions
+70 -6
View File
@@ -15,14 +15,78 @@ changeset capture through `ChangeSetStore`.
```
PlanExecutor
├── StrategizeStubActor (read-only, produces decision tree)
├── ExecuteStubActor (legacy stub: sandbox + ChangeSetCapture)
├── RuntimeExecuteActor (runtime: ToolRunner + ChangeSetStore)
├── PlanExecutionContext (plan metadata + resource bindings)
├── PlanLifecycleService (phase transitions, persistence)
── ErrorRecoveryService (optional — error recording + retry logic)
├── StrategizeStubActor (read-only, produces decision tree)
├── ExecuteStubActor (legacy stub: sandbox + ChangeSetCapture)
├── RuntimeExecuteActor (runtime: ToolRunner + ChangeSetStore)
├── PlanExecutionContext (plan metadata + resource bindings)
├── PlanLifecycleService (phase transitions, persistence)
── SubplanService (optional — spawn child plans from decisions)
├── SubplanExecutionService (optional — execute spawned child plans)
└── ErrorRecoveryService (optional — error recording + retry logic)
```
## Subplan Spawning (v3.8.0+)
When a plan's Strategize phase records `subplan_spawn` or
`subplan_parallel_spawn` decisions, the Execute phase automatically
spawns and executes child plans via the injected `SubplanService` and
`SubplanExecutionService`.
### Wiring
Both services are injected as optional constructor parameters:
```python
from cleveragents.application.services.plan_executor import PlanExecutor
from cleveragents.application.services.subplan_service import SubplanService
from cleveragents.application.services.subplan_execution_service import (
SubplanExecutionService,
)
executor = PlanExecutor(
lifecycle_service=lifecycle,
tool_runner=runner,
execution_context=ctx,
subplan_service=subplan_svc, # optional
subplan_execution_service=exec_svc, # optional
)
```
When either service is `None`, all subplan spawning logic is skipped
(backward-compatible no-op).
### Execution Flow
After the actor completes the Execute phase:
1. **`_spawn_subplans()`** — queries `SubplanService.get_spawn_decisions()`
for the plan, then calls `SubplanService.spawn()` for each decision,
creating child plan records.
2. **`_execute_subplans()`** — calls `SubplanExecutionService.execute_all()`,
routing sequential `subplan_spawn` decisions through ordered execution
and `subplan_parallel_spawn` groups through concurrent execution.
3. **`_apply_subplan_results_to_plan()`** — propagates child plan failure
information back to the parent plan. When one or more child plans fail,
the parent plan's `error_details` field is annotated with a
`failed_subplan_ids` list.
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `subplan_service` | `SubplanService \| None` | Injected subplan service |
| `subplan_execution_service` | `SubplanExecutionService \| None` | Injected execution service |
### Failure Handling
Child plan failures are **annotated, not raised**. The parent plan
continues to the Apply phase even if child plans fail; the
`failed_subplan_ids` list in `error_details` allows downstream
consumers to detect and handle failures.
See [`subplan_service.md`](subplan_service.md) and
[`subplans.md`](subplans.md) for full subplan API reference.
## Execution Modes
| Mode | Actor | Trigger | Output |
+43
View File
@@ -189,6 +189,45 @@ agents session export <SESSION_ID> [--output <FILE>] [--force] [--format <FORMAT
| `--force` | | Overwrite existing output file |
| `--format` | | Export format: `json` (default, re-importable) or `md` (Markdown transcript, lossy) |
### Rich Output Panels
On success, the `rich` format renders three panels:
- **Session Export** — session ID, output path (or `(stdout)` for stdout), message count,
file size, and format.
- **Contents** — messages count, plan references, metadata keys, actor config inclusion,
and schema version.
- **Integrity** — SHA-256 checksum (`sha256:xxxx...xxxx`) and encrypted flag.
Followed by a `✓ OK Export completed` success message.
Example output:
```
╭─ Session Export ────────────────────╮
│ Session: 01HXM2A6K1P2E9Q9D4GQ7J4S7Z │
│ Output: /tmp/weekly-planning.json │
│ Messages: 6 │
│ Size: 24 KB │
│ Format: JSON │
╰─────────────────────────────────────╯
╭─ Contents ─────────────────╮
│ Messages: 6 │
│ Plan References: 1 │
│ Metadata Keys: 2 │
│ Actor Config: included │
│ Schema Version: v3 │
╰────────────────────────────╯
╭─ Integrity ──────────────────╮
│ Checksum: sha256:7a9b...42c1 │
│ Encrypted: no │
╰──────────────────────────────╯
✓ OK Export completed
```
### Notes
- Parent directories are created automatically when writing to a file.
@@ -197,6 +236,7 @@ agents session export <SESSION_ID> [--output <FILE>] [--force] [--format <FORMAT
- The `md` format produces a human-readable Markdown transcript with session metadata,
full message history (role/timestamp/content), and linked plan references. It cannot
be re-imported.
- When exporting to stdout, the output path in the panel shows `(stdout)`.
### Examples
@@ -209,6 +249,9 @@ agents session export 01HXYZ... --format md -o session.md
# Overwrite existing file
agents session export 01HXYZ... -o session.json --force
# Export to stdout
agents session export 01HXYZ...
```
---