GodUI
25

Agent Flow

A draggable, pannable node-graph that visualizes an agent workflow — labelled nodes with live run status and data packets that flow along the edges between them.

Triggeruser message
Planneropus-4.8
Search toolweb
Code toolsandbox
Synthesizeopus-4.8
Answerstreamed

With autoPlay, the graph plays as one continuous light: each node traces its border on — growing from the left-edge centre out to both sides — then its icon lights and the beam flows down the outgoing edge to the next node, which traces in turn. The lit border stays; the flowing line is transient. Root nodes (no incoming edge) start the sequence. Drag any node to rearrange it — the edges follow live — or drag the dotted backdrop to pan.

Installation

pnpm dlx shadcn@latest add "https://godui.design/r/agent-flow.json"

Usage

tsx
 
import {
  AgentFlow,
  type AgentFlowEdge,
  type AgentFlowNode,
} from "@/components/godui/agent-flow";
tsx
 
<AgentFlow
  nodes={[
    { id: "a", label: "Trigger", status: "done", x: 80, y: 120 },
    { id: "b", label: "Planner", sublabel: "opus-4.8", status: "running", x: 320, y: 120 },
  ]}
  edges={[{ id: "a-b", from: "a", to: "b" }]}
  className="h-[360px] w-full"
/>

Give the canvas an explicit height (and width) — it is an absolutely-positioned graph, so it fills its container. With fitView (default) the graph scales and centers itself so the whole graph is visible on mount.

Auto-play

Pass autoPlay and the component runs the whole choreography for you — trace border → light icon → flow to the next node — starting from the root(s). Add continuous to loop it. One flowSpeed (px/second) drives everything: each card's border and every beam derive their duration from their own length, so the light holds a constant pace — bigger cards trace longer, longer edges flow longer, and the speed never changes at the card→line seam. (flowDuration sets packet speed only when you drive the edges yourself, without autoPlay.)

tsx
 
<AgentFlow nodes={nodes} edges={edges} autoPlay continuous />

Persistent edges

Mark an edge persist and its line draws on as the packet travels and then stays lit — the same behaviour as a card's traced border. A completed path reads as an established connection, so the whole traversed route glows once the flow reaches the end.

Triggeruser message
Planneropus-4.8
Search toolweb
Code toolsandbox
Synthesizeopus-4.8
Answerstreamed

Driving it yourself

Without autoPlay, you control the graph: node.status drives each card (a node traces its border on the first time it becomes running/done) and edge.animated drives the packets. For a manual once-through, mark edges loop: false and listen for onEdgeArrive to advance the sequence yourself.

tsx
 
const [arrived, setArrived] = useState(new Set<string>());

<AgentFlow
  nodes={nodes}          // status derived from `arrived`
  edges={edges.map((e) => ({ ...e, loop: false }))}
  onEdgeArrive={(id) => setArrived((s) => new Set(s).add(id))}
/>;

Props

AgentFlow

PropTypeDefaultDescription
nodesAgentFlowNode[]The graph nodes.
edgesAgentFlowEdge[]Directed connectors between node ids.
draggablebooleantrueAllow dragging nodes to reposition them.
pannablebooleantrueAllow panning the canvas by dragging the backdrop.
flowDurationnumber3Seconds per packet travel (manual mode; autoPlay uses flowSpeed).
flowSpeednumber280Continuous-flow speed in px/second — one pace for every border trace and beam under autoPlay.
fitViewbooleantrueScale + center the graph in view on mount.
autoPlaybooleanfalsePlay the trace → light → flow choreography from the root(s). Overrides status/animated.
continuousbooleanfalseWith autoPlay, loop forever instead of stopping at the leaves.
onEdgeArrive(id: string) => voidFires when a non-looping edge's packet reaches its target.
onNodeActivate(id: string) => voidFires when a node finishes tracing its border (its icon lights).
aria-labelstring"Agent workflow"Accessible label for the canvas group.

AgentFlowNode

PropTypeDefaultDescription
idstringUnique node id (referenced by edges).
labelstringPrimary label.
sublabelstringSecondary label (tool, model, duration).
iconReactNodeGlyph shown in the icon chip.
status"idle" | "running" | "done" | "error""idle"Drives the chip style and running pulse.
x / ynumberNode center in canvas units.

AgentFlowEdge

PropTypeDefaultDescription
idstringUnique edge id.
fromstringSource node id.
tostringTarget node id.
animatedbooleantrueAnimate a packet along the edge.
loopbooleantrueRepeat the packet forever. false sends one packet that fires onEdgeArrive on landing.
persistbooleanfalseKeep the line lit after its packet passes — draws on like a card's border and stays.
curvaturenumber0Bow of the curve in pixels (positive = upward).

On this page

Built with GodUI

Beautifully crafted motion components for modern interfaces.

Star on GitHub