AddSpeckleSdk once at startup before resolving IOperations or IClientFactory. For scripts: copy the bootstrap from Automate with scripts — do not customize unless you need extra assemblies. For connectors: see Dependency injection (connectors).
AddSpeckleSdk
Describes your host application.
Application is a record: Application(string Name, string Slug).Your application’s version string, used for telemetry and diagnostics.
Overrides the reported Speckle.Sdk version. Defaults to the assembly version.
Assemblies containing custom
Base-derived types (including Speckle.Objects, if used) that TypeLoader should be able to resolve during deserialization.What It Registers
| Registration | Registers |
|---|---|
TypeLoader.Initialize(...) | Type resolution for speckle_type across the provided assemblies |
ISpeckleApplication (singleton) | Host application metadata (name, version, Speckle version) |
ISdkActivityFactory (singleton, no-op default) | Tracing hook — provide your own to integrate with OpenTelemetry |
ISdkMetricsFactory (singleton, no-op default) | Metrics hook |
| Every interface-implementing class in the SDK assembly (transient) | IOperations, IClientFactory, IAccountFactory, IAccountManager, IServerTransportFactory, ISendPipelineFactory, and more |
AddLogging() | Microsoft.Extensions.Logging integration |
Application
Application has no required format for Slug beyond being a stable identifier for your app — it’s used for telemetry, not validation.Registering Custom Activity or Metrics Factories
If you want tracing or metrics integration, register your own implementation before callingAddSpeckleSdk — the SDK uses TryAddSingleton, which only registers a default if one isn’t already present:
FAQ
What is the minimum bootstrap for a script?
What is the minimum bootstrap for a script?
new ServiceCollection().AddSpeckleSdk(new Application(...), "1.0.0").BuildServiceProvider() — see the canonical helper in Automate with scripts.Do I need to pass Speckle.Objects in assemblies?
Do I need to pass Speckle.Objects in assemblies?
Yes if you send or receive geometry types from that package. Without it, those types deserialize as plain
Base.Next Steps
Dependency injection (connectors)
What AddSpeckleSdk registers
Automate with scripts
Minimal bootstrap example
Client API
Resolve IClientFactory after registration