Multi-Agent Dashboard Generation & Chart Types Engine

1. Architectural Primitives

Modern generative visualization requires deterministic execution pipelines backed by robust schema enforcement. The AI Dashboard platform utilizes a decoupled, sequential agent architecture built on top of LangGraph. Instead of relying on a monolithic large language model call to generate complete dashboard configurations in a single pass, the pipeline isolates distinct cognitive tasks into specialized, context-aware agents.

Each autonomous agent accepts a rigorously defined input state object and yields a validated Pydantic schema contract. This segregation guarantees deterministic routing, isolates errors to individual execution layers, and enables granular human-in-the-loop intervention during ongoing refinement cycles.

Strategy Agent Chart Goals Data Agent SQL & Raw Data Viz Spec Agent Vega-Lite JSON Layout Agent Grid Coordinates Done
Figure 1: Sequential LangGraph state flow passing strict Pydantic payload models across agents.

2. Sequential Multi-Agent Choreography

The orchestration logic compiles into a state graph managed by standard workflow transitions. Each agent owns a distinct subset of the transformation lifecycle.

Strategy Agent

The Strategy Agent ingests raw user natural language queries alongside target database schema snapshots. It resolves analytical intent to produce an explicit array of visualization objectives configured as ChartGoal structures. This layer enforces structural guardrails, limiting initial objectives to optimal density bounds (typically 3 to 5 charts) while determining target data columns, grouping variables, and mathematical aggregation types.

Data Agent

Acting upon translated objectives, the Data Agent maps the semantic requirements into syntactically valid SQL query statements matching the target dialect. It executes read-only extractions against the provisioned connection pool using strict query limits and timeout wrappers. The agent attaches complete execution metrics, column mappings, and raw row payloads directly to the active state payload.

Viz Spec Agent

The Viz Spec Agent maps extracted tabular data records into structured client-side specifications conforming to the Vega-Lite v6 syntax. It automates graphical encodings by aligning continuous measures to visual scales, mapping categorical fields to distinct palette channels, and injecting interactive selection parameters to enable reactive cross-filtering across related dashboard components.

Layout Agent

The Layout Agent aggregates disjoint visualization specifications into a unified graphical canvas. Utilizing grid layout algorithms compatible with standard layout engines (such as react-grid-layout), the agent computes multi-column positioning parameters. It derives deterministic column alignments (x), vertical positions (y), and element dimensions (w, h) based on priority weights to minimize empty container gaps.

Intent Classifier (Smart Refinement)

During post-generation workflows, the Intent Classifier intercepts unstructured user feedback. Rather than triggering complete pipeline re-execution, this agent identifies localized update instructions and assigns them to discrete actions within the RefinementActionType enumeration. It directly invokes targeted operations such as updating specific titles, swapping encoding parameters, mutating underlying SQL logic, or recalculating structural layout coordinates.

Operational Tip: Decoupling visualization parsing from raw data gathering prevents hallucinations in target JSON formatting. If an upstream SQL query fails due to missing table references, execution halts cleanly before burning downstream visualization tokens.

3. Supported Visualization Engine

The visualization layer enforces deterministic graphical marks tailored to specific data distributions. The platform standardizes rendering profiles across primary visualization classes defined by the ChartType enumeration.

Standard Encodings

  • Bar Chart (bar): Compares categorical quantities. Automatically assigns continuous measures to horizontal or vertical spatial scales while leveraging nominal dimension fields for axis labeling.
  • Line Chart (line): Exposes temporal sequences and continuous trend evolutions. Injects zero-baseline protections and connects sequentially ordered coordinate points.
  • Area Chart (area): Captures volumetric accumulation over continuous intervals. Renders base-filled paths to visualize part-to-whole series density.
  • Arc / Pie Chart (arc): Represents proportional scalar relationships. Encodes metric values directly to radial slice paths within bounded circular domains.

Specialized Visualizations

  • Scatter Plot (point): Exposes multidimensional variance and structural correlations across two continuous metrics. Supports secondary encoding properties mapping dimensional clusters to discrete circle radii or distinct color gradients.
  • Heatmap (rect): Displays dense multi-dimensional matrices. Maps intersection cells across two discrete categorical axes to sequential color palettes to communicate intensity concentrations.
  • Choropleth Map (geoshape): Translates geographic column identifiers into interactive boundary layers using embedded GeoJSON data. Supports dynamic granularity scaling between macro state-level borders and granular district-level subdivisions.
  • KPI Summary (text): Surfaces high-level executive metrics. Strips traditional axis parameters to render oversized numerical callouts alongside percentage trend deltas.

4. System Contracts & Pipelines

Explicit runtime validation is governed by strongly-typed models. Below are concrete representations of the communication payloads passed across intermediate agent nodes.

models.py (Agent Contract Schema)
class ChartGoal(BaseModel):
    chart_id: str = Field(..., description="Unique identifier for this chart")
    chart_type: ChartType = Field(..., description="Type of visualization")
    title: str = Field(..., description="Chart title")
    description: str = Field(..., description="What this chart shows")
    
    x_field: Optional[str] = Field(None, description="Field for X axis")
    y_field: Optional[str] = Field(None, description="Field for Y axis")
    aggregation: AggregationType = Field(default=AggregationType.NONE)
    tables: List[str] = Field(..., description="Tables needed for this chart")
graph.py (Workflow Compilation)
def create_dashboard_graph() -> StateGraph:
    workflow = StateGraph(DashboardGraphState)
    
    workflow.add_node("strategy", strategy_agent_node)
    workflow.add_node("data", data_agent_node)
    workflow.add_node("viz_spec", viz_spec_agent_node)
    workflow.add_node("layout", layout_agent_node)
    
    workflow.set_entry_point("strategy")
    workflow.add_conditional_edges("strategy", should_continue_after_strategy)
    workflow.add_edge("layout", END)
    
    return workflow.compile()

5. Interactive Execution Simulator

Use the active simulation console below to inspect internal state transformations across agents during a real-time lifecycle trace. Select an analytical input context, trigger the sequential compilation workflow, and review the structured contract updates emitted at each operational boundary.