npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reaatech/circuit-breaker-agents

v0.1.1

Published

Circuit breaker library for agent-to-tool and agent-to-agent communication

Downloads

51

Readme

@reaatech/circuit-breaker-agents

Meta-package for circuit-breaker-agents. Re-exports all public APIs from @reaatech/circuit-breaker-core and @reaatech/circuit-breaker-persistence in a single install.

Feature Overview

  • Single import — one dependency pulls in core circuit breaker logic, all persistence adapters, and leader election
  • Re-exports everythingCircuitBreaker, StateMachine, all strategies, all adapters, all error classes, all types
  • Backward compatible — drop-in replacement for @reaatech/circuit-breaker-core with persistence included
  • No additional dependencies — only depends on @reaatech/circuit-breaker-core and @reaatech/circuit-breaker-persistence

What's Included

This package re-exports every public export from both sub-packages:

From @reaatech/circuit-breaker-core:

  • Classes: CircuitBreaker, StateMachine
  • Errors: CircuitBreakerError, CircuitOpenError, CircuitTimeoutError
  • Strategies: ErrorThresholdStrategy, ConfidenceThresholdStrategy, CostThresholdStrategy, GradualRecoveryStrategy, SingleRecoveryStrategy
  • Metrics: DefaultMetricsCollector, NoOpMetricsCollector
  • Schema: CircuitBreakerStateSchema
  • Types: CircuitBreakerOptions, ExecutionContext, CircuitState, CircuitBreakerState, CircuitBreakerStats, ResultMetadata, CircuitEventType, CircuitEvent, EventHandler, TripStrategy, RecoveryStrategy, MetricsCollector

From @reaatech/circuit-breaker-persistence:

  • Adapters: InMemoryAdapter, FirestoreAdapter, DynamoDBAdapter, RedisAdapter
  • Leader election: LeaderElection, MemoryLeaderElection
  • Types: PersistenceAdapter, HealthStatus, LeadershipResult

Usage

import {
  CircuitBreaker,
  CircuitOpenError,
  InMemoryAdapter,
  FirestoreAdapter,
  DefaultMetricsCollector,
} from '@reaatech/circuit-breaker-agents';

// Core usage — identical to @reaatech/circuit-breaker-core
const breaker = new CircuitBreaker({
  name: 'openai-gpt4',
  failureThreshold: 5,
  recoveryTimeoutMs: 30000,
  persistence: new InMemoryAdapter(),
});

// With persistence adapter
import { Firestore } from '@google-cloud/firestore';

const adapter = new FirestoreAdapter(
  new Firestore({ projectId: 'my-project' }),
  'circuit_breakers'
);
await adapter.connect();

const persisted = new CircuitBreaker({
  name: 'openai-gpt4',
  persistence: adapter,
});

// State survives restarts — loaded lazily on first execute()
const result = await persisted.execute(() => callTool());

Installation

pnpm add @reaatech/circuit-breaker-agents
# or: npm install @reaatech/circuit-breaker-agents

# Optional peer dependencies for persistence:
pnpm add @google-cloud/firestore                  # Firestore
pnpm add @aws-sdk/client-dynamodb @aws-sdk/util-dynamodb  # DynamoDB
pnpm add ioredis                                  # Redis

For Zero-Dependency Footprint

If you only need the core circuit breaker without persistence adapters, install just the core package:

pnpm add @reaatech/circuit-breaker-core

Both packages share the same CircuitBreaker API — the persistence adapter is an optional constructor option.