/Monday, June 1, 2026

The Modern AI Engineering Stack: Models, Agents, RAG, Tools, Workflows, and Infrastructure

By: Ismael Tang
Lght & Drkness, © Ismael Tang, 2026.

The AI Stack Is Now a System

Modern AI applications combine models with ordinary software engineering.

The model is one component, not the entire product.

The useful skill is understanding what each layer contributes.

Start with the problem, then choose the layers.

Models

Models provide generation, reasoning, classification, extraction, and multimodal capabilities.

Different models trade quality, speed, context, modality, and cost.

Choose models using the actual workload.

Benchmarks help, but application-specific evaluations matter more.

Model APIs

Provider APIs expose models, tools, structured output, embeddings, and other capabilities.

They form the boundary between your application and model infrastructure.

Keep provider-specific code isolated.

Do not erase provider features that create real value.

Structured Outputs

Structured outputs make model responses easier for applications to consume.

They are useful for extraction, routing, classification, and tool arguments.

Validation still matters.

Valid structure does not guarantee correct meaning.

Embeddings

Embeddings represent information for semantic comparison.

They support semantic search, clustering, and retrieval.

They become especially useful when keyword search is insufficient.

Embeddings are a building block, not an entire memory system.

RAG

RAG retrieves relevant information and places it into model context.

It is useful for private and changing knowledge.

A RAG system needs ingestion, indexing, retrieval, filtering, and context assembly.

Good retrieval can matter more than another model call.

Tools

Tools connect models to external systems.

They can search, query databases, call APIs, or perform controlled actions.

Keep tools narrow and well documented.

The application executes the tool and enforces authorization.

Agents

Agents use models, tools, state, and iterative decisions to pursue goals.

They are useful when the path cannot be fully predetermined.

They also add cost, latency, and failure modes.

Do not use an agent merely because it is fashionable.

Workflows

Workflows provide deterministic orchestration.

They are ideal for repeatable sequences.

A workflow can contain AI without becoming an agent.

This distinction improves predictability.

State

State records what the application knows about a process.

Persistent state should not depend entirely on model context.

Long-running agents benefit from explicit state.

Databases

Relational databases remain central to AI products.

Users, permissions, billing, jobs, documents, and state need durable storage.

Vector search complements transactional data.

It does not replace it.

Orchestration

Orchestration coordinates models, tools, state, retries, and stopping conditions.

It can be custom code or a framework.

Use the abstraction your team can debug.

Evaluation

Evaluation measures whether changes improve the system.

Measure quality, retrieval, tool selection, task completion, latency, and cost.

Agentic systems need evaluations because their paths can vary.

Observability

Tracing connects model calls to retrieval, tools, errors, and outcomes.

Without traces, multi-step AI failures become guesswork.

Observability should be designed from the start.

Security

AI systems must account for prompt injection, data access, tools, and secrets.

The model should not be the final authority for sensitive actions.

Authorization belongs in application code.

Infrastructure

Queues, workers, storage, databases, and monitoring support production AI workloads.

Background jobs are useful for long-running work.

Infrastructure should match workload requirements.

Deployment

Model and prompt changes can alter production behavior.

Version configuration and evaluate changes before rollout.

Staged releases and feature flags reduce risk.

Cost

AI cost includes model calls, tokens, tools, storage, and infrastructure.

Measure cost per useful outcome.

Cheap unusable output is not efficient.

Choosing the Minimum Stack

Not every product needs RAG, agents, vectors, workflows, and multiple providers.

Start with the smallest stack that solves the problem.

Add layers only when requirements justify them.

A Practical Web Stack

A modern product might use React or Next.js, Node.js, PostgreSQL or Supabase, model APIs, storage, and observability.

Add retrieval for external knowledge.

Add queues for asynchronous processing.

Add agents when dynamic decisions provide measurable value.

How the Layers Work Together

A request can enter through the frontend, pass authorization, retrieve context, call a model, use tools, update state, and return a validated result.

Each layer has a different responsibility.

Clear boundaries keep the system understandable.

Technology Changes Quickly

AI products change quickly.

New APIs can replace older abstractions.

Strong engineering fundamentals last longer than individual tools.

A Decision Framework

Ask whether the problem needs generation, retrieval, tools, dynamic planning, or deterministic orchestration.

Then add only the layer that solves that requirement.

This prevents the stack from becoming a technology shopping list.

The Human Side

AI engineering is still software engineering.

APIs, databases, security, testing, deployment, and operations remain essential.

The new skill is deciding where probabilistic behavior belongs.

Final Takeaway

The modern AI stack is a collection of layers, not one magical technology.

Models provide intelligence, retrieval provides context, tools provide capabilities, agents provide dynamic control, and workflows provide deterministic orchestration.

Infrastructure makes the system operational.

The best engineers know when each layer is necessary and when it is unnecessary.

Further Reading

Explore model APIs, RAG, agents, workflow automation, tool design, evaluation, and AI security.

Combine only the pieces required by the product.

A modern stack is not defined by how many technologies it contains.

It is defined by how effectively those technologies solve the user's problem.

Keep the stack understandable.

Keep boundaries explicit.

Measure outcomes.

Let architecture evolve with the product.

Technology moves quickly.

Good architecture gives you room to move with it.

Strong fundamentals outlast individual AI products.

Build systems that can evolve.

Choose tools based on requirements.

Replace tools when better options appear.

Keep the architecture stable enough to absorb change.

That flexibility is a defining AI engineering skill.

The goal is not to use everything.

The goal is to use the right things well.

That is what makes an AI stack useful beyond today's technology cycle.

Stay in touch

For the latest announcements, visit the blog.

Press Contact: press@ismaeltang.com.

Sign up for my newsletter.

By subscribing, you request email updates. Unsubscribe by email. Read our privacy policy.

Your Partner in Growth

I design and build cohesive systems that are performant, scalable, and maintainable, with a focus on delivering reliable solutions that evolve with changing requirements.

Make Your Vision real