Skip to content

Workflow Map

Last refreshed: 2026-05-20

Canonical IDs

Defined in src/lib/anuva/workflow-graph.ts:

  • presentationVideoWorkflow
  • ragWorkflow
  • narrativeWorkflow
  • slidesWorkflow
  • visualsWorkflow
  • directionWorkflow
  • sceneEditWorkflow

Public Entry Points

Also defined in workflow-graph.ts:

  • generateScenes: terminal step compile, does not run audio.
  • generateAudio: terminal step audio, requires preview artifacts.
  • generateVideo: terminal step finalize, ensures audio.
flowchart LR
  generateScenes["generateScenes"] --> compile["compile"]
  generateAudio["generateAudio"] --> audio["audio"]
  generateVideo["generateVideo"] --> finalize["finalize"]
  compile --> preview["👁️ Preview artifacts"]
  audio --> audioReady["🔊 Audio ready"]
  finalize --> renderJob["📤 Render handoff"]

Master Workflow

File: src/mastra/workflows/presentationvideo.workflow.ts.

Step order:

  1. prepare-presentation-run
  2. intake resolves VideoDescriptionBrief deterministically or through IntentAgent.
  3. ragWorkflow
  4. persisted-rag-context
  5. narrativePreviewWorkflow
  6. narrative-review suspends with VO script preview payload and approved preview script.
  7. narrativeExpansionWorkflow
  8. visualsWorkflow
  9. slidesWorkflow
  10. directionWorkflow
  11. compile
  12. persist-scenes
  13. assign-visuals queues generated images for scenes with persisted image prompts.
  14. persist-compilation
  15. audio
  16. finalize
flowchart TD
  prepare["prepare-presentation-run"] --> intake["intake"]
  intake --> intentGate{"Skip IntentAgent?"}
  intentGate -->|No| intent["intent-agent"]
  intentGate -->|Yes| rag["ragWorkflow"]
  intent --> rag
  rag --> persisted["persisted-rag-context"]
  persisted --> preview["narrativePreviewWorkflow"]
  preview --> review["narrative-review suspend"]
  review --> resume["resume with approved preview and identity"]
  resume --> expand["narrativeExpansionWorkflow"]
  expand --> visuals["visualsWorkflow"]
  visuals --> slides["slidesWorkflow"]
  slides --> direction["directionWorkflow"]
  direction --> compile["compile"]
  compile --> persistScenes["persist-scenes"]
  persistScenes --> assignVisuals["assign-visuals / queue image prompts"]
  assignVisuals --> persistCompilation["persist-compilation"]
  assignVisuals --> worker["presentation-worker Image Gen"]
  worker --> media["generated media assets"]
  persistCompilation --> audio["audio"]
  audio --> finalize["finalize"]

Subworkflows

  • src/mastra/workflows/sub/rag.workflow.ts: deterministic knowledge decision or knowledge-agent, then knowledge.
  • src/mastra/workflows/sub/narrative.workflow.ts: narrativePreviewWorkflow for approved-script generation, then narrativeExpansionWorkflow for post-review scene details.
  • src/mastra/workflows/sub/visuals.workflow.ts: visual-agent, then visuals.
  • src/mastra/workflows/sub/slides.workflow.ts: narrative analysis agent, slide plan agent, then slide generation.
  • src/mastra/workflows/sub/direction.workflow.ts: deterministic baseline direction, then optional director refinement.

Per-scene edit/image regeneration actions are adjacent to the master workflow rather than full workflow reruns. They use code-owned prompt builders, call editAgent or visualAgent, mark affected scenes dirty, and require preview regeneration before render readiness.

The create UI uses the narrative-review suspend payload as the VO Script Preview. The suspend payload now carries a preview-only approvedScript artifact rather than semantic scene details. Resume data contains approval plus selected Set/Bot/default Brand Kit, allowing downstream workflows to run only after the user has reviewed the narrative.

flowchart LR
  sceneEdit["Scene edit action"] --> builder["Code prompt builder"]
  builder --> editAgent["editAgent"]
  builder --> visualAgent["visualAgent"]
  editAgent --> scene["presentation_scenes dirty"]
  visualAgent --> scene
  scene --> preview["preview regeneration required"]

Linked Contracts

src/lib/anuva/contracts-v1.ts defines:

  • VideoDescriptionBrief
  • VoiceoverScriptJson
  • NarrativeSceneDetails
  • RevealSceneModel
  • SceneVisualStrategy
  • SceneDirectionModel
  • PresentationCompilationConfig
  • StageGateResult
  • WorkflowRunEnvelope
  • MastraActionMetadata
  • EditAgentInput

Persistence

Workflow execution writes to existing product collections such as presentations, presentation_scenes, presentation_compilations, and presentation_generation_jobs.

The upgrade API, CLI, and worker paths store richer workflow runtime state through the in-memory AnuvaRepository. Durable repository persistence is deferred and should be introduced through a repository storage design rather than Payload V1 collections.

flowchart LR
  workflow["presentationVideoWorkflow and upgrade callers"] --> productState["Product Payload collections"]
  workflow --> repository["In-memory AnuvaRepository"]
  productState --> persisted["presentations, scenes, compilations, generation jobs"]
  repository --> runtime["runs, artifacts, quality, sources, conversations"]
  repository -. future .-> durable["Durable repository store"]