Workflow
Circuit-breaker decision API
Decides the next circuit-breaker state (closed/open/half-open) and whether to allow the call given recent success/failure counts, a failure threshold, and cooldown timing. Answers 'Should the circuit open?', 'Can I make this call right now?'.
Price$0.03per request
MethodPOST
Route/v1/workflow/circuit-breaker
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
circuit-breakerresilienceopenhalf-openfailurefault-tolerancedecisionworkflow
API URL
Integration docshttps://x402.hexl.dev/v1/workflow/circuit-breakerExample request
{
"state": "closed",
"failures": 8,
"successes": 2,
"windowSize": 10,
"failureThreshold": 0.5
}Example response
{
"nextState": "open",
"allowRequest": false,
"failureRate": 0.8,
"tripped": true,
"interpretation": "Breaker closed -> open; request blocked (failure rate 80%)."
}Input schema
{
"type": "object",
"required": [
"failures",
"successes",
"windowSize",
"failureThreshold"
],
"properties": {
"state": {
"type": "string",
"enum": [
"closed",
"open",
"half-open"
],
"examples": [
"closed"
]
},
"failures": {
"type": "integer",
"examples": [
8
]
},
"successes": {
"type": "integer",
"examples": [
2
]
},
"windowSize": {
"type": "integer",
"examples": [
10
]
},
"failureThreshold": {
"type": "number",
"description": "Fraction in (0,1] or absolute count >=1",
"examples": [
0.5
]
},
"halfOpenSuccesses": {
"type": "integer"
},
"msSinceOpened": {
"type": "number"
},
"cooldownMs": {
"type": "number"
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}