Skip to content

Agents ​

Give your coding agent these references to create, edit, save, and export drawings using the toolkit.

ResourceUse
Package skillInstall version-matched Vyuh Diagram guidance into Codex or another coding agent.
llms.txtA compact index for finding the relevant API and examples.
llms-full.txtThe complete consumer reference in one text file.

The references include package setup, API signatures, runnable examples, supported capabilities, validation errors, and persistence contracts. Use the index when your agent can fetch individual pages, or the full reference when supplying context directly.

Start with the package skill when the agent is working inside a Flutter project. It supplies focused integration rules automatically; the text references remain useful for deeper API lookup and retrieval-based agent systems.

Editing a drawing at runtime ​

A runtime agent edits through its own DiagramController on the shared diagram, with the same verbs as the canvas and inspector.

  1. Discover. controller.verbs(ids) lists the verbs on those elements (none for diagram verbs such as createShape). Each description has a name, label, parameters and availability; each parameter has a name, type, isRequired, a description and, for scalars, a schema that is a ValueField with its bounds or options.
  2. Check. controller.canPerform(ids, verb, args) returns the result perform would, without changing anything.
  3. Perform. controller.edits.perform(ids, verb, args) returns a EditResult; a creating verb reports the new ID in id. Denials, including invalid arguments, return a code and reason instead of throwing.

Arguments take a JSON form: an enum or route by name, a color as an ARGB integer, a point as {x, y}, a size as {width, height} and a rectangle as {left, top, width, height}.

dart
final revision = agent.document.revision;
final result = agent.perform(['task-1'], 'setStyle', {
  'stroke': 0xFFB45309,
  'strokeStyle': 'dashed',
  'expectedRevision': revision,
});

Pass the expectedRevision read before awaiting the model: if anyone changed the document meanwhile, the verb is denied with DiagramDenialCode.conflict instead of overwriting their edit.

Every verb is a setter, one half of a pair (such as group/ungroup), or derived from a setter (such as align from setElementBounds), so an agent can always state the reverse edit. There are no toggles; undo is history, not a reverse verb. See collaboration for sharing a diagram with a user.