loaditout.ai
SkillsPacksTrendingLeaderboardAPI DocsBlogSubmitRequestsCompareAgentsXPrivacyDisclaimer
{}loaditout.ai
Skills & MCPPacksBlog

agent-circuit

MCP Tool

crithstudio-hash/agent-circuit

When tools fail, your agent degrades gracefully instead of looping.

Install

$ npx loaditout add crithstudio-hash/agent-circuit

Platform-specific configuration:

.claude/settings.json
{
  "mcpServers": {
    "agent-circuit": {
      "command": "npx",
      "args": [
        "-y",
        "agent-circuit"
      ]
    }
  }
}

Add the config above to .claude/settings.json under the mcpServers key.

About

agent-circuit

When tools fail, your agent degrades gracefully instead of looping.

Stop agent tool loops, enforce cost caps, and degrade gracefully. One decorator. Zero dependencies. Works with Claude Code, MCP, OpenAI Agents SDK, LangChain, and CrewAI.

The Problem

Your agent calls a failing API. It retries 47 times. That burns $12, wastes 90 seconds, and your user stares at a spinner.

The Fix
from agent_circuit import CircuitBreaker, CircuitDegraded

breaker = CircuitBreaker(max_failures=3, cost_global_limit=5.0)

@breaker.protect("search_api", cost_per_call=0.26)
def search(query: str) -> str:
    return api.search(query)

try:
    result = search("latest news")
except CircuitDegraded as e:
    print(e.result.message)     # "Search API unavailable"
    print(e.result.suggestion)  # "Skip and proceed with available info"

Result: 48 calls reduced to 4. $11.70 saved. 85 seconds saved.

Install
pip install agent-circuit
Demo
python -m agent_circuit demo

No API keys needed. Shows before/after comparison with simulated failures.

Framework Integrations
Claude Code

One command setup. Protects all tool calls automatically:

agent-circuit install-hook

This adds PreToolUse and PostToolUse hooks to .claude/settings.local.json. Restart Claude Code to activate.

Check status:

agent-circuit status
MCP (works with Claude Code, Cursor, Windsurf)

Add circuit breaking to any MCP server:

from fastmcp import FastMCP
from agent_circuit.integrations.mcp import AgentCircuitMiddleware

mcp = FastMCP("my-server")
mcp.add_middleware(AgentCircuitMiddleware(max_failures=3))

@mcp.tool()
def search(query: str) -> str:
    return api.search(query)

Install: pip install agent-circuit[mcp]

OpenAI Agents SDK
from agents import Agent
from agent_circuit.integrations.openai_agents import protect_tools

agent = Agent(
    name="my-agent",
    tools=prot

Tags

agentcircuit-breakerclaude-codelangchainllmmcpopenaipythonresiliencetool-calls

Reviews

Loading reviews...

Quality Signals

0
Installs
Last updated23 days ago
Security: AREADME

Safety

Risk Levelmedium
Data Access
read
Network Accessnone

Details

Sourcegithub-crawl
Last commit3/23/2026
View on GitHub→

Embed Badge

[![Loaditout](https://loaditout.ai/api/badge/crithstudio-hash/agent-circuit)](https://loaditout.ai/skills/crithstudio-hash/agent-circuit)