Documentation Index
Fetch the complete documentation index at: https://docs.davinci-app.com/llms.txt
Use this file to discover all available pages before exploring further.
Description
Actions describe the behavior of a system using a subset textual syntax from SysML v2. Actions can be composed using nested levels to refine behavior in detail, with sequences defined using standard Python control flow and specialized action functions.Syntax for Action Modeling
Actions in Davinci use a Python-based syntax that aligns with SysML v2 action modeling principles. This approach provides:- Executable Behavior: Actions are defined as executable Python code that can be simulated and tested
- Hierarchical Composition: Actions can call nested sub-actions to build complex behaviors from simple components
- Standard Control Flow: Use familiar Python constructs (if/else, for, while) for action sequencing
Key Concepts
Actions as Functions: Each action is a function that can be called by parent actions or executed directly. Attribute Binding: Attributes referenced in action sequences are global variables, enabling data flow between actions and physics simulations. Flow Modeling: Theflow() function explicitly models message passing and data routing between system components, critical for architectural definition.
View Types
| View | Description |
|---|---|
| Activity | Visually represent action flow and logic. |
| Sequence | Visualize interactions over time. |
| Properties | Edit the object’s properties, attributes, and metadata. |
| Table | Display the object and its children in a tabular format. |
| Tree | View the hierarchical structure of the object. |
| Relationships | Explore the network of connections to other objects. |
Properties Fields
Name of the object.
Short name of the object.
Description of the object.
Code that defines the action’s behavior and flow. The sequence uses standard Python syntax with specialized functions and reference notation for modeling behaviors.
A list of all Relationships this object has with other model objects.Read more about Relationships
DSL Syntax
Davinci action sequences use a Python-like DSL. The runtime resolves model references before execution, but this documentation uses the friendlier@'name' notation for readability in examples.
In the underlying DSL implementation, model references are transformed into executable calls and bindings during preprocessing. The examples below keep the docs-friendly
@'name' form, even though the runtime internally uses a lower-level resolved representation.Model References
Actions, attributes, ports, and other modeled elements can be referenced using@'name':
Attribute Runtime Behavior
Attributes act like execution-time scalar variables while an action is running. When the sequence starts, referenced attributes are bound into the runtime so the action can read their current values:- Reading
@'name'pulls the current execution-time value for that attribute. - Writing
@'name' = ...updates the runtime value used by later steps in the same execution. - These updates do not rewrite the modeled attribute definition itself.
- In other words, action code works with an execution context, not by editing the persistent model.
Action Inputs
Actions can be defined in one of two ways:No-input actions
If an action does not need inputs, write the sequence directly. Noaction(...) declaration is needed.
Actions with inputs
If an action needs caller-provided values, declare them at the top withaction(...). The declared parameters become normal Python variables inside the action body.
action(...)must be the first non-comment line in the action sequence.- If
action(...)is present, the full executable body must be indented under it. - Parameters are plain Python identifiers, not model references.
- Parameters without defaults are required at the call site.
- Parameters with defaults are optional at the call site.
Calling Actions
Actions are called like functions. Parentheses are optional for no-argument calls and may be used with positional or keyword inputs.Returning Outputs with end()
Actions return outputs by passing keyword arguments to end(...). end() with no arguments is still valid when no outputs are needed.
Capturing Outputs
When an action returns outputs, capture the result in a Python variable and access named outputs with dot notation.Control Flow
Standard Python control structures remain available:Runtime Functions
fork([...])
fork() executes multiple branches in parallel. A branch may be a single action call or a named group(...) block.
trigger(...)
trigger() starts an action or state asynchronously and immediately continues the current flow.
trigger() for fire-and-forget behavior. Do not use it when the current action needs the result before continuing.
end(...)
end() exits the current action flow and may optionally return outputs.
stop()
stop() immediately halts the current action hierarchy.
checkpoint("name") and retry("name")
Use checkpoints to label a recovery point and retry() to resume execution from that named location.
- Checkpoint names must be unique within the action.
retry()may only target a checkpoint defined in the same action.- Guard
retry()with a counter or condition to avoid infinite retry loops.
group("name"): Blocks
Use group(...) to define a named sub-flow for a parallel branch. Groups must be declared before the fork() call that uses them.
Message Flow Modeling
Useflow() to explicitly model data and message routing between ports or entities:
Code Object References
Code objects may be called and imported inside action sequences:Complete Example
Best Practices
Action Composition
- Single Responsibility: Give each action a clear purpose.
- Hierarchical Design: Decompose complex behavior into smaller reusable actions.
- Consistent Outputs: Prefer consistent output keys across branches when returning data from
end(...).
Sequence Definition
- Use Inputs Deliberately: Prefer
action(...)parameters for local action inputs instead of relying only on global attributes. - Guard Recovery Paths: Protect
retry()with explicit retry limits or exit conditions. - Keep Groups Focused: Use
group(...)only to express meaningful parallel branches. - End Intentionally: Use
end()when you need to terminate early or return outputs; otherwise allow the sequence to reach its natural end.
Technical Implementation
Parse-Time Resolution
When an action sequence is executed, the system performs several preprocessing steps before runtime:- Reference Resolution: Model references such as
@'Initialize System'are resolved into executable calls and bindings. - Action Hoisting:
action(...)declarations are transformed into callable action entry points with injected parameters. - Group Hoisting:
group("name"):blocks are rewritten into callable branch functions for use byfork(). - Runtime Primitive Wiring:
trigger(),checkpoint(), andretry()are connected to runtime execution semantics. - Code Import Resolution: Code-object references are transformed into module imports and callable functions as needed.