← Jeff Amels

Architecture specification

A standardized pattern for production agentic AI — and the parts of it that turned out to be wrong

How a fleet of Model Context Protocol servers was built so that the next one is configuration rather than a project.

Most agentic AI writing describes what a system does when it works. The decisions worth reading are the ones made where it does not: what happens when retrieval returns nothing useful, when the model is confident and incorrect, when a source is stale, when a run has to be reproduced eighteen months later for someone who was not there.

01 — THE PATTERN

One server shape, not many integrations

Each server exposes a corpus as agent-callable tools — pricing, licensing, architecture, meeting intelligence, and a biomedical evidence layer bridging curated public sources (PubMed, ClinicalTrials.gov, ClinVar, OncoKB) to cloud-hosted services. They share one published pattern: identity, secret handling, retrieval, extraction, evaluation and telemetry are structural, not per-server decisions.

The test of a platform is not the first instance. It is whether the nth instance costs a day or a quarter. A dozen servers written a dozen ways is a dozen maintenance burdens wearing a trench coat.

A dual-surface API follows from the same reasoning: REST for system integration, MCP for direct agent consumption. Machine consumers are a first-class architectural audience, and pretending otherwise means an agent scraping an interface designed for a browser.

02 — RETRIEVAL

Fuse by rank, never by score

Retrieval is hybrid — dense vectors and full-text, combined with Reciprocal Rank Fusion and authority-tier boosting. Chunking is structure-aware: a table split down its middle is worse than no table.

The fusion decision is the one that took two attempts to get right. Different query framings have different mean similarity to a corpus and different spread. Fusing raw cosine elects whichever framing sits highest in the space; fusing z-scores elects whichever has the tightest distribution. Neither elects the best match. RRF uses only a document's rank within each query, so no distributional property of a framing can dominate, and agreement across framings is rewarded — the right prior when framings describe facets of the same need.

Vector indexes are pgvector with HNSW and DiskANN, on benchmarked recall rather than assumed recall. HNSW defaults to ef_search = 40, which is a hard ceiling on rows returned regardless of the LIMIT requested. Nothing errors. The query succeeds, returns genuinely nearest rows, and every count downstream is quietly wrong.

03 — GUARDRAILS

The model is a pipeline stage, never a source of truth

Architectural guardrails rather than library defaults:

  • Deterministic joins execute first. The model receives resolved facts and emits assertions about them. It is not asked to remember, look up, or do arithmetic.
  • Source validation refuses to emit a value it cannot verify. It preserves the raw evidence instead of producing a plausible but wrong figure. An empty field with its source attached is worth more than a confident number.
  • Typed decision objects carry prerequisites, conflicts and stated assumptions, so a recommendation traces to the constraint that produced it.
  • Cross-validation before assertion. In the coordination graph, extracted decisions require two independent sources before they are recorded — 25,000+ verbatim source turns yielded 842 decisions, and the ratio is the point.
This is the control posture regulated model-risk functions require, and it is cheaper to build in than to retrofit. Provenance added after the fact is documentation. Provenance in the schema is enforcement.
04 — EVALUATION

Measured, not asserted

A four-axis LLM-as-judge harness scores correctness, authority, evidence and defensibility across a versioned question suite. The scoreboard is tracked over time and — the part that matters — separates engine defect from source coverage gap. A system that cannot tell "we answered badly" from "we do not hold the answer" will optimize the wrong half.

Telemetry is Log Analytics across the deployed fleet. Every model-derived record carries the prompt version and model id that produced it, so an extraction run is diffable rather than silently replaced.

05 — LIFECYCLE

Rebuildable, or it is not reproducible

  • Immutable source layer. Raw records are written once; derived fields hang off them keyed to a content hash. Full rebuild is exercised repeatedly, not assumed.
  • Embedding model and dimension pinned in configuration, with a defined re-embed migration path. Mixed vector generations are not comparable and nothing in a schema stops you mixing them.
  • Human confirmations persist across rebuilds. Cross-tenant entity resolution that discards a person's corrections on every rebuild will not be used twice.
  • Scheduled re-ingest aligned to upstream source release cadence, rather than a cron chosen for tidiness.
06 — COST AS AN ARCHITECTURAL CONSTRAINT

Rate versus usage, applied to inference

Tiered model selection with documented cost and rate-limit rationale: a smaller model as the extraction default, with a defined escalation path. Forced tool-use for schema-valid structured output, because a retry on malformed JSON is a bill as well as a latency.

The same rate-versus-usage discipline that built a FOCUS-schema catalog across AWS, Azure and GCP at multi-million-row scale applies to token spend, inference efficiency and platform TCO. Cost is a design constraint that belongs beside latency and reliability — not a reconciliation exercise after the invoice.

07 — WHAT THIS DOES NOT DO

The limits, stated rather than discovered

It is not a model-training platform. There is no fine-tuning, no custom model work, no serving infrastructure of its own. It composes hosted models and is opinionated about everything around them.

The evaluation harness measures answer quality, not task success. It scores whether a response is correct, sourced and defensible — not whether the human went on to make a better decision. That gap is real and is not closed by a rubric.

Retrieval is only as good as the corpus. The scoreboard exists to make coverage gaps visible precisely because no amount of ranking work fixes a source that was never ingested.

The models are new. The discipline is not. Everything above — provenance in the schema, evaluation that separates a bad answer from a missing source, cost as a design constraint — came from three decades of shipping systems that had to keep working after I left the room.