Skip to main content
The Go SDK and docs are currently in beta. Report issues on GitHub.
A single condition that, when met, halts the server-tool agent loop.

Supported Types

StopServerToolsWhenFinishReasonIs

stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionFinishReasonIs(components.StopServerToolsWhenFinishReasonIs{/* values here */})

StopServerToolsWhenHasToolCall

stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionHasToolCall(components.StopServerToolsWhenHasToolCall{/* values here */})

StopServerToolsWhenMaxCost

stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionMaxCost(components.StopServerToolsWhenMaxCost{/* values here */})

StopServerToolsWhenMaxTokensUsed

stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionMaxTokensUsed(components.StopServerToolsWhenMaxTokensUsed{/* values here */})

StopServerToolsWhenStepCountIs

stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionStepCountIs(components.StopServerToolsWhenStepCountIs{/* values here */})

Union Discrimination

Use the Type field to determine which variant is active, then access the corresponding field:
switch stopServerToolsWhenCondition.Type {
	case components.StopServerToolsWhenConditionTypeFinishReasonIs:
		// stopServerToolsWhenCondition.StopServerToolsWhenFinishReasonIs is populated
	case components.StopServerToolsWhenConditionTypeHasToolCall:
		// stopServerToolsWhenCondition.StopServerToolsWhenHasToolCall is populated
	case components.StopServerToolsWhenConditionTypeMaxCost:
		// stopServerToolsWhenCondition.StopServerToolsWhenMaxCost is populated
	case components.StopServerToolsWhenConditionTypeMaxTokensUsed:
		// stopServerToolsWhenCondition.StopServerToolsWhenMaxTokensUsed is populated
	case components.StopServerToolsWhenConditionTypeStepCountIs:
		// stopServerToolsWhenCondition.StopServerToolsWhenStepCountIs is populated
}