The Dual-Agent Workflow for Data-Heavy UIs

A surprisingly effective pattern for building interfaces with lots of data. Pair a UX Agent with a Product Engineer — one designs, one validates.

When you're building a UI that displays a lot of data, the challenge isn't just "what data to show" — it's discovering which views are actually useful. This workflow uses two AI agents to explore that space systematically.

The core insight: One agent proposes data views, another validates them against real data. This back-and-forth surfaces features you hadn't thought of.

The Setup

1
Create a Query Endpoint

Build an API endpoint that can handle read queries — something like /api/query. This is how the agents will explore your data.

2
Document Your Schema

Create a Markdown file explaining the important tables and what the data represents. Point to your schema file (Drizzle schema works great for this).

3
Launch Two Agents

Write a prompt that kicks off both agents with clear roles and a collaboration protocol.

The Two Agents

UX Agent

Identifies useful data views, designs how they fit together into a cohesive UI experience.

Product Engineer

Writes queries, runs curl commands, validates data makes sense for proposed use cases.

The Critical Rule

Before the UX Agent can use any data view, it must get approval from the Product Engineer. This creates a validation loop that catches bad assumptions early.

The Flow

UX proposes view
Engineer validates
UX refines
Document

The Output

The UX Agent creates a Markdown document containing:

Generated Documentation
  • The raw queries that power each view
  • Why each view is useful (the reasoning)
  • How the views can be used in the UI

Why This Works

By the end of this process, you'll likely discover useful features and data views you hadn't thought of. The UX agent explores creatively while the engineer keeps it grounded in reality.

The documentation becomes a reference when designing more complex UIs. You can even use it to instruct another agent to translate raw queries into ORM queries behind well-defined methods.

Example Prompt Structure

You are two agents collaborating on UI design for [App Name].

**UX Agent**: Your job is to identify useful data views and design
how they fit into a cohesive experience. Before using any view,
you must get validation from the Product Engineer.

**Product Engineer**: Your job is to write queries, test them via
curl against /api/query, and validate the data makes sense.

Schema reference: [link to schema.md]
API endpoint: POST /api/query

Begin by having UX Agent propose 3 initial data views...

Pro tip: Start with broad exploration ("What are the most interesting aggregations?") before narrowing to specific features.

When to Use This

  • Dashboards with lots of metrics
  • Admin panels for complex data
  • Analytics interfaces
  • Any UI where you're not sure what views users need

The pattern scales — you can add more specialized agents (Data Analyst, Security Reviewer) as complexity grows.