Networking

15 documents

AI Cost Management

AI API calls cost $0.01-$0.10+ each. Systems MUST treat AI calls as a managed resource with budgets, caching, and fallback strategies.

API Design

Use REST with consistent conventions. Follow the platform API guidelines (Microsoft, Google,

Be strict and maintain: Postel reconsidered (RFC 9413)

Parse protocol and API inputs strictly, reject violations loudly, and actively co-evolve spec and implementation instead of tolerating drift.

Caching

Use HTTP caching headers. The server controls cache policy; the client honors it.

typescriptweb

Error Responses

Use [RFC 9457 Problem Details](https://www.rfc-editor.org/rfc/rfc9457) format with

HTTP conditional requests and optimistic concurrency

Use ETags with If-None-Match for efficient reads and If-Match for optimistic concurrency on writes to prevent lost updates.

Idempotency keys for write APIs

Accept a client-supplied Idempotency-Key on write endpoints so retries are safe, and reject key reuse with different parameters.

MCP server design

Design MCP servers by choosing the right primitive and giving each tool a precise name, output schema, and annotations.

Offline and Connectivity

For apps that must work offline, design for local-first with background sync.

web

Pagination

Prefer **cursor pagination** for most APIs — stable under concurrent mutations, consistent

Rate Limiting

Respect server rate limits. Handle 429 responses gracefully.

Real-Time Communication

Choose the simplest technique that meets your needs.

web

Retry and Resilience

Not every failure is permanent. Retry transient failures with exponential backoff and jitter.

typescriptweb

Timeouts

Always set both connection and read timeouts. Never use infinite timeouts.

Web services

Use Flask for web services. The dashboard service runs on Flask with a REST API and SSE/polling for live updates.

pythonweb