OpenGenerativeUI icon indicating copy to clipboard operation
OpenGenerativeUI copied to clipboard

feat: add planning step before visualization generation

Open jerelvelarde opened this issue 8 months ago • 0 comments

Problem

When a user asks the agent to visualize something (e.g. "visualize how a car axle works"), the agent jumps straight into generating code via the widgetRenderer tool. There's no conversational acknowledgment or planning step — the user just sees a loading spinner and then the visualization appears.

This feels abrupt and doesn't give the user confidence that the agent understood their request or is approaching it thoughtfully.

Current behavior

User: "visualize how a car axle works"
  → Agent calls widgetRenderer (writes code)
  → App progressively loads visualization

Desired behavior

User: "visualize how a car axle works"
  → Agent replies with brief plain text (acknowledges request, sets context)
  → Agent calls planning tool (plans the visualization approach)
  → Agent calls visualization tool (writes code)
  → App progressively loads visualization

What each step should look like:

  1. Plain text reply — 1-2 sentences acknowledging the request and framing what the visualization will show. e.g. "A car axle transfers torque from the differential to the wheels — let me build an interactive 3D explainer showing the key components and how they connect."

  2. Planning step — Agent explicitly plans the visualization: what technology to use (Three.js, SVG, etc.), what components to show, what interactivity to include. This could be a tool call or structured internal reasoning that's visible to the user as a "planning" state.

  3. Visualization generation — Agent calls widgetRenderer with the planned approach. Same as today but informed by the plan.

  4. Progressive rendering — Same as today, the app streams the visualization as it's generated.

Why this matters

  • User confidence: The text reply confirms the agent understood the request before spending time generating
  • Better outputs: A planning step forces the agent to think about approach (Three.js vs SVG, what to include) before writing code, which should improve quality
  • Transparency: Users can see the agent's thinking process, not just the output
  • Interruptibility: If the plan is wrong, the user can course-correct before code generation starts

Implementation considerations

  • The planning step could be a new tool, a structured agent node in the LangGraph graph, or prompt engineering that instructs the agent to always respond with text first
  • The frontend may need a "planning" state indicator (similar to the existing streaming indicator)
  • The plan should be concise — not a lengthy document, just a quick outline of approach
  • This pattern should apply to all visualization requests, not just 3D content

Related

  • #58 — Quality regression in generated visualizations (planning step would help the agent choose Three.js over CSS hacks)
  • The existing skill files (advanced-visualization/SKILL.md) have a decision matrix that should inform the planning step

jerelvelarde avatar Mar 26 '26 14:03 jerelvelarde