Logo Service Resilience

Service Resilience

Cộng đồng
d-padmanabhan
service-resilience

Designs and reviews production resilience for service dependencies using deadlines, timeouts, bounded retries, circuit breakers, bulkheads, backpressure, load shedding, rate limits, fallbacks, idempotency, and recovery testing. Use when the user mentions circuit breaker, bulkhead, retries, cascading failure, partial failure, overload, graceful degradation, or resilient distributed services.

Tổng quan

Nhà phát hànhd-padmanabhan
Kho mãagent-engineering-handbook
Tên kỹ năngservice-resilience
Sao
20
Bản fork
3
Tệp đi kèm
3
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được d-padmanabhan công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Service Resilience trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/service-resilience
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook.git /tmp/agent-engineering-handbook
mkdir -p .claude/skills
cp -r /tmp/agent-engineering-handbook/skills/service-resilience .claude/skills/service-resilience
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Service Resilience trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Service Resilience ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Service Resilience với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Service Resilience

Design resilience as a bounded failure policy, not a collection of decorators. Every mechanism must protect a stated critical journey without creating retry storms, stale success, hidden data loss, or fragmented capacity.

Resilience Contract

  • Begin with critical journeys, SLOs, dependency budgets, and acceptable degraded outcomes.
  • Put one end-to-end deadline around the operation. Allocate smaller attempt timeouts within it.
  • Retry only classified transient failures for idempotent operations or operations protected by stable idempotency keys.
  • Bound attempts, elapsed time, concurrency, queues, memory, and retry amplification.
  • Isolate unrelated workloads with bulkheads sized from capacity and priority.
  • Shed excess work before saturation destroys useful throughput.
  • Use circuit breakers only when rejecting likely failures is cheaper and safer than attempting them.
  • Treat fallbacks as alternate correctness contracts. Never return stale or fabricated success silently.
  • Make ambiguous mutation outcomes reconcilable.
  • Test failure, overload, recovery, and control-plane behavior with measurable acceptance criteria.

Design Workflow

1. Define the critical journey

State:

  • caller and business outcome;
  • availability and latency SLO;
  • synchronous dependencies;
  • consistency and freshness requirements;
  • acceptable partial or degraded result;
  • operations that must fail closed;
  • recovery owner and escalation path.

Do not apply one resilience policy to every endpoint or workload.

2. Allocate time and failure budgets

For each synchronous dependency, define:

  • end-to-end deadline contribution;
  • connect, request, and response timeout;
  • retry owner and maximum attempts;
  • transient failure classification;
  • idempotency or reconciliation contract;
  • concurrency and queue budget;
  • fallback or explicit failure behavior.

Account for DNS, connection pools, proxies, SDK retries, service meshes, and gateways. Hidden retries consume the same caller deadline and multiply load.

3. Control load

Apply controls in this order:

  1. admission priority and per-principal quotas;
  2. bounded queues with maximum age;
  3. bounded concurrency and connection pools;
  4. backpressure or producer throttling;
  5. load shedding with explicit retry guidance;
  6. capacity scaling where it is fast enough to matter.

Do not rely on autoscaling after queues, memory, or downstream capacity are already exhausted.

4. Isolate failure

Choose bulkheads around workloads that should not consume one another's capacity:

  • dependency-specific connection pools;
  • workload-specific worker pools or semaphores;
  • priority queues;
  • tenant or customer partitions;
  • cells or deployment stamps;
  • separate resource quotas.

Document reserved capacity, utilization trade-offs, fairness, and what happens when one partition is full.

Use the circuit breaker and bulkhead reference (${HANDBOOK_ROOT}/skills/service-resilience/references/circuit-breakers-and-bulkheads.md) for detailed state and sizing rules.

5. Limit repeated failure

Use a circuit breaker only when:

  • failures are expensive enough to threaten caller or dependency capacity;
  • recent outcomes predict near-term failure;
  • calls can be rejected safely;
  • recovery can be probed with bounded traffic;
  • state scope and observability are defined.

A breaker does not replace timeouts, retries, admission control, or health checks. Avoid a global breaker when one tenant, endpoint, shard, region, or operation can fail independently.

6. Define degraded behavior

For every fallback, specify:

  • trigger;
  • data source and maximum staleness;
  • authorization and privacy equivalence;
  • user-visible indication;
  • unsupported operations;
  • cache invalidation or recovery;
  • metric proving whether the fallback helps.

Prefer explicit unavailability over plausible but incorrect data.

7. Verify recovery

Test:

  • timeout and cancellation propagation;
  • retry amplification at each layer;
  • breaker opening, probing, and closing;
  • bulkhead exhaustion and unaffected workloads;
  • queue age and shedding;
  • dependency brownouts and slow responses;
  • recovery without synchronized request floods;
  • regional, quota, identity, DNS, and configuration failures;
  • reconciliation after ambiguous writes.

Use the failure policy reference (${HANDBOOK_ROOT}/skills/service-resilience/references/failure-policy-and-testing.md) for review and experiment design.

Pattern Selection

ProblemPrimary controlImportant companion
Slow dependencyDeadline and attempt timeoutCancellation and bounded concurrency
Brief transient failureBounded jittered retryIdempotency and retry budget
Sustained likely failureCircuit breakerTimeout, observability, recovery probe
One workload starves anotherBulkheadPriority, quotas, capacity plan
Offered load exceeds capacityAdmission control and sheddingBackpressure and retry guidance
Optional dependency unavailableExplicit fallbackFreshness and correctness contract
Mutation timed outReconciliationStable operation ID or idempotency key
Long asynchronous backlogQueue-age limitsConsumer scaling, DLQ, replay policy

Anti-Patterns

  • Retrying every exception at every layer.
  • Retrying non-idempotent mutations with a new request ID.
  • Circuit breaker keyed globally across unrelated tenants or operations.
  • Opening a breaker on caller validation or authorization failures.
  • Half-open mode releasing an unbounded probe flood.
  • Bulkheads with arbitrary sizes and no capacity or fairness model.
  • Unbounded queues presented as reliability.
  • Fallbacks that bypass authorization or return stale data as current.
  • Health checks that call every dependency and cause synchronized failure.
  • Catching errors and returning success to improve availability metrics.
  • Chaos tests without hypotheses, blast-radius controls, or abort conditions.

Required Output

Produce:

  1. Critical journey, SLO, and dependency map
  2. End-to-end deadline and retry budget
  3. Failure classification and idempotency contract
  4. Admission, concurrency, queue, and bulkhead policy
  5. Circuit breaker scope and state policy where justified
  6. Degraded behavior and correctness limits
  7. Metrics, alerts, and recovery ownership
  8. Failure experiments, acceptance criteria, and rollback triggers

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Service Resilience làm được gì?

Designs and reviews production resilience for service dependencies using deadlines, timeouts, bounded retries, circuit breakers, bulkheads, backpressure, load shedding, rate limits, fallbacks, idempotency, and recovery testing. Use when the user mentions circuit breaker, bulkhead, retries, cascading failure, partial failure, overload, graceful degradation, or resilient distributed services.

Vì sao nên dùng Service Resilience trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Service Resilience là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Service Resilience trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/service-resilience. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Service Resilience?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Service Resilience với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Service Resilience với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Service Resilience có miễn phí không?

Có. Kỹ năng này được d-padmanabhan phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇