Skip to content

Resiliencia

Documentación en español de Resiliencia, alineada con el monorepo y la guía inglesa.

Entrada rápida

typescript
const breaker = new CircuitBreaker({ threshold: 5, cooldownMs: 30000 });
breaker.onSuccess();    // Resets failure count
breaker.onFailure();    // Increments; opens circuit at threshold
breaker.isAvailable();  // false when OPEN
typescript
const chain = new ProviderFallbackChain({
  providers: ['openai', 'anthropic', 'deepseek', 'groq'],
  timeoutMs: 30000,
});

const result = await chain.tryProviders(task);
// Tries OpenAI → Anthropic → DeepSeek → Groq
// Throws FallbackChainExhaustedError if all fail
typescript
const checkpointer = new StateCheckpointer({ basePath: '/data/checkpoints' });
await checkpointer.checkpoint({ runId, phase, stepNumber, messages, tokenUsage });
StateBehavior
CLOSEDNormal operation. Requests pass through.
OPENAfter 5 consecutive failures. All requests are rejected immediately. Cooldown: 30 seconds.
HALF-OPENAfter cooldown. One test request is allowed. Success → CLOSED, failure → OPEN again.
CategoryDescription
llmLLM call failures
toolTool execution failures
executionAgent execution failures
verificationQuality gate failures
circuit_breakerCircuit breaker trips
compensationCompensation failures
semantic_driftSemantic degradation detected

Notas

  • CLI monorepo: cliEntry.ts · tras build: commander
  • Métricas: 25 proveedores · 5 topologías · 18 tools · 6700+ tests
  • Firmas API exactas: monorepo / API overview

Relacionado

MIT — Hecho para orquestación multi-agente.