Skip to main content

Speckle Automate API Reference

This reference covers function inputs and the automation context in the Python and C# Automate SDKs. Where the two SDKs differ, the reference says so.
To process versions published in 2026.9, a function needs specklepy 2026.9.0b3 with the bundle extra (specklepy[bundle]==2026.9.0b3), or Speckle.Automate.Sdk 2026.9.0-beta.4 or later. A stable 2026.9.0 release replaces the beta pin.
Start with the Quickstart Guide to understand the basic concepts before using this API reference.

Function Inputs

Function inputs define what users can configure when running your automation. They automatically generate forms in the web interface.

Supported Types

Validation Attributes

In C#, FunctionInputs must be a struct: the runner’s Main<TInput> constrains TInput to a struct, so a class does not compile. Set defaults with [DefaultValue].

Example: Simple Inputs

simple_inputs.py

Example: Dropdown Selections

dropdown_selections.py

Example: Secure Inputs

secure_inputs.py

Automation Context

The automation context is your function’s interface to Speckle. It gives you the run’s data, an authenticated client, and the methods for reporting results. In Python your function receives an AutomationContext. In C# it receives an IAutomationContext: the concrete AutomationContext class is internal, so type your parameters with the interface.

Properties

AutomationRunData
Metadata about the current run: project ID, server URL, automation and run IDs, and the triggers that started it.
SpeckleClient / IClient
Pre-configured, authenticated client for Speckle API calls.
Your function inputs are not a context property. They arrive as the second argument of your function.
speckle_client gives you the rest of the SDK: everything in specklepy (Python) or Speckle.Sdk (C#) is available inside your function. For generated specklepy reference, see the specklepy API documentation.

Methods

The Python methods are synchronous: call them without await, from a plain def function. In C#, ReceiveVersion, CreateNewVersionInProject, WaitForVersion, and StoreFileResult return a Task; the status and attach methods are synchronous.

Getting model data

receive_version.py
ReceiveVersion.cs
Returns the version that triggered the run as a Base tree. For the shape of that tree, see Handling Data in Functions.

Status reporting

Report the run’s final status with one of these methods. If you call more than one, the last call wins.
status_reporting.py
StatusReporting.cs
If your function returns without reporting a status, the runner marks the run successful with a warning message. If it throws, the runner marks the run as an exception and writes the error to the run log.
In C#, the runner keeps only a failed or succeeded status when your function returns. A run marked with MarkRunException is replaced by that warning success, so throw instead.

Annotating objects

Attach a result to the objects it concerns. Pass the objects themselves, not their IDs.
annotating_objects.py
AnnotatingObjects.cs
attach_result_to_objects / AttachResultToObjects takes the same arguments after a leading level (ObjectResultLevel).

Creating new model versions

Both SDKs refuse to publish to the model that triggered the run, so an automation cannot trigger itself.
create_new_version.py
CreateNewVersion.cs
Returns the new Version and records it on the run’s results. Its id is reserved: the version appears once the server finishes processing it, so wait before you read it back in the same run. See Wait for the version.

Publish a bundle

In C#, Speckle.Automate.Sdk 2026.9.0-beta.4 and later add a CreateNewVersionInProject overload that takes a BundleBuilder. It publishes through a model ingestion, like Send3, and returns a SendResult as soon as the upload completes. The server creates the version when it finishes ingesting, so call WaitForVersion before your function returns. Otherwise the run’s result links can point at a version that does not exist yet.
PublishBundle.cs

Saving files

store_file_result.py
StoreFileResult.cs
In Python the call returns the uploaded file’s blob ID. In C# it returns nothing.

Working with Speckle Data

receive_version() / ReceiveVersion() return a Base tree. For a version published in 2026.9, that tree is a Collection root whose elements hold nested Collections and DataObjects, each with name, displayValue, and properties. Handling Data in Functions shows how to walk and filter it.

Complete Function Example

This function checks that every object in a chosen category has a value for a chosen property. It fails the run and flags the objects that do not.
main.py
The C# class is resolved from the template’s Program.cs, which registers it and passes Run to the runner. See Making Your Function.

Next Steps

Last modified on October 19, 2026