Deep dive · L4

Agent Runtimes & AI Systems

Memory lifecycles, permitted tool execution and evaluation gates for production agents — backed by AI product work since 2017.

The role

I take agentic workflows from idea to production: defining what each agent may do, the tools it can call through MCP, the evaluation gates it must pass, and the cost and latency budget it runs within.

Agent memory & runtime boundaries

  • Separate conversation history and execution state from episodic, semantic and procedural memory
  • Filter reads by tenant, account and source permissions before context assembly
  • Bound context by relevance and recency; keep tool actions behind explicit MCP permissions
  • Measure grounding, memory recall, tool errors and cost–latency budgets before rollout

Case studies

Three initiatives, three failures, three lessons

Architecture log · AI & runtime design

The constraints behind the product

How I weigh agent memory, inference cost and where work should run.

ADR 01 · Published memory design

Context pruning vs. full-context RAG

Context cost, retrieval relevance and response latency.

Decision rationale
Assemble a bounded context: procedural rules, account facts, relevant episodes and live session state. Retrieve what the current task needs rather than dumping every vector match into the prompt.
Trade-off
Pruning reduces token work but can omit useful context. Test recall and answer grounding before tightening the budget.
Read the memory architecture

ADR 02 · Published caching design

Exact vs. semantic cache boundary

Inference economics, answer correctness and tenant isolation.

Decision rationale
Check exact matches first, then scoped similarity and verification. Apply permissions before lookup; bypass actions and live account data, and invalidate answers when their sources change.
Trade-off
Higher similarity thresholds protect precision but reduce hits. Verification has its own cost; cache savings only count after embeddings, storage and quality regressions are included.
Read the caching essay

ADR 03 · MRes research

Edge scheduling vs. centralized compute

Bandwidth variability, execution scheduling and end-to-end latency.

Decision rationale
Research bandwidth prediction and real-time dynamic task scheduling to decide where work should execute between edge and cloud.
Trade-off
Local processing can reduce network waits but competes for client resources; centralized execution concentrates capacity but adds network dependency.
Read the research evidence

Shipped in production

  • AI digital worker for refunds and chargebacks (Prodaptix): policy validation, ledger payout, CRM logging
  • Fraud ML: -30% fraud losses
  • Recommendation engines: +8% average order value
  • GCP streaming pipelines feeding live ML models
  • MCP for secure tool orchestration
  • Evaluation harnesses
  • Enterprise RAG patterns
  • Agentic workflows

Fig. 01 — Reference Architecture

AI Platform Stack

The layered system I design, evaluate, and lead across: from infrastructure and data foundations through orchestration to the applications customers actually use.

A1

AI Applications

LLM ApplicationsAI AgentsIntelligent Workflows
A2

AI Orchestration

RAGAgent WorkflowsMCPContext Engineering
A3

Platform Layer

APIsDeveloper PlatformsSDKsIntegrations
A4

Infrastructure Layer

KubernetesDockerCloud ArchitectureDistributed Systems
A5

Data Layer

ML PipelinesAnalyticsObservability

A1–A5 describe the layers inside an AI system. L1–L4 describe the layers of the wider platform.

Applied AI in production

Three AI initiatives, three generations of the technology: classical ML, ML on money, and agentic LLM systems. Each started with an unclear brief, each failed somewhere before it worked, and each taught me the same thing from a different angle.

Fig. 02 — Data foundations

The data comes before the model

Every AI system I've shipped started with deciding what to collect, how to label it and how to prove impact. Models change; the data design is what makes them measurable.

  1. 01 · Collect

    25+ tracked events across kiosk, tablet, mobile and web: browse, search, item clicks and adds, recommendation clicks, adds and removals, checkout, payment.

  2. 02 · Tag

    Every recommendation tagged model-driven or rule-based, with its API response ID, list position, anchor item and group size.

  3. 03 · Validate

    Event-by-event QA before any data feeds training or reporting.

  4. 04 · Stream & join

    Streaming pipeline on GCP; behavioural events joined to transaction records for revenue ground truth.

  5. 05 · Train & evaluate

    Time-split offline evaluation, then live holdout tests for incremental lift.

  6. 06 · Serve

    Sub-second recommendation API with live availability filtering and fallbacks.

Clicks, adds and removals become the next round of labels.

No model ships without an evaluation gate, a cost and latency budget, and monitoring.

Across all three

The pattern

ML recommendations

Ambiguity
"Use AI to grow revenue"
Data foundation
25+ event tracking plan with attribution
First failure
Offline winner, no live lift
Fix
Live holdout testing
Result
+8% AOV

Fraud ML

Ambiguity
"Reduce fraud" vs. conversion
Data foundation
Late chargeback labels joined back
First failure
Over-blocked good customers
Fix
Net-loss metric and shadow mode
Result
-30% fraud losses

Agentic RAG

Ambiguity
"Give sales an AI assistant"
Data foundation
Curated sources with owners and freshness
First failure
Confidently wrong from stale docs
Fix
Citations and an evaluation set
Result
2x lead-to-close conversion

Each project failed first on trust, not technology. Now nothing I ship goes live without an evaluation gate, a cost and latency budget, monitoring, and a clear answer to "what happens when it's wrong?"

Evaluation & governance

No model ships without an evaluation gate, a cost and latency budget, and monitoring.

Tools I use daily

Claude, Cursor, Gemini, Lovable, n8n.