Docs / AI Agent Reference

AI Agent Reference

This page provides a structured, machine-readable summary of the Modellus system for AI agents that generate, interpret, or modify Modellus models.

Schema Files

Canonical references for model structure and expression syntax:

SchemaPurpose
Model SchemaFull model JSON structure: shapes array, properties, visualization settings
Expression SchemaExpression language grammar: statements, operators, functions, AST nodes

Shape Types

Type IDClassPurposeParent Required
expressionExpressionShapeDefine equations, parameters, ODEs, recurrencesNo
tableTableShapeDisplay/enter data, perform regressionNo
casesTableCasesTableShapeEditable table of input-term starting values, one column per caseNo
dataTableDataTableShapeTable of imported data (CSV upload, CSV URL or the data catalog)No
chartChartShapePlot data series and regression curvesNo
frequencyChartFrequencyChartShapeCount and summarise the discrete values a term takesNo
bodyBodyShapeAnimated sprite controlled by termsReferential
pointPointShapePositioned dot driven by X/Y termsReferential
lineLineShapeSegment between two coordinate pairsReferential
arcArcShapeCurved segment / angle indicatorReferential
vectorVectorShapeArrow with direction and magnitudeReferential
sliderSliderShapeInteractive parameter controlNo
gaugeGaugeShapeCircular meter displayNo
valueValueShapeNumeric readout of a termNo
mediaMediaShapeImage / backgroundNo
textTextShapeRich text annotationNo
rulerRulerShapeRetired — the ruler is now the ruler block object, placed as a component. Kept so earlier models still openNo
protractorProtractorShapeRetired — the protractor is now the protractor block object, placed as a component. Kept so earlier models still openNo
referentialReferentialShapeCoordinate system containerNo
questionQuestionShapeAssessment questionNo
mindMapBubbleMindMapBubbleShapeSpeech-bubble mind map node with a text labelNo
mindMapRectangleMindMapRectangleShapeRounded-box mind map node with a text labelNo
mindMapCircleMindMapCircleShapeEllipse mind map node with a text labelNo
mindMapConnectorMindMapConnectorShapeLine or arrow that follows the shapes it linksNo
componentComponentShapeObject composed from registered building blocks (clock, compass, speedometer, circular gauge, rotating vector, orbit system, ruler, protractor, or a bespoke composition)No

Expression Language Summary

Statement Types

KindPatternTerm Type
functionname = exprPARAMETER (no dependencies) or FUNCTION
differential\frac{dx}{dt} = exprDIFFERENTIAL
functionSubscriptx_{n} = exprRECURRENCE
functionSubscriptDigitx_0 = exprPARAMETER
functionIndependentf(t) = exprFUNCTION
conditionalname = \begin{cases}...\end{cases}FUNCTION
displayexpr (no assignment)None (visual only)

Built-in Functions

Trig:      \sin, \cos, \tan, \cot, \sec, \csc
Inv Trig:  \arcsin, \arccos, \arctan
Hyperbolic: \sinh, \cosh, \tanh
Log:       \ln, \log
Two-arg:   \max(a,b), \min(a,b), \mod(a,b)
Utility:   sign(x), rnd(x), irnd(x), int(x), round(x)
Other:     \det(x), \sqrt{x}

Integral notation: expressions may include LaTeX forms such as \int_{a}^{b} f\left(x\right)\,\mathrm{d}x. For integer-part behavior, use int(x).

Operators

Arithmetic: +  -  \cdot  /  \frac{}{}  ^{}  !  \sqrt{}
Comparison: =  >  <  \ge  \le  \neq
Logical:    \lor (OR)  \land (AND)
Special:    \Delta (finite difference)

Constants

\pi = 3.14159...
e (or \E) = 2.71828...

Editor Shortcuts

ActionmacOSWindows
Differential template (\frac{dx}{dt})Option+/Alt+/
Floor template (\lfloor x\rfloor)Option+_Alt+_
Ceil template (\lceil x\rceil)Command+_Not available

Model JSON Structure

{
  "properties": {
    "independent": { "name": "t", "start": 0, "end": 10, "step": 0.1 },
    "initialValuesByCase": { "1": { "x": 0, "v": 5 } }
  },
  "shapes": [
    {
      "type": "expression",
      "id": "uuid",
      "expression": "\\displaylines{g=9.8\\\\\\frac{dx}{dt}=v}",
      "position": { "x": 100, "y": 100 }
    },
    {
      "type": "referential",
      "id": "uuid",
      "children": [
        { "type": "point", "id": "uuid", "xTerm": "x", "yTerm": "y" }
      ]
    }
  ]
}

Notebook Models

Besides board models, Modellus supports document-style notebooks. A notebook definition adds a top-level notebook field to the model JSON:

{
  "properties": { ... },
  "notebook": {
    "title": "string",
    "author": "string",
    "blocks": [
      { "id": 1, "type": "header", "content": "string", "backgroundColor": "transparent", "borderColor": "#e8e8e8" }
    ]
  }
}

Block type values: header, text, expression, chart, table, simulation, gauge, slider, value, media, question, ruler, protractor, slope. Expression blocks store the same LaTeX expression language in content; blocks are rendered top to bottom in array order.

Building Blocks and Component Objects

Visual objects that are not one of the shape classes above are built from building blocks: approved primitives, modifiers, behaviours and components held in a single registry. An agent never writes rendering code — it composes a declarative object definition through structured tools and the deterministic compiler turns it into an editable ComponentShape.

Building a new object? Object Definition is the complete document specification — identity, parameters, locals, the node tree, bindings, behaviours and what gets a definition refused — and Block Reference lists every block with its properties, defaults and ranges, generated from this same registry. The summary below is the shape of it.
LayerExamples
Primitivesrect, circle, ellipse, line, polyline, polygon, arc, ring, path, text, image, group
Modifierstranslate, rotate, scale, mirror, opacity, visibility, stroke, fill, z-order, repeat
Behavioursselectable, draggable, resizable, rotatable, hoverable, tooltip, drag-angle, drag-rotate, clickable, press-and-slide, keep-time
Componentsdial-face, tick-ring, label-ring, pointer-hand, key-cap, seven-segment-display, clock, compass, speedometer, circular-gauge, rotating-vector, orbit-system, steering-wheel, thermometer, calculator

Call list_building_blocks for the live catalogue; it is generated from the same registry the renderer uses, so it never drifts. The published copy of it is Block Reference.

A definition is one JSON document: schemaVersion, type, category: "component", parameters (what the user edits, held in the shape's own properties), locals (derived values evaluated in order, LaTeX formulas over declared names only) and root (the node tree). A node is { id, type, properties, bindings, modifiers, behaviours, children } for a primitive or { id, type, parameters, modifiers, behaviours } for a component; a binding always wins over a constant, and when drops a child before compilation. Reserved parameters $width, $height, $iteration, $playing, $precision, $index and $count are reached through locals. Colours, fonts and axis values are written as design tokens ("token:stroke.accent"), never as literals. See Object Definition for the full specification.

Tools

ToolPurpose
list_building_blocks, search_building_blocks, get_building_block_schemaDiscover blocks and read their properties, defaults and ranges
list_model_variablesRead the variables of the open model with their current values
create_object_draft, get_object_draftStart and read a draft, optionally seeded with a component
add_primitive, add_component, add_group, add_childBuild the node tree
set_property, set_parameter, apply_modifier, add_behaviourConfigure nodes
bind_variable, bind_expressionDrive a property from a model variable or a LaTeX expression
validate_object, render_object_previewCheck the draft and preview it in isolation
insert_object, save_custom_componentInsert a valid object into the document or register it for reuse

Over the chat tool bridge these are named modellus_blocks_<tool>, for example modellus_blocks_bind_expression.

Workflow

  1. list_model_variables and list_building_blocks to see what exists
  2. create_object_draft, then add nodes, parameters, modifiers, behaviours and bindings
  3. validate_object — errors come back as { code, path, message, expected, suggestion }
  4. Correct the draft with the same tools and validate again
  5. render_object_preview to check the result, then insert_object

Example error:

{ "valid": false, "errors": [ { "code": "UNKNOWN_VARIABLE", "path": "root.children[2].bindings.rotation", "message": "The variable 'minutes' does not exist in the current model.", "suggestion": "minute" } ] }

Limits

Key Rules for Agents

For the complete formal grammar specification, see the Expression Schema page.