What LLM integration actually involves
LLM integration wires a large language model into a product or internal process, supplying context, letting it call tools and checking its output. Many projects follow one of three patterns: retrieval from your documents, agents acting through tools, or NL2SQL turning plain English into database queries. Each carries a different main risk that should shape the build.
Many projects fall into one of three patterns. The model answers from your documents, it takes actions through tools, or it turns a plain-English question into a database query. Each has a different main risk, which should shape the build.
| Pattern | Use it when | Main risk to design for |
|---|---|---|
| Retrieval (RAG) | Answers must come from your own, changing documents, with sources | Bad retrieval, stale or leaked content |
| Agents with tools | The model must do things: query, send, update, schedule | Unsafe or runaway actions, cost |
| NL2SQL | People need answers from a database without writing SQL | Wrong joins, unsafe queries |
How a pilot runs, week by week
Week one freezes scope to one end-to-end user journey, with an out-of-scope list and staging up on day two. Week two builds the slice, setting expected behaviour on a small golden question set before prompt polishing, and logs every request. Weeks three and four cover authentication, rate limits, personal data handling, logging and a runbook, ending with handover.
Week 1: freeze scope, pick one vertical slice
One user journey end to end, with an explicit out-of-scope list. Staging goes up on day two with real anonymised data, not synthetic data only. If anonymising is hard, that is a week-one finding, not a launch surprise.
Week 2: build with evaluation gates
Whether it is RAG, agents or NL2SQL, expected behaviour on a small golden question set comes before prompt polishing. Every request is logged with the prompt, retrieved chunks, latency and token cost.
Weeks 3 and 4: harden, comply, hand over
Auth, rate limits, PII handling, structured logging and a runbook, not just a Docker image. EU clients default to region-specific hosting. You receive the repos, infra notes, eval scripts and a short walkthrough.
What we put in place before production traffic
Before production traffic, we put in place a golden question set, refusal paths for out-of-scope questions, a nightly evaluation that blocks releases when accuracy or citation rate falls below the agreed threshold, visible p95 latency and cost per query, and redacted request logging with a cost dashboard.
- A golden question set, even 20 rows, drafted before any prompt tuning marathon
- Refusal paths for out-of-scope questions, which cut hallucination risk and satisfy legal review faster than disclaimers alone
- A nightly evaluation that blocks a release when accuracy or citation rate drops below the agreed threshold
- p95 latency and cost per query visible before go-live, not after finance asks
- Request logging with redaction, and a cost dashboard
The stack we reach for first
The usual starting stack is the OpenAI or Claude APIs, one provider at first, with LangGraph where state and human-in-the-loop steps matter and simpler tool loops otherwise. The backend is Python with FastAPI, or Next.js API routes for frontend-heavy teams. PostgreSQL with pgvector holds data, and observability covers redacted request logs, cost dashboards and evaluation hooks.
| Layer | What we use |
|---|---|
| Models | OpenAI and Claude APIs, one provider to start |
| Orchestration | LangGraph where state and human-in-the-loop matter, simpler tool loops otherwise |
| Backend | Python with FastAPI, or Next.js API routes for frontend-heavy teams |
| Data | PostgreSQL with pgvector, hybrid search when exact IDs and SKUs matter |
| Observability | Redacted request logs, cost dashboards, evaluation hooks |
When three to four weeks is not enough
Some work can need a second cycle, including fine-tuning, multi-tenant isolation at scale and novel hardware bring-up, and we state that in the estimate rather than over-promising a first version. The calendar can also stretch when internal IT is slow to grant VPC access or a data protection officer has not signed off, even when engineering is ready.
Fine-tuning, multi-tenant isolation at scale and novel hardware bring-up can need a second cycle. We say so in the estimate instead of over-promising a first version. Calendar time can also stretch when internal IT is slow on VPC access or a data protection officer has not signed off, even when engineering is ready.