Skip to Content
ArchitectureReAct Planner

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

  1. THINK — the Conductor analyzes the request and generates a multi-step plan
  2. ACT — each step dispatches to Virtuosos via function calls
  3. OBSERVE — the result of each action is recorded
  4. REFLECT — the plan adapts based on intermediate results
  5. Repeat until the plan completes or max iterations are reached

Plan steps

src/lib/react-planner.ts
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):

FunctionPurpose
generate_summary / list_key_moments / generate_instructionsCore video analysis
create_haiku / create_mermaid_diagram / create_chartCreative & structural lenses
generate_image / edit_image / generate_videoArtisan media generation
web_searchScholar grounding
search_videoSemantic timeline search
custom_video_analysisFree-form Visionary analysis
launch_valhallaExternal tool automation
applyLensRun any registered Lens
seekToTime / setPlaybackSpeed / setSelectionRangePlayer control
addAnnotationTimeline 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.