Skip to main content

Core SDK reference

This is the public author surface. Constructors supplied for library authors (NewResource, NewAttached, FailedResource, recording hooks and raw worker APIs) are intentionally outside the ordinary pipeline workflow.

Pipeline

SymbolContract
Main(id, fn, ...MainOption)serve one typed pipeline
WithTriggers(...trigger.T)declare automatic entry points
WithConcurrency(policy)set Queue, CancelPrevious, or Parallel
Context.RunId()current run identity
Context.Logger()replay-safe Temporal logger
Var(name)visible installation value reference for trigger params
UseSecret(name)secret-name reference for trigger params
Secret(ctx, name)secret reference used inside the run

Handles and ownership

SymbolContract
Resource[T].Ready(ctx)wait and return T; convergence failure fails the run
Resource[T].TryReady(ctx)wait and return (T, error)
Attached[T]foreign readable handle with no ownership methods
Parent(h)make h own the declaration
Children(h...)give existing owned handles to the declaration
WithLabels(map)attach selection labels
WithFlow / WithFlowToannotate an outgoing topology edge
FlowPort(n)set the edge target port
ToStand(ctx, h, ...TransferOption)move an owned subtree to the pipeline stand
KeepFor(duration)TTL under the stand; omit for explicit deletion

Flow protocols are TCP, HTTP, GRPC, PrometheusPull, RemoteWrite, and OTLP. Flow annotations describe topology; they do not configure networking.

Agents

SymbolContract
NewAgentdeclare a record and obtain cloud-init installation data
NewAgentViaSSHdeclare and install on an existing SSH machine
AttachAgentuse an existing agent without ownership
SelectAgentssnapshot by labels and capability requirements
Needrequire a ready capability
WhereLabel, WhereInconstrain capability labels
PublishCapabilityrecord what a workflow made true on a machine

AttachAgent accepts capability requirements but not tree ownership. A selection is also foreign and does not follow future matching agents.

Actions and artifacts

SymbolContract
activity.Fn, ActivityFn, Fn0bind a stable name, body and serializable input
activity.Activityexecute on one agent
activity.ActivityAllexecute concurrently on a snapshot
WithGuaranteeAtLeastOnce or AtMostOnce
WithTimeout, WithHeartbeatbound execution and detect loss
NewArtifactpublish FromBytes or FromAgentFile
AttachArtifactread a foreign artifact record

An at-most-once timeout joins pipeline.ErrUnknown: the system cannot prove whether the external effect happened and will not repeat it silently.

See resource libraries for constructors that return these same handles.