Core Features
Circuit Breaker
Automatically stop runaway agents and prevent cascading failures with intelligent circuit breakers.
How It Works
The circuit breaker monitors agent behavior and automatically trips when anomalies are detected, preventing runaway costs, infinite loops, or cascading failures.
Normal operation, requests flow through
Tripped, all requests blocked
Testing recovery, limited requests
Configuration
Circuit breakers are a cloud feature: state is tracked server-side by Tork so that a trip applies across every process sharing the policy. Reach it with @torknetwork/sdk (npm install @torknetwork/sdk, entry class TorkClient) or, from any other language, the REST API directly. This is a different package from the on-device tork-governance family, which decides locally, exports Tork instead, and has no circuit-breaker state to share.
Python note: there is no Python cloud SDK. The Python examples below call the REST API with requests and a Bearer token.
Circuit breakers are keyed by policy name. Inspect current state with a GET:
Trip Triggers
Circuit breakers can trip based on multiple conditions:
Error Rate
Too many consecutive failures or high failure percentage
Latency
Response times consistently exceeding thresholds
Cost Anomaly
Spending rate significantly above baseline
Token Usage
Token consumption exceeding limits
Loop Detection
Repetitive patterns indicating infinite loops
Manual Controls
Force a breaker open, closed, or back to a clean slate with a POST. Opening accepts an optional timeout in seconds:
Webhook Notifications
Receive notifications when circuit breakers change state:
Important: When a circuit breaker trips, all requests to that agent are immediately blocked until manual reset or automatic recovery.