Book a free call

Generative AI Tech Stack: What to Build With

A generative AI tech stack has seven layers, from the model to monitoring. Learn what each layer does, which tools fit, and how to pick a stack that holds up.

Hertiv engineering teamReviewed by a senior engineer
6 min read
Generative AI Tech Stack: What to Build With
On this page

Short answer

A generative AI tech stack is the set of layers that turns a foundation model into a working product: a model layer, a data and retrieval layer, an orchestration layer, an evaluation layer, a deployment layer, a guardrail layer and an observability layer. Each layer solves one problem, and a weak layer limits the whole product.

What is a generative AI tech stack?

A generative AI tech stack is the set of layers that turns a foundation model into a working product. The model on its own can generate text, images or code, but a product also needs data to ground it, code to orchestrate it, tests to check it, infrastructure to run it and monitoring to watch it.

Think of the stack as seven layers, each with one job. A weakness in any layer shows up in the product: bad retrieval gives wrong answers, missing evaluation hides regressions, and no guardrails let bad output reach users.

Layer Job Common tools
Model Generate text, image or code GPT, Claude, Gemini, Llama, Mistral
Data and retrieval Ground answers in your content pgvector, Pinecone, Weaviate, Qdrant
Orchestration Chain prompts, tools and steps LangChain, LlamaIndex, Haystack
Evaluation Measure quality on fixed cases Ragas, DeepEval, promptfoo
Deployment Serve the model reliably vLLM, Ollama, Triton, cloud endpoints
Guardrails Block unsafe input and output Guardrails AI, NeMo Guardrails
Observability Trace, log and watch usage LangSmith, Langfuse, Arize Phoenix

You do not need every tool in the table. A first product usually needs a model, a retrieval layer and an evaluation set, and the rest can be added as the product grows.

How do you choose the model layer?

You choose the model layer by matching the model to the task, the data rules and the budget. The strongest model is not always the right one: a smaller model can be faster and cheaper for a narrow task, and an open model can be the only option when data must stay inside your own systems.

Start with the task. Drafting and summarising are forgiving, while code generation and medical or legal text need higher accuracy and stronger checks. Then check the data rules: if customer data cannot leave your cloud, a hosted API may be ruled out and a self-hosted open model may be required.

Test two or three models on your own cases before committing. Vendor benchmarks describe general ability, not performance on your documents, your tone or your edge cases. A fixed evaluation set of real inputs and known good outputs is the only fair comparison.

Finally, check the cost model. Hosted APIs charge per token, so a chatty product can cost more than expected, while self-hosted models cost in infrastructure and operations instead. Prices change often, so check the vendor site for current pricing. See what generative AI is for the model types behind the choice.

What holds the data and retrieval layer?

The data and retrieval layer holds the content your model answers from and finds the right piece for each question. Without it, a model answers from its training data alone, which is how hallucinations and out-of-date answers happen.

The usual pattern is retrieval-augmented generation. Your documents are split into chunks, each chunk is turned into a vector embedding, and the embeddings are stored in a vector database such as pgvector, Pinecone, Weaviate or Qdrant. When a question arrives, the system searches for the most relevant chunks and passes them to the model with the question.

The quality of this layer depends on the documents, not on the database. Outdated, duplicated or badly chunked documents produce bad retrieval no matter which vector store you pick, so cleaning the source content comes before choosing a tool.

Access control matters too. If a document is restricted to one team, the retrieval layer must respect that, or the model will leak content to people who should not see it. Check how your chosen tools handle permissions before you load sensitive documents.

How do evaluation and guardrails fit in?

Evaluation and guardrails fit in as the quality controls of the stack. Evaluation measures whether the product is getting better or worse, and guardrails stop unsafe input and output from reaching users or systems.

Evaluation needs a fixed set of real cases with known good answers. Tools such as Ragas, DeepEval and promptfoo run the product against that set and score the results, so a prompt change or a model swap can be judged on numbers rather than on a few examples someone tried by hand.

Guardrails sit at the edges. On the way in, they check prompts for injection attempts, personal data and off-topic requests. On the way out, they check answers for toxicity, hallucinated citations and disallowed content. Guardrails AI and NeMo Guardrails are the common open options, and most hosted model providers also offer their own filters.

Both layers need owners. An evaluation set that nobody updates goes stale, and a guardrail that nobody reviews either blocks good users or lets bad output through. For the wider practice, generative AI use cases show where these controls matter most.

How do you deploy and watch a generative AI product?

You deploy and watch a generative AI product by treating the model like any other service: with versioned releases, health checks and logs, plus the extra traces that language models need.

Deployment choices are hosted APIs, managed endpoints or self-hosted inference with tools such as vLLM, Ollama or Triton. Hosted APIs are fastest to start, while self-hosting gives control over data and cost at the price of operations work. Many teams start hosted and move the busiest workloads to self-hosted inference later.

Observability is what makes a deployed product improvable. Tools such as LangSmith, Langfuse and Arize Phoenix record each prompt, the retrieved context, the model output and the cost, so you can trace a bad answer back to its cause. Without traces, debugging is guesswork.

Set alerts for the signals that matter: error rate, latency, cost per request and the share of answers that trigger a guardrail. A spike in any of these is usually the first sign that a prompt, a model or the underlying data changed.

Example (hypothetical): a support team picks its stack

Example (hypothetical): a 40-person support team wants an assistant that drafts answers from its help centre. It picks a hosted model API for speed, pgvector inside its existing database for retrieval, and LangChain to chain retrieval and drafting. It writes 60 real tickets with known good answers as its evaluation set.

The first test shows the assistant answers 42 of the 60 cases well, cites the wrong article in 10, and invents a policy in 8. The team fixes the help centre duplicates that caused the wrong citations, adds a guardrail that blocks answers without a citation, and reruns the set. The second run gives 50 good answers, 6 wrong citations and 4 invented policies.

The stack did not change between the two runs; the data and the guardrail did. That is the normal pattern: the model layer gets the attention, but the retrieval and guardrail layers decide the result. The team ships with a human reviewing every draft, and it reruns the 60 cases on every prompt change.

What are the common mistakes?

The most common generative AI stack mistakes are choosing tools before defining the use case, skipping evaluation, and treating the model as the whole product.

  • Tool-first selection. Picking a framework before knowing the workflow leads to a stack that fits the demo, not the job.
  • No evaluation set. Without fixed cases, every change is judged on anecdotes and quality drifts silently.
  • Dirty retrieval data. Outdated or duplicated documents produce wrong answers no matter which vector database you use.
  • Guardrails as an afterthought. Adding safety checks after launch means the first bad output reaches users before the fix does.
  • One model for everything. Different tasks need different models, and a single model choice is usually a compromise that serves none of them well.

If you are choosing a stack for a real product, generative AI development covers how teams scope the build.

For the surrounding product layers, see the SaaS tech stack guide.

Key takeaways

  • A generative AI stack has seven layers, and a weak layer limits the whole product
  • Pick the model by task, data rules and cost, and test it on your own cases
  • Retrieval quality follows document quality, not the vector database
  • Evaluation and guardrails are the quality controls, not optional extras
  • Build the evaluation set before the stack, and rerun it on every change

Frequently asked questions

What is the difference between a generative AI tech stack and a SaaS tech stack?

A SaaS tech stack covers the whole product: frontend, backend, database and infrastructure. A generative AI tech stack covers the layers that make a model useful inside that product: the model, retrieval, orchestration, evaluation, guardrails and observability. Most products need both.

Do I need LangChain or a similar framework?

Not always. A simple product can call a model API directly with a small amount of code. Frameworks such as LangChain, LlamaIndex and Haystack pay off when you chain several steps, call tools or manage complex retrieval, and they cost in complexity when the job is simple.

Should I use an open model or a hosted API?

Use a hosted API when you want speed and low operations work, and an open model when data must stay in your systems or when volume makes API costs high. Many teams run both: a hosted model for drafting and an open model for sensitive or high-volume tasks.

What is the cheapest way to start?

Start with a hosted model API, a vector store inside a database you already run, and a hand-written evaluation set. That combination costs little and answers the real question, which is whether the use case works on your data, before you commit to infrastructure.

How do I know if my stack is working?

Rerun your evaluation set on a schedule and watch the score, the cost per request and the guardrail trigger rate. If the score is stable or improving, costs are predictable and guardrails rarely fire on good traffic, the stack is working.

What changes most often in a generative AI stack?

Models and prompts change most often, as providers release new versions and teams refine instructions. The retrieval layer and the evaluation set change more slowly, which is why investing in clean documents and good test cases pays off longer than chasing the newest model.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a generative AI product and unsure which stack fits? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Generative AI Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call