circuit_breaker.py

circuit_breaker.py is an agent for coding agents from NetMindAI-Open/NarraNexus. It costs 0 tokens per session (303 once invoked), scanned A, original, Apache-2.0.

A pair of web API endpoints for viewing and resetting an agent’s circuit breaker. A circuit breaker is a safety mechanism that pauses an agent after repeated failures; resetting it lets the agent return to active operation.

In plain words
What is it for?
Use the GET endpoint to check breaker status and the POST reset endpoint to clear a pause. The routes are mounted under the agents API and are used by a resume button in the app.
Why use it?
It gives an owner a manual way to resume a paused agent after the underlying problem is resolved. The reset is repeatable, and access is limited to the correct tenant and agent owner.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/netmindai-open/narranexus/circuit_breaker.py
Clone the repo
git clone --depth 1 https://github.com/NetMindAI-Open/NarraNexus

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for circuit_breaker.py

README.md
[![agentmods](https://agentmods.dev/badge/agents/netmindai-open/narranexus/circuit_breaker.py.svg)](https://agentmods.dev/agents/netmindai-open/narranexus/circuit_breaker.py)
Your own site
<a href="https://agentmods.dev/agents/netmindai-open/narranexus/circuit_breaker.py"><img src="https://agentmods.dev/badge/agents/netmindai-open/narranexus/circuit_breaker.py.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 303 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00303
Opus 5 $0.00000 $0.00151
Sonnet 5 $0.00000 $0.00061
Haiku 4.5 $0.00000 $0.00030

Measured 5d ago against content hash b75201ec8b15, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

circuit_breaker.py scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.mindflow/mirror/backend/routes/agents/circuit_breaker.py.md · 25 lines

What it actually says

agents/circuit_breaker.py — 熔断器状态查询 + 手动"恢复"路由

为什么存在

实时层熔断器会在换 key 后自动恢复;这个路由是手动恢复的另一半——owner 的"Resume" 按钮。两个端点:GET /{agent_id}/circuit-breaker(查状态,无行则合成 active)、 POST /{agent_id}/circuit-breaker/reset(清 PAUSE 回 active,幂等)。

上下游关系

挂在 /api/agents 聚合路由下(agents.py include_router)。GET 读 AgentCircuitBreakerRepository;reset 调 agent_circuit_breaker.reset_agent。前端 api.getAgentCircuitBreaker / resetAgentCircuitBreaker 消费,App.tsx 的熔断横幅 "Resume agent" 按钮触发 reset。

设计决策

按 viewer 租户隔离,完全照搬 agents/bus_failures.py:viewer_id 只从 session 取 (?user_id= 直接 400 拒绝),非 owner 一律 404(同时掩盖"无此 agent"与"不是你的")。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 25 lines · 0 tokens per session scan A b75201ec8b15

Subscribe to this mod's changes

circuit_breaker.py is an agent published in the GitHub repository NetMindAI-Open/NarraNexus (86 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 303 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.