Reference

JSX facade

Author Wire diagrams as React children of <Flow>. The walker compiles the tree to canonical JSON and either renders inline SVG or hands the JSON back through onCompile.

tsx
import {
  Flow,
  TriggerNode,
  AINode,
  ConditionNode,
  ActionNode,
  Note,
  Group
} from "@aigentive/wire-react";

export function SupportAgent() {
  return (
    <Flow layout="LR" id="support-agent" title="Support agent">
      <TriggerNode id="webhook" title="Webhook fires" />
      <AINode id="classify" title="Classify intent" from="webhook" model="gpt-5.4-mini" />
      <ConditionNode
        id="route"
        title="Route request"
        from="classify"
        branches={["sales", "support", "other"]}
      />
      <ActionNode id="notify-sales" title="Notify sales" from="route.sales" tone="success" />
      <ActionNode id="open-ticket" title="Open ticket"  from="route.support" tone="warning" />
      <Note id="risk-note" title="Routing risk" attachedTo="classify">
        Check confidence before routing.
      </Note>
    </Flow>
  );
}
ComponentWire kindExtra props
<TriggerNode>trigger
<ActionNode>action
<AINode>aimodel?, prompt?, tools?
<ToolNode>toolref?
<ConditionNode>conditionbranches: string[] (required)
<HumanNode>human
<MemoryNode>memory
<RetrievalNode>retrieval
<GuardrailNode>guardrail
<EndNode>end
<Note>notebody? or children, attachedTo?
<Group>groupchildren become members; parent auto-set
PropTypePurpose
idstringStable identifier. Required if other nodes reference this one.
titlestringDisplay title shown in cards, lists, and SVG.
descriptionstringOptional subtitle / longer text rendered by some cards.
tone"default" | "success" | "warning" | "error" | "info" | "ai"Visual tone for the card.
fromstring | string[]Source node(s) for the implicit edge. Use `id.branch` from a condition.
afterstring | string[]Alias for `from`. Pick whichever reads better.
attachedTostringNotes/annotations only — visual association with a target node.
parentstringGroup nesting. Set automatically when nested inside `<Group>`.
dataRecord<string, unknown>Free-form data bag. `data.options` is where most option values land.
position{ x: number; y: number }Manual position. Layout engine fills in when omitted.
size{ width: number; height: number }Manual size. Defaults to renderer-measured dimensions.
PropTypePurpose
layout"LR" | "TB" | "RL" | "BT"Layout direction (default LR).
idstringDiagram id stamped onto the compiled JSON.
titlestringDiagram title.
mode"svg" | "json"Render mode. Default `svg`. Use `json` for headless compile.
onCompile(diagram: WireDiagram) => voidFires once with the canonical compiled JSON. Pair with `mode="json"` to capture without rendering.
renderToSvgOptionsRenderSvgOptionsForwarded to `renderToSvg` when in svg mode (padding, background, tone colors, etc.).
classNamestringClass on the wrapping element (svg or div) for styling hooks.
tsx
<Flow layout="LR" renderToSvgOptions={{ padding: 32, background: "transparent" }}>
  <TriggerNode id="t" title="Tick" />
</Flow>
tsx
<Flow mode="json" onCompile={(diagram) => save(diagram)}>
  <TriggerNode id="t" title="Tick" />
</Flow>
tsx
import { useWireDiagram, WireProvider, WireCanvas } from "@aigentive/wire-react";

function AgentPanel() {
  const diagram = useWireDiagram(
    <Flow layout="LR">
      <TriggerNode id="t" title="Tick" />
      <AINode id="plan" title="Plan" from="t" model="gpt-5.4-mini" />
    </Flow>
  );
  return (
    <WireProvider defaultDiagram={diagram}>
      <WireCanvas mode="view" fitView />
    </WireProvider>
  );
}
NextAPI · Hooks