DevWithAbhinav
AS
Abhinav Srivastava Lead Engineer · 12+ yrs enterprise .NET & AWS · building AI agents with Microsoft Agent Framework
Architecture note

The Complete Production Execution Lifecycle

A hybrid stack: an Agentic AI execution lifecycle built on top of a Generative AI infrastructure — 7 phases, 13 steps, and the specific tool for each one, from offline ingestion through post-execution observability.

why this is current

Three signals confirm this is the standard enterprise architecture right now, not a dated pattern.

MCP & A2A — standardized tool + agent-to-agent protocols State-machine orchestration — graph loops, not linear chains GraphRAG — entity graphs over naive fixed-chunking

two layers, one stack

the muscle / perception layer

Generative AI

Linear, reactive input-to-output — a prompt goes in, the model produces text, code, or embeddings. Shows up in Phases 2, 3, and 6 below.

the brain / decision engine

Agentic AI

An autonomous, cyclic loop — goal → plan → tool call → observe → reflect → execute. Manages orchestration and multi-step state. Shows up in Phases 4, 6, and 7 below.

NextPhase 01 → Offline Ingestion & Data Preparation
Phase 01 / 07 · offline

Offline Ingestion & Data Preparation

Triggered asynchronously, before any user prompt ever hits the application.

step 1

Raw Data Ingestion & Extraction

Raw enterprise files — PDFs, spreadsheets, slide decks, database dumps — are cleaned, extracted, and normalized into machine-readable text.

extraction & parsing tools
Unstructured.io

Ingests messy formats (PDF, HTML, DOCX, images) into clean structured JSON. One API to normalize many heterogeneous file types before chunking.

LlamaParse

Specialized in dense, table-heavy PDFs — financial reports, technical manuals — where naive extraction breaks table structure.

Apache Tika

Mature Java-based extractor supporting 1000+ formats. Free, self-hosted, battle-tested for legacy/obscure file types.

Marker

Deep-learning PDF-to-Markdown conversion, including scanned documents, preserving headers and tables without heavy OCR post-processing.

data pipeline frameworks
Airflow / Prefect / Dagster

DAG-based schedulers for recurring ingestion — retries, dependencies, and monitoring across many data sources.

dbt

SQL-first transformation for structured/tabular data that needs cleaning and modeling before embedding.

step 2

Chunking & Structuring

Extracted documents are split into chunks optimized for retrieval, preserving semantic meaning without cutting off context.

strategies & techniques
Semantic Chunking

Splits where embedding similarity between sentences drops. For legal/medical documents where mid-idea cuts hurt accuracy.

Recursive Character Splitting

Tries a hierarchy of separators until chunks fit a target size — the fast, simple default for general-purpose text.

Parent-Child Mapping

Retrieves small precise child chunks for accuracy, returns the larger parent chunk for full context.

Sliding Window Chunking

Overlapping chunks (e.g. 20%) so ideas spanning a boundary aren't lost when important info straddles the edge.

NextPhase 02 → Offline Vector Indexing & Memory Setup
Phase 02 / 07 · offline

Offline Vector Indexing & Memory Setup

Organizes data into searchable repositories so the AI can retrieve relevant context later.

step 3

Vector Embeddings & Hybrid Indexing

Text chunks are converted into dense vector representations and loaded into vector search engines alongside hybrid keyword indices.

vector embedding models
OpenAI Embeddings

text-embedding-3 family — reliable managed API, no hosting infra, don't need full on-prem data.

Voyage AI

Domain-tuned models (code, finance, legal) that often outperform generic embeddings when accuracy in a niche matters most.

Jina AI

Open-weight, long-context, multilingual — downloadable for self-hosting.

BGE (BAAI)

Widely used, free, top-ranking open-source family — strong retrieval at zero licensing cost.

Nomic Embed

Open, reproducible, full training-data transparency — for regulated environments needing auditability.

vector databases
Pinecone

Fully managed, serverless — production-grade search without managing infra.

Qdrant

Rust-based, rich metadata filtering, self-hosted or managed.

Weaviate

Open-source with built-in hybrid search (vector + keyword) out of the box.

Milvus

Distributed, built for billion-scale vector workloads at enterprise scale.

Chroma

Lightweight, embedded, in-process — ideal for prototyping and small apps.

pgvector

Vector search inside Postgres — for teams already running it who want one less moving part.

step 4

Knowledge Graph Construction (GraphRAG)

For complex domain tasks, unstructured data gets linked into entity-relationship graphs to support multi-hop reasoning.

graph databases
Neo4j

The leading native graph database — for multi-hop reasoning across connected entities plain vector search can't answer.

Memgraph

In-memory, Cypher-compatible — real-time graph updates for fraud detection, live relationship tracking.

data warehouses & lakes
Snowflake / Databricks / Delta Lake / BigQuery

Source-of-truth platforms feeding the RAG pipeline when enterprise data already lives in a lake/warehouse.

NextPhase 03 → Offline Fine-Tuning & Model Adaptation
Phase 03 / 07 · offline

Offline Fine-Tuning & Model Adaptation

Executed periodically when base foundation models need domain-specific knowledge or behavioral alignment.

step 5

Parameter Optimization & Alignment

Open-source models are fine-tuned using domain datasets, adapter techniques (LoRA), or reinforcement learning to follow company-specific patterns.

model repositories
Hugging Face

The largest hub for open-source weights, datasets, and training/inference libraries — source models or host your own checkpoints.

fine-tuning engines & frameworks
PEFT / LoRA

Freezes most weights, trains small adapter matrices — drastically cuts fine-tuning compute/memory cost.

Unsloth

Optimized LoRA/QLoRA training (2–5x faster), lower VRAM — for limited GPU budgets and faster iteration.

Axolotl

YAML-config-driven wrapper standardizing fine-tuning recipes across architectures — repeatable, no custom loops.

TRL

Hugging Face's RLHF library (SFT, reward modeling, PPO, DPO) — aligning tone/behavior/safety via preference optimization.

LLaMA-Factory

No-code web UI to fine-tune 100+ open models — minimal ML-engineering overhead.

NextPhase 04 → Runtime Request Entry & Security
Phase 04 / 07 · runtime

Runtime Request Entry & Security

Triggers the moment a user submits a query via the application UI or API.

step 6

Input Security, DLP & Anonymization

The incoming prompt is inspected to strip out PII and blocked if malicious prompt injections are detected.

data privacy & DLP
Presidio

Microsoft's SDK — detects and anonymizes PII (names, emails, cards) before it hits the model or logs.

DLP Gateways

Architectural pattern — a centralized data-loss-prevention checkpoint for all AI traffic, for compliance requirements.

application firewalls & ingestion security
Rebuff

Multi-layered open-source defense (heuristics, LLM detection, canary tokens) built specifically for prompt injection.

Lakera Guard

Commercial real-time API screening for injection, jailbreaks, PII leakage, and toxicity — managed, continuously updated.

Palo Alto AI Guard

Enterprise firewall extending traditional threat-intel to AI traffic, for teams already on Palo Alto's stack.

NextPhase 05 → Caching & Latency Optimization
Phase 05 / 07 · runtime

Caching & Latency Optimization

Reduces response times and cuts API costs for repetitive or similar queries.

step 7

Semantic & KV Caching Check

The system checks whether an exact or semantically identical query has already been answered, bypassing inference if cached.

semantic caching frameworks & tools
GPTCache

Caches responses by embedding similarity, not exact string match — paraphrased questions still hit the cache.

Redis

In-memory key-value store backing exact and semantic caches — sub-millisecond lookups at high throughput.

inference engine caching strategies
PagedAttention / RadixAttention

Low-level KV-cache management — PagedAttention (vLLM) avoids memory fragmentation, RadixAttention (SGLang) reuses shared prefixes.

NextPhase 06 → Query Execution, Retrieval & Orchestration
Phase 06 / 07 · runtime

Query Execution, Retrieval & Orchestration

On a cache miss, the orchestrator retrieves context, builds the prompt, and coordinates model interactions.

step 8

Context Retrieval & Reranking

The prompt queries the Vector DB and Knowledge Graph for top matching chunks; a reranking model re-scores the retrieved context for relevance.

reranking models
Cohere Rerank

Managed cross-encoder — precise final ranking after a broad vector-search pass.

BGE Reranker

Open-source cross-encoder, self-hostable for cost or data-residency reasons.

step 9

Agent Orchestration & Protocol Translation

The orchestrator coordinates system state, conversational history, retrieved context, and tool definitions into a unified execution step.

orchestration frameworks
LangChain

Broad SDK with standardized abstractions — large ecosystem, best for simpler linear control flow.

LangGraph

State-machine extension purpose-built for agentic loops — branching, cycles, persistent state.

LlamaIndex

Specialized in data ingestion/indexing/retrieval — best when the core challenge is data connections, not complex orchestration.

CrewAI

Role-based "crews" of collaborating agents — for workflows that decompose into specialized personas.

AutoGen

Microsoft's conversation-driven multi-agent framework, often with human-in-the-loop steps.

Pydantic AI

Enforces strict typed inputs/outputs — critical when type safety matters for production reliability.

short-term conversational memory
Redis / Memcached

Fast in-memory stores holding recent turns/session state for low-latency context during a live interaction.

tool & context protocols
MCP

Anthropic-originated open standard — a uniform way for apps to discover and call external tools/data sources.

Function Calling

Model-native structured call (name + arguments) matching a predefined schema for reliable app invocation.

A2A

Google-backed protocol letting independently-built agents discover capabilities and communicate directly.

Computer Use

Agent perceives a screen and controls mouse/keyboard for software with no API.

Composio

Pre-built, authenticated integrations (Gmail, Slack, GitHub) — fast access without building each connector.

agentic design patterns
ReAct

Interleaves reasoning and tool-action steps — general tool-using reasoning tasks.

Reflexion

The agent critiques and revises its own past attempts — iterative self-correction.

Plan-and-Solve

Decomposes a goal into a plan before executing — complex multi-step goals.

Human-in-the-Loop

Inserts a manual approval checkpoint — high-stakes actions needing sign-off before execution.

step 10

Model Inference & Serving

The assembled prompt is submitted to the model execution layer — cloud API or self-hosted GPU cluster.

proprietary foundation models
GPT-5.x

OpenAI's flagship — general-purpose high-capability reasoning via managed API.

Claude Opus 5

Anthropic's top-tier model, tuned for reasoning, coding, and agentic tool-use.

Gemini 3.x

Google's multimodal flagship, integrated with Google Cloud/Vertex AI.

open-source foundation models
Llama 4

Meta's open-weight family — full control, on-prem deployment, or a fine-tuning base.

DeepSeek V4

Strong performance-per-cost, often mixture-of-experts — near-frontier at lower serving cost.

Qwen 3.x

Alibaba's open-weight family — strong multilingual (Chinese/English) and coding performance.

inference & serving engines
vLLM

High-throughput serving via PagedAttention — self-hosting open-weight models at production throughput.

Ollama

Simple local LLM runner — prototyping, privacy-sensitive single-machine inference.

llama.cpp

Quantized C++ engine — limited/edge hardware without a dedicated GPU.

Groq

Custom LPU hardware — ultra-low-latency generation for real-time voice agents.

AWS Bedrock

Managed multi-provider access with enterprise compliance — natural fit for an AWS-heavy stack.

Google Vertex AI

End-to-end managed platform for foundation-model access plus custom ML on GCP.

step 11

Prompt Output & Schema Enforcement

Raw generated output is parsed and strictly coerced into valid JSON, typed structures, or UI components.

output control engines & libraries
DSPy

Treats prompts as optimizable programs — tunes wording/examples against a metric instead of hand-tuning.

Instructor

Wraps calls with Pydantic models, auto-retries until output validates — minimal boilerplate for typed output.

Outlines

Constrains token generation itself via grammars/regex/schema — hard format guarantees at generation time.

Guidance

Interleaves control logic with generation — fine-grained control filling specific template slots.

BAML

DSL/compiler for typed LLM functions compiling to type-safe client code across languages.

Native Structured Outputs

Provider's built-in JSON-mode feature — no extra validation tooling needed.

NextPhase 07 → Post-Execution, Safety & Observability
Phase 07 / 07 · runtime

Post-Execution, Safety & Observability

Runs concurrently with returning the response to the end user.

step 12

Output Safety Guardrails

The generated response passes a final check to verify factual grounding, catch hallucinations, and block toxic or off-topic content.

guardrail engines & models
NeMo Guardrails

NVIDIA's programmable "rails" — topical, safety, factuality — constraining what a bot can say or do.

Guardrails AI

Python framework validating and auto-correcting output against declarative "guards" (no PII, valid format).

Llama Guard

Meta's open-weight moderation classifier — self-hostable unsafe-content detection.

Robust Intelligence

Enterprise platform (now Cisco) for automated AI red-teaming and continuous testing.

step 13

Tracing, Logging & Evaluation

The full request-response lifecycle — tokens, latency per step, retrieval quality, total cost — is logged for continuous evaluation and MLOps metrics.

MLOps & observability platforms
LangSmith

LangChain's managed tracing/eval platform — tight integration when the stack already uses LangChain/LangGraph.

Langfuse

Open-source, self-hostable, framework-agnostic — for data-residency or cost-driven tracing needs.

Arize Phoenix

Focused on embedding drift analysis alongside tracing and eval dashboards.

automated evaluation frameworks
Ragas

RAG-specific metrics — faithfulness, answer relevancy, context precision/recall — without hand-labeled ground truth.

DeepEval

"pytest-like" unit testing for LLM outputs — hallucination, bias, toxicity — wired into CI/CD.

Enddevwithabhinav.in · Production Execution Lifecycle
get in touch

Open to senior/lead remote roles

Especially where enterprise .NET meets AI agent engineering — reach out, or see the Microsoft Agent Framework build this playbook draws on.