Update README.md
Browse files
README.md
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Contextual Engineering Patterns: Architecting Adaptable AI Agents
|
| 2 |
|
| 3 |
[](https://creativecommons.org/licenses/by/4.0/)
|
| 4 |
[]()
|
| 5 |
-
[](https://creativecommons.org/licenses/by/4.0/)
|
| 21 |
[]()
|
| 22 |
+
[](https://africarxiv.ubuntunet.net/items/2af79f5d-ce68-4050-8b25-3bc9128c7232)
|
| 23 |
+
[](https://zenodo.org/records/18005435) > **Reference implementations for the architectural patterns defined in the book *"Contextual Engineering: Architecting Adaptable AI Agents for the Real World"* by Tobi Lekan Adeosun.**
|
| 24 |
|
| 25 |
## π Overview
|
| 26 |
|
|
|
|
| 31 |
2. **Cultural Adapter:** Managing semantic drift and high-context communication.
|
| 32 |
3. **Safety Adapter:** Enforcing constitutional guardrails and Human-in-the-Loop (HITL) workflows.
|
| 33 |
|
| 34 |
+
## β‘ Quick Start (Hybrid Router)
|
| 35 |
+
|
| 36 |
+
How to use the **Infrastructure Adapter** to route traffic based on connectivity:
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from src.infrastructure.inference_router import HybridRouter
|
| 40 |
+
|
| 41 |
+
# Initialize router with cost/latency preferences
|
| 42 |
+
router = HybridRouter(preference="economy", offline_fallback=True)
|
| 43 |
+
|
| 44 |
+
# The router automatically checks network status (N(t))
|
| 45 |
+
model_choice = router.select_model(
|
| 46 |
+
prompt="Summarize this contract",
|
| 47 |
+
complexity_score=0.85
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
print(f"Routing to: {model_choice}")
|
| 51 |
+
# Output: "Llama-3-8B-Local" (if offline) or "GPT-4o" (if online)
|
| 52 |
+
|
| 53 |
## π Repository Structure
|
| 54 |
|
| 55 |
The code is organized by the "Adapter Layer" it serves, matching the chapters of the manuscript.
|
|
|
|
| 65 |
β βββ culture
|
| 66 |
β βββ context_injector.py # (Chapter 6) Dynamic Few-Shot Prompting logic
|
| 67 |
βββ README.md
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
## Citation
|
| 71 |
+
|
| 72 |
+
If you use this framework in your research, please cite the associated whitepaper:
|
| 73 |
+
|
| 74 |
+
```bibtex
|
| 75 |
+
@article{adeosun2026contextual,
|
| 76 |
+
title={Contextual Engineering: Architectural Patterns for Resilient AI Agents},
|
| 77 |
+
author={Adeosun, Tobi},
|
| 78 |
+
journal={AfricArXiv},
|
| 79 |
+
year={2026},
|
| 80 |
+
url={[https://osf.io/preprints/africarxiv/](https://osf.io/preprints/africarxiv/)[YOUR_HANDLE]}
|
| 81 |
+
}
|