Skip to content

StageTermination.Custom

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Diagnostics.StageTermination

StageTermination.Custom Class

Application-specific termination cause not covered by framework cases. Use this from an onLoopCompleted callback when a stage has app-specific semantics (e.g. "Reconciled — 7 outstanding issues").

public sealed record StageTermination.Custom : NexusLabs.Needlr.AgentFramework.Diagnostics.StageTermination, System.IEquatable<NexusLabs.Needlr.AgentFramework.Diagnostics.StageTermination.Custom>

Inheritance System.Object 🡒 StageTermination 🡒 Custom

Implements System.IEquatable<Custom>

Remarks

ToTagValue() is intentionally not overridden: it returns the bounded discriminator "Custom" (the inherited default) so a run-specific Reason cannot explode the cardinality of the termination_cause metric/span tag. The full reason is preserved on the record, round-trips through JSON, and is reachable via Properties — read it there for diagnostics rather than from the tag.

Constructors

Custom(string, IReadOnlyDictionary<string,object>) Constructor

Application-specific termination cause not covered by framework cases. Use this from an onLoopCompleted callback when a stage has app-specific semantics (e.g. "Reconciled — 7 outstanding issues").

public Custom(string Reason, System.Collections.Generic.IReadOnlyDictionary<string,object?>? Properties=null);

Parameters

Reason System.String

Human-readable description of the termination, kept for diagnostics. It round-trips through JSON and is available via pattern matching; it is deliberately not used as a metric/span tag value, so it is safe to include run-specific detail here.

Properties System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>

Optional structured metadata for richer post-mortem queries. Values typed as System.Object for flexibility — note that JSON deserialization yields System.Text.Json.JsonElement values, not the original concrete types.

Remarks

ToTagValue() is intentionally not overridden: it returns the bounded discriminator "Custom" (the inherited default) so a run-specific Reason cannot explode the cardinality of the termination_cause metric/span tag. The full reason is preserved on the record, round-trips through JSON, and is reachable via Properties — read it there for diagnostics rather than from the tag.

Properties

StageTermination.Custom.Properties Property

Optional structured metadata for richer post-mortem queries. Values typed as System.Object for flexibility — note that JSON deserialization yields System.Text.Json.JsonElement values, not the original concrete types.

public System.Collections.Generic.IReadOnlyDictionary<string,object?>? Properties { get; init; }

Property Value

System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>

StageTermination.Custom.Reason Property

Human-readable description of the termination, kept for diagnostics. It round-trips through JSON and is available via pattern matching; it is deliberately not used as a metric/span tag value, so it is safe to include run-specific detail here.

public string Reason { get; init; }

Property Value

System.String