TsgcHTTP_API_AnthropicProperties › CircuitBreaker

CircuitBreaker Property

Protects the client from cascading failures by short-circuiting requests when the Anthropic API becomes unhealthy

Syntax

property CircuitBreaker: TsgcWSCircuitBreaker read FCircuitBreaker
      write SetCircuitBreaker;

Default Value

Remarks

When enabled, the circuit breaker monitors failures of calls against https://api.anthropic.com/v1 and, once a configurable threshold is reached, trips to the Open state so that new calls fail fast without hitting the network. After a reset timeout the breaker moves to Half-Open and probes the service; a successful probe closes it again. This is useful to avoid flooding the Anthropic endpoint during outages or rate-limit storms.

Example

oAPI := TsgcHTTP_API_Anthropic.Create(nil);
oAPI.CircuitBreaker.Enabled := True;
oAPI.CircuitBreaker.FailureThreshold := 5;
oAPI.CircuitBreaker.ResetTimeout := 30000;

Back to Properties