Skip to content

API Reference parrot.outputs.a2ui.graph.models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.outputs.a2ui.graph.models

View source

The Graph viz-core composite's wire vocabulary (FEAT-529 Module 1).

:class:GraphSpec (and its child models) is the SINGLE source of vocabulary for the Graph component — the mermaid codec (graph/mermaid.py), the layered layout (graph/layout.py), the builder (builders.build_graph), the FlowDefinition adapter (adapters/flow.py), the derived GRAPH_SCHEMA (catalog/viz_core/graph.py), and every renderer all consume or produce a :class:GraphSpec; nothing else defines a parallel shape (spec §7 "Patterns to Follow").

What, never how (spec §2 Overview, §7): no field on any model here may carry a colour, a font, a pixel size or a renderer-library option. rankSep/nodeSep are ABSTRACT layout units, not pixels; node state is DATA (a domain enum) — the renderer contract (documented, not modelled here) maps it to a viz-core semantic status role and paints that role with its own theme. This invariant is enforced mechanically by test_graph_schema_has_no_colour_vocabulary (Module 2) against the DERIVED wire schema, not against this module directly.

This module is pure and synchronous: no I/O, no catalog registration, no import from parrot.bots/parrot.clients (core A2UI invariant, spec G9).

Attribute C4BoundaryType

Attribute C4ElementType

Attribute C4Level

Attribute Direction

Attribute EdgeKind

Class GraphEdge

A directed edge between two :class:GraphNode ids.

Fields:

Field Type Default Description
from_ str Source node id (wire alias from — from is a Python keyword, hence the trailing underscore).
to str Target node id.
label Optional[str] None Display label (e.g. a mermaid edge label, or a CEL predicate summary from flow_definition_to_graph).
kind Optional[EdgeKind] None Edge stroke kind. Renderer default is solid.
condition Optional[str] None Free text (e.g. "on_error", a CEL predicate) — never interpreted here; carried through for renderers/tooltips.
technology Optional[str] None
hint Optional[RelHint] None
bidirectional Optional[bool] None

Class GraphGroup

A named grouping of node ids (rendered as a bounding box).

Fields:

Field Type Default Description
id str Unique group identifier.
label Optional[str] None Display label for the group.
nodes list[str] Member node ids. Every id must exist in the owning :class:GraphSpec and belong to at most one group.
parent Optional[str] None
c4_type Optional[C4BoundaryType] None

Attribute GraphKind

Class GraphLayout

Layout configuration and (optionally) precomputed node positions.

Fields:

Field Type Default Description
engine LayoutEngine 'layered' The layout engine hint. "layered" (default) is computed server-side (graph/layout.py); "force" is an interactive- renderer-only hint (static lanes degrade to layered); "manual" requires positions to cover every node.
rank_sep Optional[float] None Abstract rank-axis spacing unit (wire alias rankSep) — NOT pixels.
node_sep Optional[float] None Abstract cross-axis spacing unit (wire alias nodeSep) — NOT pixels.
positions Optional[dict[str, Position]] None Precomputed node positions, keyed by node id. Required (and must cover every node) when engine == "manual".
shape_in_row Optional[int] None
boundary_in_row Optional[int] None

Class GraphNode

A single node in a :class:GraphSpec.

Fields:

Field Type Default Description
id str Unique node identifier (unique within the owning GraphSpec).
label Optional[str] None Display label. Renderers default to id when omitted.
shape Optional[NodeShape] None Node shape hint. Renderer default is rect (rounded for kind="state" graphs).
group Optional[str] None The :class:GraphGroup.id this node belongs to, if any.
state Optional[NodeState] None DATA, not styling — the domain state of whatever this node represents. The renderer contract maps it to a viz-core semantic status role (documented in catalog/viz_core/graph.py/the renderer modules, not here).
icon Optional[str] None A free-form icon name hint (parrot_icon semantics per KPICard.icon, FEAT-527) — never an asset path or pixel size.
meta Optional[dict[str, Any]] None Opaque data surfaced by renderers as a tooltip. Never interpreted by this module.
c4_type Optional[C4ElementType] None
technology Optional[str] None
description Optional[str] None

Class GraphSelection

Node selection state.

Fields:

Field Type Default Description
selectable bool False Whether nodes may be selected (renderer hint).
selected Optional[str] None The currently selected node id, if any.

Class GraphSpec

Wire vocabulary of the viz-core Graph composite (camelCase aliases).

This is the SINGLE source of vocabulary for Graph — see this module's docstring. action is deliberately NOT a field here: it is the component-level prop the catalog layer (catalog/viz_core/ graph.py) declares explicitly in GRAPH_SCHEMA (a $ref to common_types.json#/$defs/Action), because action is not part of the official ComponentCommon (spec §2 Overview).

Fields:

Field Type Default Description
kind GraphKind 'flowchart' The graph's semantic kind. kind="dag" enforces acyclicity; "flowchart"/"state"/"sequence" legally allow cycles (real workflows loop).
direction Direction 'TB' Layout direction hint honoured by compute_positions.
title Optional[str] None Optional display title.
accessible_description Optional[str] None viz-core common prop (wire alias accessibleDescription) — plain-language summary used as the lowered fallback's first line and the SVG <title>.
size VizSize 'tile' viz-core common prop — layout INTENT (inline/tile/ hero), never pixels.
nodes list[GraphNode] The graph's nodes.
edges list[GraphEdge] The graph's edges. Every endpoint must reference an existing node id.
groups Optional[list[GraphGroup]] None Optional node groupings. Every member must exist and belong to at most one group.
layout Optional[GraphLayout] None Optional layout configuration/precomputed positions.
selection Optional[GraphSelection] None Optional selection state.
data Optional[dict[str, dict[str, Any]]] None INPUT-ONLY — a data-model binding descriptor replaces this field in the DERIVED wire schema (GRAPH_SCHEMA, Module 2). Resolves to {node_id: {"state"?: NodeState, "label"?: str, "meta"?: dict}}, overlaying the matching node's state/ label/meta at render time.
level Optional[C4Level] None

Attribute LayoutEngine

Attribute NodeShape

Attribute NodeState

Class Position

An abstract-unit 2D coordinate (origin top-left, never pixels).

Fields:

Field Type Default Description
x float Horizontal coordinate, abstract units.
y float Vertical coordinate, abstract units.

Attribute RelHint

Attribute VizSize

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally