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.Example
Each attach method takes the objects themselves, not their ids. The examples assumelong_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.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.
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
idandapplicationId. An object your function builds itself has noid, and the attach call raises You can only attach results to objects with an id. - Treat
idas an opaque key. On a 2026.9 version it equalsapplicationId; 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 noapplicationIdis keyedspk:followed by its old content hash.
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 withcreate_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.