Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_agent-context-engineering-patterns

Context engineering for agents (budget, compaction, prefix caching, loop)

14 COMPONENTS · 18 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[![Context engineering for agents (budget, compaction, prefix caching, loop) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_agent-context-engineering-patterns/opengraph-image)](https://archos.sageideas.dev/d/dgm_agent-context-engineering-patterns)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_agent-context-engineering-patterns)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_agent-context-engineering-patterns" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Context engineering for agents (budget, compaction, prefix caching, loop) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0[("Web Client")]
  alerting_1[("Alerting")]
  session_2[("Session store")]
  vector_3[("Vector database")]
  registry_4[("Prompt and config registry")]
  orch_5[("Agent orchestration runtime")]
  summ_6["Inference server"]
  obj_7[("Object storage")]
  tsdb_8[("Time-series database (TSDB)")]
  infer_9["Inference server"]
  toolgw_10["Function calling"]
  pdp_11["Policy decision point (PDP)"]
  secrets_12[("Secrets manager")]
  capacity_13["Capacity Estimate"]
  client_0 -->|"1. Asks with JWT · HTTPS"| orch_5
  orch_5 -->|"2. Reads, saves turns · HTTP/2"| session_2
  session_2 -->|"3. Returns turns · HTTP/2"| orch_5
  orch_5 -->|"4. Searches memories · HTTP/2"| vector_3
  vector_3 -->|"5. Returns top items · HTTP/2"| orch_5
  orch_5 -->|"6. Prompt, prefix first · HTTP/2"| infer_9
  infer_9 -->|"7. Returns reply · HTTP/2"| orch_5
  orch_5 -->|"8. Calls tool · HTTP/2"| toolgw_10
  toolgw_10 -->|"9. Returns result · HTTP/2"| orch_5
  orch_5 -->|"10. Relays answer · HTTPS"| client_0
  registry_4 -->|"Supplies pinned prefix · HTTP/2"| orch_5
  orch_5 -->|"Summarizes old turns · HTTP/2"| summ_6
  orch_5 -->|"Stores raw result · HTTPS"| obj_7
  toolgw_10 -->|"Asks, fails closed · HTTP/2"| pdp_11
  secrets_12 -->|"Supplies tool keys · HTTPS"| toolgw_10
  orch_5 -->|"Exports (OTLP) · OTLP"| tsdb_8
  infer_9 -->|"Exports (OTLP) · OTLP"| tsdb_8
  tsdb_8 -->|"Feeds Alerting · HTTP"| alerting_1

COMPONENT STACK (13)

  • Web ClientSTATEFUL
    Staff member on an untrusted network
  • AlertingSTATEFUL
    On-call pager outside our boundary
  • Session storeSTATEFUL
    Turns and the summary, 24 hours
  • Vector databaseSTATEFUL
    Memories by embedding, per user
  • Prompt and config registrySTATEFUL
    Pinned prefix: system prompt, tools
  • Agent orchestration runtimeSTATEFUL
    Builds each prompt inside the budget
  • Inference serverSTATELESS
    Small model that summarizes turns
  • Object storageSTATEFUL
    Raw tool results, kept by id
  • Time-series database (TSDB)STATEFUL
    Prompt tokens, cache hits, loops
  • Inference serverSTATELESS
    Main model; reuses a shared prefix
  • Function callingSTATELESS
    Runs only tools the PDP allows
  • Policy decision point (PDP)STATELESS
    Allows tools per user
  • Secrets managerSTATEFUL
    Holds the tool keys

REQUEST & DATA FLOW (18)

  1. Web Client → Agent orchestration runtime (Asks with JWT)[HTTPS]
  2. Agent orchestration runtime → Session store (Reads, saves turns)[HTTP/2]
  3. Session store → Agent orchestration runtime (Returns turns)[HTTP/2]
  4. Agent orchestration runtime → Vector database (Searches memories)[HTTP/2]
  5. Vector database → Agent orchestration runtime (Returns top items)[HTTP/2]
  6. Agent orchestration runtime → Inference server (Prompt, prefix first)[HTTP/2]
  7. Inference server → Agent orchestration runtime (Returns reply)[HTTP/2]
  8. Agent orchestration runtime → Function calling (Calls tool)[HTTP/2]
  9. Function calling → Agent orchestration runtime (Returns result)[HTTP/2]
  10. Agent orchestration runtime → Web Client (Relays answer)[HTTPS]
  11. Prompt and config registry → Agent orchestration runtime (Supplies pinned prefix)[HTTP/2]
  12. Agent orchestration runtime → Inference server (Summarizes old turns)[HTTP/2]
  13. Agent orchestration runtime → Object storage (Stores raw result)[HTTPS]
  14. Function calling → Policy decision point (PDP) (Asks, fails closed)[HTTP/2]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →