{"uid":"cap_PEYCp4aHn-Kl7eChqRP65","slug":"delx-commerce-circuit-breaker-state-8e31d7e8","name":"Delx Commerce Circuit Breaker State","description":"Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.","url":"https://commerce.delx.ai/api/v1/x402/circuit-breaker-state?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"open_after":{"type":"number","description":"Failures required before the breaker opens."},"cooldown_ms":{"type":"number","description":"Milliseconds the breaker stays open before half-open."},"open_for_ms":{"type":"number","description":"How long the breaker has already been open."},"consecutive_failures":{"type":"number","description":"Current consecutive failure count for the dependency."}}},"responseSchema":{"type":"json","example":{"state":"open","schema":"delx/util-circuit-breaker-state/v1","open_after":5,"cooldown_ms":1000,"open_for_ms":200,"allow_request":false,"consecutive_failures":5}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_mc9N3owpU2mf_P455k-OF","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes the current state (open/half-open/closed) of a circuit breaker given failure counts and timing parameters, returning whether requests should be allowed through.","exampleAgentPrompt":"My payment service has had 5 consecutive failures and the breaker opens after 5 — it's been open for 200ms with a 1000ms cooldown. Should I allow the next request through or is the circuit breaker still open?","exampleUseCases":[{"title":"Blocking requests to a failing dependency","prompt":"My order service has hit 8 consecutive failures and my circuit breaker threshold is 5. The breaker has been open for 300ms and my cooldown is 2000ms. Tell me whether I should block the next request or let it through."},{"title":"Checking half-open retry eligibility","prompt":"My circuit breaker opened after 3 failures and has been open for 5000ms — the cooldown is 3000ms. Is the breaker now in half-open state and can I try a test request?"},{"title":"Validating resilience config in agent workflow","prompt":"Before I route traffic to my inventory service, check the circuit breaker state: 0 consecutive failures so far, breaker opens after 10, cooldown is 500ms, and it hasn't been open at all. Is the circuit closed and safe to send requests?"}],"resultDescription":"Returns a JSON object with the computed circuit breaker state string ('open', 'half-open', or 'closed'), a boolean allow_request indicating whether the caller should proceed, and an echo of the input parameters (open_after, cooldown_ms, open_for_ms, consecutive_failures) along with the schema identifier 'delx/util-circuit-breaker-state/v1'.","failureModes":["Missing or non-numeric input fields may cause a 400 validation error","Negative values for timing or failure counts may produce unexpected state results","Network or payment failure (x402 USDC payment not confirmed) will block the response","If open_for_ms and cooldown_ms are both zero, edge-case state transitions may be ambiguous"],"whenToPreferThis":"Choose this endpoint when an AI agent or automated workflow needs a stateless, pay-per-call circuit breaker state evaluation without running its own state machine. It is ideal for agents that track failure counters externally and need a canonical computation of open/half-open/closed state — especially in multi-agent or serverless environments where maintaining in-process circuit breaker libraries is impractical. Prefer it over self-implemented logic when you want a verifiable, schema-versioned result billed per computation via USDC on Base or Solana.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T00:53:49.060Z","isFirstParty":false,"canonicalSlug":"delx-commerce-circuit-breaker-state-8e31d7e8"}