# Production Implementation Patterns -- Agent Reference

These are enterprise-grade patterns designed for AI agents to implement.
Each file is a complete, production-ready module. Copy, configure, deploy.

## Patterns

| File | What It Does | Key Techniques |
|------|-------------|----------------|
| `production_runtime.py` | Enterprise runtime manager | Circuit breaker, retry, graceful degradation, health checks |
| `secure_client.py` | Security-hardened LLM client | Input sanitization, PII detection, rate limiting, audit logging |
| `resilient_cache.py` | Multi-tier cache with fallback | Tiered circuit breakers, stale-while-revalidate, cache warming |
| `observable_pipeline.py` | Multi-step pipeline with observability | Trace propagation, error budgets, per-step metrics, partial completion |
| `safe_evolution.py` | Evolution with safety bounds | Anomaly detection, rollback triggers, kill switch, bounded exploration |

## Usage

Every file is self-contained and runnable:

```bash
pip install armature-ai
python production_runtime.py
python secure_client.py
python resilient_cache.py
python observable_pipeline.py
python safe_evolution.py
```

No API keys required. All LLM calls are simulated with realistic behavior.

## Design Principles

- **Full type annotations** on all functions and methods
- **Comprehensive docstrings** with Args, Returns, Raises
- **Every exception caught and handled** (no bare except, no silent swallowing)
- **Structured logging** (dict-based, not string formatting)
- **Input validation** at all public method boundaries
- **Constants at module level** for easy configuration
- **Storage-agnostic**: swap backends by changing one line
