ReAct Planner
Complex multi-step queries are automatically routed through a Reason + Act loop
(src/lib/react-planner.ts), replacing the flat single-pass function-call pattern with a
deliberate planning cycle.
The loop
- THINK — the Conductor analyzes the request and generates a multi-step plan
- ACT — each step dispatches to Virtuosos via function calls
- OBSERVE — the result of each action is recorded
- REFLECT — the plan adapts based on intermediate results
- Repeat until the plan completes or max iterations are reached
Plan steps
export interface PlanStep {
stepNumber: number // 1-indexed
thought: string // what the Conductor plans to do
action: { name: string; args: any } | null // null = pure reasoning step
observation: string | null // result observed from the action
status: 'planned' | 'executing' | 'completed' | 'failed' | 'skipped'
}Every step is broadcast over the Symphony Bus, so the
Orchestra Visualizer shows the plan executing live, and startTimer() telemetry captures
per-step latency.
Conductor function declarations
The planner acts through the same function surface as single-pass commands
(src/lib/conductor-functions.ts):
| Function | Purpose |
|---|---|
generate_summary / list_key_moments / generate_instructions | Core video analysis |
create_haiku / create_mermaid_diagram / create_chart | Creative & structural lenses |
generate_image / edit_image / generate_video | Artisan media generation |
web_search | Scholar grounding |
search_video | Semantic timeline search |
custom_video_analysis | Free-form Visionary analysis |
launch_valhalla | External tool automation |
applyLens | Run any registered Lens |
seekToTime / setPlaybackSpeed / setSelectionRange | Player control |
addAnnotation | Timeline annotations |
Every call is validated against Zod schemas (conductor-schemas.ts) before execution;
validation failures are logged via logValidationFailure and surfaced back to the planner as
observations so it can self-correct.
References: Yao et al. (2023), ReAct: Synergizing Reasoning and Acting in LLMs; Wei et al. (2022), Chain-of-Thought Prompting.