Skip to main content

AutomationContext Reference

The AutomationContext is your function’s interface to Speckle at runtime. It provides:
  • Access to model data that triggered the automation
  • Authentication for Speckle API interactions
  • Methods to report results and analysis findings
  • Tools to create new model versions and file artifacts
  • Logging capabilities for debugging
Your function receives this context automatically - no setup required.

Properties

These are listed with their Python names. The C# SDK has equivalent PascalCase members on IAutomationContext, the interface your C# function receives.

Core Properties

These properties provide essential context about the current automation run:
  • automation_run_data: The current automation run data as an AutomationRunData object
  • speckle_client: The Speckle client instance used to interact with the Speckle server

AutomationRunData

The AutomationRunData object has the following properties that help with identifying the current run:
  • project_id: The project ID of the current automation run
  • speckle_server_url: The Speckle server URL
  • automation_id: The automation ID the function is configured with
  • automation_run_id: The ID of the current automation run
  • function_run_id: The ID of the current function run
  • [triggers]: The list of triggers that initiated the automation run (this is a single model id for now)

Configuration values

The Automate runtime also feeds your function with the following data if it has been defined:

Methods

The AutomationContext provides a range of methods to interact with Speckle data, manage results, and log progress.

Working with Data

Reporting Function Success

Use these methods to update the automation run status. Note that if you call multiple status methods, only the last one will be recorded and displayed in the UI. This may cause confusion if multiple status methods are called.

Handling Results

These methods help in tagging and categorizing objects with statuses: affected_objects takes the objects themselves (one Base or a list), not their ids.

Best Practices for object annotations

  • Use categories to group related annotations, and provide clear, actionable messages.
  • Avoid creating too many annotations, e.g. one per object. Instead, group related objects and annotate them together.
  • Categories can be used to group annotations by severity, type, result description or any other relevant criteria.
  • attach_result_to_objects() is a generic method that can be used to add any type of annotation to objects. An additional level parameter can be used to specify the type of annotation.
  • The metadata parameter can be used to store additional arbitrary information about the objects, as a key:value store.
Experimental: The only metadata keys that change how results display in the Dashboards Automate results widget are gradient: Bool and gradientValues: List[str]:

Creating function artefacts

Manage new model versions and save result as file/blob artefacts: Signatures and return values are in the API Reference; examples are in Function Artefacts.

Context Views

Lastly a property of the AutomationContext which is part result part context context_view records a view state for the function run, in the form of the url schema to reference specific federations of models and model@version together in a scene. The 3D viewer does not show Automate results; see Viewing Automation Results for where run results appear.

Further Reading

More detail including code examples for using these methods are covered in:
Last modified on October 19, 2026