Error Codes Beyond the Wrapper: Building Observable and Predictable Failures for AI Agents and Cloud Systems
Originally published on tamiz.pro. Most production failures are not crashes. They are successful HTTP calls that return a generic 500, agent loops that retry a malformed tool argument forever, and cloud jobs that disapp
Originally published on tamiz.pro.
Most production failures are not crashes. They are successful HTTP calls that return a generic 500, agent loops that retry a malformed tool argument forever, and cloud jobs that disappear into a queue with no traceable reason. The wrapper catches the exception; the system still cannot explain what broke.
The fix is not another try/catch block. It is a deliberate failure contract: stable error codes, machine-readable context, correlated telemetry, and explicit policies for retry, fallback, and human intervention. This deep dive shows how to design those contracts for AI agents and distributed cloud systems, and how to make them observable without leaking sensitive data.
- 1. The Failure Contract
- 2. Why Generic Errors Collapse Under Load
- 3. A Taxonomy of Failure Codes
- 4. Designing the Error Envelope
- 5. From Exception to Structured Failure
- 6. AI Agent Failure Semantics
- 7. Cloud and Distributed-System Semantics
- 8. Telemetry That Makes Failures Visible
- 9. Retry, Fallback, and Circuit-Breaker Policies
- 10. Versioning and Governance
- 11. Testing the Failure Contract
- 12. Production Rollout Strategy
- Frequently Asked Questions
1. The Failure Contract
A failure contract is the agreement between a component and everything around it about what can go wrong, how that failure is identified, and what the caller should do next. It has four parts:
-
Identity: a stable, machine-readable code such as
AGENT_TOOL_SCHEMA_INVALID. - Context: structured details describing the failure without exposing secrets.
- Semantics: a category that determines whether the operation is safe to retry.
- Evidence: correlated logs, metrics, and traces that let an engineer reconstruct the event.
This differs from an HTTP status code. HTTP status describes the transport-level outcome of one request. An error code describes a specific domain failure. A request can return HTTP 200 with an application-level error in the response body, or return HTTP 429 while the real cause is a downstream quota. Status codes are part of the contract; they are not the contract.
The same distinction matters for agents. When a model calls a tool with the wrong arguments, the agent framework may raise an exception, return a string, or simply stop. If the framework does not normalize that behavior, every orchestration layer invents its own interpretation. The result is a system where failures are technically visible but operationally meaningless.
A good error code answers three questions in under a second: what failed, was it expected, and what should happen next?
2. Why Generic Errors Collapse Under Load
Generic wrappers usually follow this shape:
try:
result = call_service(payload)
except Exception as exc:
logger.error("Service call failed", exc_info=True)
raise ServiceError(str(exc)) from exc
The code has a serious problem: the original error type and context have been flattened into a string. Downstream, you cannot distinguish a timeout from a validation error without parsing prose. Parsing prose is brittle, expensive, and impossible to do reliably across languages.
The same wrapper also conflates four different decisions:
- Retryability: a network timeout might be transient; a schema error never is.
- Ownership: the caller, the callee, or a third-party provider may need to act.
- Severity: a user-facing validation error and an internal consistency failure are not equivalent.
- Escalation: some failures should page a human immediately; others should only increment a counter.
A distributed system magnifies the problem. One user request might fan out into twenty model calls, six tool invocations, and three queue publishes. Without a shared failure vocabulary, a single root cause produces a storm of unrelated-looking alerts.
3. A Taxonomy of Failure Codes
A practical taxonomy balances specificity with stability. Group codes by domain and keep the prefix stable even when internal implementations change.
| Prefix | Domain | Example | Retryable by default |
|---|---|---|---|
AGENT_ |
Agent runtime and orchestration | AGENT_TOOL_TIMEOUT |
Depends on cause |
MODEL_ |
Model inference and routing | MODEL_CONTEXT_LENGTH_EXCEEDED |
No |
TOOL_ |
External tool execution | TOOL_AUTH_EXPIRED |
No, until refreshed |
VALIDATION_ |
Input and schema checks | VALIDATION_ARGUMENT_MISSING |
No |
RATE_LIMIT_ |
Throttling and quotas | RATE_LIMIT_PROVIDER_QUOTA |
Yes, with backoff |
UPSTREAM_ |
Dependency failures | UPSTREAM_CONNECTION_RESET |
Yes |
STATE_ |
Workflow and resource state | STATE_CHECKPOINT_MISSING |
Usually no |
AUTH_ |
Identity and authorization | AUTH_TOKEN_EXPIRED |
No, until refreshed |
INTERNAL_ |
Unexpected implementation defects | INTERNAL_NULL_REFERENCE |
No |
Each code should map to a documented category, an owner, and a default action. A compact registry in code makes those mappings enforceable:
from dataclasses import dataclass
from enum import Enum
class FailureCategory(str, Enum):
VALIDATION = "validation"
AUTH = "auth"
RATE_LIMIT = "rate_limit"
TRANSIENT = "transient"
DEPENDENCY = "dependency"
STATE = "state"
INTERNAL = "internal"
@dataclass(frozen=True)
class ErrorSpec:
code: str
category: FailureCategory
retryable: bool
description: str
ERROR_SPECS = {
spec.code: spec
for spec in [
ErrorSpec(
code="TOOL_TIMEOUT",
category=FailureCategory.TRANSIENT,
retryable=True,
description="The tool did not respond before the deadline.",
),
ErrorSpec(
code="TOOL_ARGUMENT_INVALID",
category=FailureCategory.VALIDATION,
retryable=False,
description="The tool arguments failed schema validation.",
),
ErrorSpec(
code="TOOL_AUTH_EXPIRED",
category=FailureCategory.AUTH,
retryable=False,
description="The tool credential is missing or expired.",
),
]
}
Two design rules keep this registry useful:
-
Codes describe causes, not symptoms.
MODEL_RATE_LIMITEDis a cause.AGENT_RUN_FAILEDis a symptom. Reserve the latter for the boundary where no more specific cause is known. -
Avoid implementation details in codes.
TOOL_ARGUMENT_INVALIDsurvives a schema library migration.TOOL_ZOD_VALIDATION_ERRORdoes not.
4. Designing the Error Envelope
Use one structured envelope across HTTP APIs, queues, agent tool results, and event streams. The exact field names are less important than consistency.
{
"error": {
"code": "TOOL_ARGUMENT_INVALID",
"category": "validation",
"message": "Tool arguments did not match the required schema.",
"retryable": false,
"retry_after_ms": null,
"details": {
"tool": "lookup_customer",
"invalid_fields": ["customer_id"]
},
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"occurred_at": "2025-03-08T11:42:19.331Z"
}
}
The envelope has a deliberate split between message and details:
-
messageis a short, human-readable summary. It can be shown in a UI or log line. -
detailsis structured and machine-readable. It should never require string parsing.
retry_after_ms is explicit because retry timing is often domain knowledge. A generic exponential backoff can still be wrong when a provider publishes a quota reset time or a queue declares visibility timeout behavior.
Redaction Comes First
Error payloads are frequently copied into logs, traces, and third-party dashboards. Redact before serialization, not after.
import re
from typing import Any
SECRET_KEYS = {
"api_key",
"authorization",
"password",
"access_token",
"refresh_token",
}
SECRET_PATTERNS = [
(re.compile(r"sk-[A-Za-z0-9_-]{12,}"), "[REDACTED_API_KEY]"),
(re.compile(r"Bearer\s+[A-Za-z0-9._-]+"), "Bearer [REDACTED]"),
]
def redact(value: Any) -> Any:
if isinstance(value, dict):
return {
key: "[REDACTED]" if key.lower() in SECRET_KEYS else redact(item)
for key, item in value.items()
}
if isinstance(value, list):
return [redact(item) for item in value]
if isinstance(value, str):
for pattern, replacement in SECRET_PATTERNS:
value = pattern.sub(replacement, value)
return value
return value
Pattern matching is a safety net, not a complete solution. Prefer allowlists for known fields and avoid dumping entire request bodies, prompts, or tool results into error metadata. A prompt may contain personal data even when no obvious secret pattern matches.
5. From Exception to Structured Failure
A typed exception hierarchy preserves the cause while providing a stable external contract.
from typing import Any
class DomainError(Exception):
def __init__(
self,
code: str,
message: str,
*,
details: dict[str, Any] | None = None,
cause: Exception | None = None,
) -> None:
super().__init__(message)
self.code = code
self.message = message
self.details = details or {}
self.__cause__ = cause
@property
def spec(self) -> ErrorSpec:
return ERROR_SPECS[self.code]
def to_envelope(self, trace_id: str) -> dict[str, Any]:
return {
"error": {
"code": self.code,
"category": self.spec.category.value,
"message": self.message,
"retryable": self.spec.retryable,
"retry_after_ms": None,
"details": redact(self.details),
"trace_id": trace_id,
}
}
class ToolError(DomainError):
pass
class ToolTimeout(ToolError):
def __init__(self, tool: str, timeout_ms: int) -> None:
super().__init__(
"TOOL_TIMEOUT",
f"Tool '{tool}' exceeded its deadline.",
details={"tool": tool, "timeout_ms": timeout_ms},
)
class ToolArgumentInvalid(ToolError):
def __init__(self, tool: str, invalid_fields: list[str]) -> None:
super().__init__(
"TOOL_ARGUMENT_INVALID",
"Tool arguments did not match the required schema.",
details={"tool": tool, "invalid_fields": invalid_fields},
)
The important distinction is between the internal exception type and the external error code. Internally, you may want rich exception classes. Externally, callers depend on codes and categories that remain stable across refactors.
Translate at the Boundary
Do not leak framework-specific exceptions to clients or agents. Translate them at the boundary where the component owns the contract.
import time
from typing import Any, Callable, TypeVar
T = TypeVar("T")
def run_tool(
tool: str,
arguments: dict[str, Any],
call: Callable[[dict[str, Any]], T],
*,
timeout_ms: int = 5_000,
) -> T:
try:
return call(arguments)
except TimeoutError as exc:
raise ToolTimeout(tool, timeout_ms) from exc
except ValueError as exc:
raise ToolArgumentInvalid(tool, ["unknown"]) from exc
In a real service, the timeout should be enforced by the transport or runtime rather than by a catch block. A synchronous call that never returns cannot be rescued by except TimeoutError. The example illustrates translation; the deadline itself belongs to the HTTP client, SDK, or executor that can actually cancel the operation.
6. AI Agent Failure Semantics
Agent systems add a layer that ordinary services do not have: the system can attempt to repair its own failure. That is powerful, but it can also hide problems. A malformed tool call that is silently regenerated three times looks like success until the fourth attempt burns the budget and returns a vague summary.
Classify Failures by Who Can Fix Them
For agent workflows, classify failures along three axes:
- Repairable by the model: a tool argument was omitted, a structured output failed parsing, or a search returned no useful result.
- Repairable by the runtime: a credential was refreshed, a quota window reset, or a transient dependency recovered.
- Not repairable automatically: a policy denial, invalid customer state, exhausted budget, or internal defect.
A practical agent tool result should expose this explicitly:
{
"ok": false,
"error": {
"code": "TOOL_ARGUMENT_INVALID",
"category": "validation",
"message": "Required field 'customer_id' is missing.",
"retryable": false,
"repair_hint": "Provide customer_id as a string matching the customer identifier format.",
"details": {
"tool": "lookup_customer",
"invalid_fields": ["customer_id"]
}
}
}
repair_hint is not the same as message. It tells the model what correction to attempt. Keep it short, schema-aligned, and free of implementation details. For example, ask for a valid ISO 8601 timestamp rather than revealing that the parser uses a particular library.
Bound Self-Repair
Self-correction needs strict budgets. Track attempts separately from retries:
@dataclass
class RepairBudget:
max_repairs: int = 2
max_repairs_per_code: dict[str, int] | None = None
def allows(self, code: str, attempts: int) -> bool:
if attempts >= self.max_repairs:
return False
per_code = (self.max_repairs_per_code or {}).get(code, self.max_repairs)
return attempts < per_code
Rules that matter in production:
- Never retry a non-retryable code with the same inputs.
- Change the inputs when asking a model to repair a validation failure.
- Count model repairs and dependency retries against separate budgets.
- Stop when the repair loop begins producing identical inputs.
- Surface the last underlying error code, not a synthetic
AGENT_RUN_FAILED.
Preserve the Decision Trail
An agent run is a sequence of decisions. For debugging, record the ordered sequence of tool calls, their codes, latency, attempt counts, and token costs. Do not record full prompts or raw tool payloads by default. Store references to those, with explicit retention and access controls.
This gives you a compact decision trace:
{
"run_id": "run_8f31a",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"steps": [
{"step": 1, "tool": "search_catalog", "code": "OK", "latency_ms": 412},
{"step": 2, "tool": "lookup_customer", "code": "TOOL_ARGUMENT_INVALID", "attempt": 1},
{"step": 3, "tool": "lookup_customer", "code": "OK", "latency_ms": 188}
]
}
Without this structure, reconstructing an agent failure often means reading a wall of unstructured logs and guessing which model output caused which side effect.
7. Cloud and Distributed-System Semantics
Cloud systems fail in ways that are often partial, delayed, or duplicated. A request can time out while the remote operation succeeds. A message can be delivered twice. A lease can expire while a worker is still processing the job.
These are not edge cases to hide. They are part of the operating environment, and the error contract should express them.
Distinguish Timeout from Failure
A timeout means the caller stopped waiting. It does not prove the operation failed. For non-idempotent operations, surface that distinction:
{
"error": {
"code": "PAYMENT_SUBMISSION_UNKNOWN",
"category": "state",
"message": "The payment provider did not respond before the deadline.",
"retryable": false,
"details": {
"operation": "submit_payment",
"idempotency_key": "pay_9d2c1",
"resolution_required": "query_payment_status"
}
}
}
The correct next step is a status query, not an immediate resubmission. Blind retries of payment, provisioning, or messaging operations can create duplicates.
Model Duplicate Delivery Explicitly
At-least-once queues are the norm. If the consumer cannot tolerate duplicates, make deduplication part of the operation contract:
async def handle_job(job: dict, store: JobStore) -> None:
message_id = job["message_id"]
if await store.was_completed(message_id):
return
result = await process(job)
await store.mark_completed(message_id, result)
For stronger guarantees, use the store's atomic compare-and-set operation or a transactional inbox. The important part is that the system has a documented delivery assumption, and the error codes reflect it.
Represent Resource State
Cloud APIs often fail because a resource is in an unexpected state: a deployment is still rolling out, a bucket policy prevents access, a database is read-only, or a lease has been lost. These are state failures, not generic internal errors.
| Situation | Suggested code | Correct response |
|---|---|---|
| Resource still initializing | STATE_RESOURCE_NOT_READY |
Poll with backoff |
| Deployment partially failed | STATE_DEPLOYMENT_ROLLED_BACK |
Inspect revision and redeploy |
| Write rejected by read-only mode | STATE_RESOURCE_READ_ONLY |
Route to standby or fail over |
| Lease lost during processing | STATE_LEASE_LOST |
Re-claim and re-check idempotency |
| Access denied by policy | AUTH_POLICY_DENIED |
Do not retry; request policy change |
This vocabulary lets orchestration systems distinguish "wait," "route elsewhere," and "stop."
8. Telemetry That Makes Failures Visible
An error code without telemetry is a label. An error code with telemetry is an operational signal.
Use Three Signals Together
Logs explain the specific event. Include the code, trace ID, request or run ID, attempt number, and relevant non-sensitive context.
Metrics reveal frequency and impact. Count errors by code, but avoid unbounded label cardinality. Never use customer IDs, request IDs, or raw URLs as metric labels.
service_requests_total{service="orders",outcome="error",code="TOOL_TIMEOUT"} 42
service_requests_total{service="orders",outcome="error",code="TOOL_ARGUMENT_INVALID"} 17
Traces reconstruct causality across services. Propagate W3C trace context and attach the error code as a span attribute or status detail.
from opentelemetry import trace
span = trace.get_current_span()
span.set_attribute("error.code", error.code)
span.set_attribute("error.category", error.spec.category.value)
span.set_attribute("error.retryable", error.spec.retryable)
span.record_exception(error)
Record exceptions when a failure is unexpected or when the stack trace is needed for diagnosis. For expected domain failures, recording every exception can be expensive and can bury real defects in noise.
Add SLO-Significant Indicators
Not every error deserves equal attention. Define error budgets around user-visible outcomes:
agent_successful_completion_ratio{journey="support_resolution"}
checkout_error_ratio{provider="primary"}
queue_lag_seconds{queue="invoice-processing"}
tool_timeout_ratio{tool="search_catalog"}
A TOOL_ARGUMENT_INVALID spike may indicate a prompt regression. A TOOL_TIMEOUT spike may indicate a dependency incident. A STATE_RESOURCE_NOT_READY spike may be normal during a deployment. The code taxonomy lets you distinguish these without parsing log text.
Correlate Without Sprawling
Use a small set of identifiers:
-
trace_idfor end-to-end causality. -
request_idorrun_idfor a logical operation. -
attemptfor retry and repair loops. -
codefor the domain failure.
Do not invent a new identifier for every layer. Propagation should be boring: the same trace context follows the request, queue message, and tool invocation.
9. Retry, Fallback, and Circuit-Breaker Policies
Retry decisions belong to the caller because only the caller knows the operation's idempotency and business impact. The error contract supplies the evidence.
Retry Only When It Is Safe
Retry when all of the following are true:
- The error is classified as transient.
- The operation is idempotent, or it has an idempotency key.
- The caller has not exhausted its retry budget.
- The failure is not caused by a policy or validation rule.
Use jittered exponential backoff, and respect explicit retry_after_ms values:
import random
def compute_delay(attempt: int, base_ms: int = 200, cap_ms: int = 30_000) -> int:
exponential = min(cap_ms, base_ms * (2 ** attempt))
return random.randint(0, exponential)
Full jitter avoids synchronized retry waves when many workers fail against the same dependency at the same moment.
Distinguish Retry From Fallback
A fallback is a different operation, not another retry. Moving from a primary model to a backup model can change cost, latency, and output quality. Moving from a primary payment provider to a backup provider can change compliance behavior.
from dataclasses import dataclass
@dataclass(frozen=True)
class Route:
name: str
supports_idempotency: bool
degraded: bool = False
def choose_route(
error: DomainError,
routes: list[Route],
current: str,
) -> Route | None:
if error.spec.category not in {FailureCategory.TRANSIENT, FailureCategory.RATE_LIMIT}:
return None
for route in routes:
if route.name != current and not route.degraded:
return route
return None
Emit a distinct code when a fallback succeeds, such as ROUTE_FALLBACK_ACTIVATED. Otherwise, dashboards show only the successful response and hide a growing dependency problem.
Circuit Breakers Need Domain-Aware States
A circuit breaker should open for dependency failures that indicate systemic unavailability, not for every error. A malformed request should not trip the breaker for the whole service. Conversely, a provider returning 200 with invalid payloads may still warrant opening the circuit.
Track at least:
- Consecutive or rolling-window failure ratios by dependency.
- Minimum request volume before the breaker can trip.
- Half-open probe requests.
- The code distribution that caused the state change.
10. Versioning and Governance
Error codes are API. Treat them with the same discipline as endpoints and schemas.
Use Additive Changes
Safe changes:
- Adding a new code.
- Adding optional detail fields.
- Adding a new category while preserving old code behavior.
- Improving a human-readable message.
Breaking changes:
- Changing the meaning of an existing code.
- Changing a code from retryable to non-retryable without a new version.
- Removing fields that clients depend on.
- Renaming a code that agents or external integrations may branch on.
If a semantic change is unavoidable, introduce a new code and deprecate the old one with a clear migration window.
Keep a Machine-Readable Registry
Publish a registry containing the code, category, retryability, description, owner, and deprecation status. Generate documentation and test fixtures from it so the registry cannot drift from implementation.
code: TOOL_ARGUMENT_INVALID
category: validation
retryable: false
owner: agent-platform
description: Tool arguments failed schema validation.
introduced: "2025-03-01"
deprecated: null
Ownership matters. During an incident, the question is usually "who can fix this?" A registry that maps codes to teams shortens that path.
Watch for Code Explosion
Specificity has a cost. If every field, provider, and edge case gets a unique code, the taxonomy becomes unmaintainable. A good rule is: create a new code when the failure requires a different operational response. Otherwise, use a structured detail field.
{
"code": "TOOL_ARGUMENT_INVALID",
"details": {
"tool": "lookup_customer",
"provider": "internal-crm",
"invalid_fields": ["customer_id"]
}
}
One code plus structured context is usually better than TOOL_LOOKUP_CUSTOMER_INVALID_CUSTOMER_ID.
11. Testing the Failure Contract
Failure paths deserve the same rigor as success paths. Test the code, category, retryability, redaction, and telemetry attributes.
import pytest
def test_tool_argument_invalid_envelope() -> None:
error = ToolArgumentInvalid("lookup_customer", ["customer_id"])
envelope = error.to_envelope("trace-123")["error"]
assert envelope["code"] == "TOOL_ARGUMENT_INVALID"
assert envelope["category"] == "validation"
assert envelope["retryable"] is False
assert envelope["details"]["invalid_fields"] == ["customer_id"]
def test_secrets_are_redacted() -> None:
error = DomainError(
"INTERNAL_TEST",
"Request failed",
details={
"authorization": "Bearer super-secret-token",
"message": "key sk-abcdefghijklmnopqrstuvwxyz123456",
},
)
details = error.to_envelope("trace-123")["error"]["details"]
assert details["authorization"] == "[REDACTED]"
assert "super-secret-token" not in details["message"]
assert "sk-abcdefghijklmnopqrstuvwxyz123456" not in details["message"]
Add contract tests at API boundaries. If an agent consumes a tool schema, assert that the tool's error result still validates against its published output schema.
For distributed systems, test the ambiguous cases explicitly:
- The remote operation succeeds but the response times out.
- The queue delivers the same message twice.
- The worker loses its lease mid-processing.
- A dependency returns a rate limit with a retry hint.
- A provider returns
200with an invalid body. - A credential expires between validation and execution.
Use a fault-injection proxy or a fake provider that can deterministically produce these conditions. Testing only the happy path and obvious exceptions leaves the hardest failure modes uncovered.
12. Production Rollout Strategy
You do not need to replace every error message in one release. A staged rollout reduces risk and makes the migration observable.
Phase 1: Inventory
List every boundary where failures cross a process, agent, queue, or API. Record current status codes, exception types, and log messages. Identify the five most frequent production failures by impact.
Phase 2: Establish the Registry
Define categories, naming rules, and ownership. Pick a small set of high-value codes for the first migration. Do not attempt perfect taxonomy coverage on day one.
Phase 3: Normalize Boundaries
Introduce the error envelope and translation layer. Keep internal exceptions rich, but emit stable codes at the edges. Add trace correlation and redaction first; they provide immediate value even before the taxonomy is complete.
Phase 4: Add Telemetry
Emit metrics and structured log fields by code. Create dashboards for top failure classes. Establish alerts on user-visible error ratios and sustained dependency failures, not on raw exception counts.
Phase 5: Encode Policies
Move retry, fallback, and circuit-breaker decisions to use categories rather than message matching. Add repair budgets for agent self-correction loops.
Phase 6: Govern
Require new error codes to be registered, reviewed, and tested. Add deprecation checks to CI. Review code distributions during incident response to find missing categories or incorrect classifications.
The result is a system where an operator can answer, βWhat failed? How often? Which dependency is responsible? Is retry safe? What changed?β without reading source code or guessing from prose.
For broader platform design practices, the Tamiz Insights collection covers architectural patterns that complement structured failure handling, including tracing, resilience, and service boundaries.
Frequently Asked Questions
Should error codes be HTTP status codes?
No. HTTP status codes describe the protocol-level outcome of a request; error codes describe domain-specific causes. Map domain codes to appropriate HTTP statuses at the API boundary, but let internal callers depend on the richer code and category. A single HTTP status can represent many retry policies, and a domain failure can occur inside a 200 response body.
How granular should error codes be?
Granular enough that each code implies a different operational response. If two failures always require the same action, keep one code and expose differences through structured details. If the same code mixes a validation error with a timeout, callers cannot make safe retry decisions.
How do I debug agent failures without logging sensitive prompts?
Record a structured decision trail: tool names, error codes, attempt counts, latency, token usage, and trace IDs. Store full prompts or tool payloads behind explicit access controls and retention policies, and reference them from the trace when deeper inspection is required. Redact known secret fields and avoid unrestricted payload dumps.
When should an agent retry or self-repair a failure?
Retry a transient dependency failure with jittered backoff when the operation is idempotent. Let the model repair validation or structured-output failures only when new information or corrected arguments are possible, and enforce a small repair budget. Never retry policy denials, expired credentials, or invalid business state without first changing the underlying condition.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.