Skip to main content
AutomationContext provides methods to attach structured annotations to objects, allowing automated analysis and validation workflows to provide meaningful feedback.

Object Annotations

Object annotations enable attaching different types of messages (errors, warnings, informational notes, and successes) to specific objects within an automation run. This helps in tracking issues, communicating insights, and guiding decision-making.
Why annotate objects? Annotations allow functions to return structured results, making them actionable in dashboards, reports, and workflows.

Example

Each attach method takes the objects themselves, not their ids. The examples assume long_beams, loaded_beams, and optimized_items are lists of objects your function picked from the version it received.
main.py
AutomateFunction.cs

Annotation Types

Metadata and Customisation

Annotations can be enriched with additional metadata to improve interpretability and visualization.
Using Metadata in Annotations: The metadata parameter allows storing arbitrary key-value pairs alongside annotations, making them more descriptive and informative.

Example

Gradient Visualization

Certain metadata keys affect how results are displayed in the Dashboards Automate results widget:
  • gradient: Bool: Enables gradient-based visualization.
  • gradientValues: List[str]: Specifies values to apply to objects.
Example:

Attach results to 2026.9 models

Your function receives a version in the 2026.9 data model the same way as any other: receive_version() / ReceiveVersion() return a Base tree built from the version’s bundle. The attach methods key each result by the object’s id and store its applicationId alongside. On a tree built from a 2026.9 version, every object’s id is set to its applicationId, so the call succeeds and the result matches the object in the model.
  • Attach results to objects you received. They carry both id and applicationId. An object your function builds itself has no id, and the attach call raises You can only attach results to objects with an id.
  • Treat id as an opaque key. On a 2026.9 version it equals applicationId; on a version published before 2026.9 it is a content hash. Do not parse, compare, or cache it as a hash.
  • Re-run automations after a model is migrated. Results stored before migration reference the old content-hashed ids, which the migrated model no longer carries. A new run keys its results by applicationId. A migrated object that had no applicationId is keyed spk: followed by its old content hash.
id equalling applicationId comes from how Automate receives 2026.9 versions today, not from a documented contract. A future Automate release can change it, so do not build tooling that depends on it.
To see the results a run recorded, see Viewing Automation Results.

Publish results as a new version

When a result is new model data rather than a finding on existing objects, publish it to a different model with create_new_version_in_project / CreateNewVersionInProject. In C#, Speckle.Automate.Sdk 2026.9.0-beta.4 and later also take a BundleBuilder and publish it in the 2026.9 format; call WaitForVersion before your function returns. See Publish a bundle and Function Artefacts.

Best Practices

  • Use the appropriate annotation type to convey severity accurately.
  • Group related annotations into categories for better organization.
  • Provide clear, actionable messages to aid decision-making.
  • Attach each result to the objects it concerns to maintain traceability.
  • Leverage metadata for richer annotations and better UI integration.
By leveraging these methods, automation functions can provide structured feedback that enhances decision-making and workflow efficiency.
Last modified on October 19, 2026