NLP with Generative AI 2026: From Chatbots to Autonomous Agents in Production
In December 2020 we published an introduction to natural language processing (NLP) with Python. Back then, the state of the art was spaCy, NLTK and Hugging Face’s first transformers. Five years later, the landscape has changed radically: generative AI has absorbed classical NLP and the challenge is no longer tokenizing or POS-tagging, but orchestrating autonomous agents that reason, act and learn in production with sub-second latencies and controlled costs.
At BAOSS we have guided some twenty clients —banking, retail, logistics, public sector— through that transition. This article is not a library guide; it is a battle report with real 2026-2027 problems, the architectures that work today and return metrics we can sign off on.
The real 2026-2027 problem: “We have LLMs, but they never leave the pilot”
78% of Spanish companies with more than 500 employees have tried GPT-4o, Claude 4 or open models like Llama 3.1/3.2 in test environments (source: Generative AI Barometer 2025, AMETIC). However, only 12% have scaled to production with defined SLAs. The usual bottlenecks we see at BAOSS:
- Fragile RAG: they retrieve irrelevant chunks, hallucinate citations and don’t cite traceable sources.
- Agents that get stuck: infinite loops in
LangGraphorCrewAIdue to missing guardrails and hard timeouts. - Runaway costs: $0.15/M input tokens on GPT-4o seems small, but an agent iterating 12 times per ticket drives the monthly bill to 5 digits.
- Zero governance: no automatic evals, no red-teaming and no audit of PII in logs.
An insurance client (anonymized as “Client A”) came to us with a RAG chatbot over 40,000 PDF policies. Accuracy in testing: 71%. In production, with real queries from brokers: 42%. The gap wasn’t the model; it was the retrieval architecture and continuous evaluation.
BAOSS 2026 reference architecture: agentic RAG + MCP + continuous evals
The solution we deploy in production (AWS/GCP on-prem, Kubernetes + vLLM/Ollama for open models) follows this pattern:
- Multimodal ingestion:
Unstructured.io+ OCR (Tesseract + layoutlmv3) → semantic chunks of 512 tokens with 50 overlap, enriched metadata (section, version, validity). - Hybrid indexing:
Qdrant(dense vector,bge-m3) +Elasticsearch(BM25 + ELSER v2) + entity graph (Neo4j) for relational hops. - Agentic RAG with
LangGraph: retrieve node → grade node (relevance ≥ 0.82) → rewrite node (max 2 retries) → generate node (Claude 4 Sonnet / Llama 3.1 70B Instruct) → verify node (exact citation + factual coherence). - MCP (Model Context Protocol) for tools: the agent invokes internal APIs (CRM, pricing engine, digital signature) through typed MCP servers, not ad-hoc function calling.
- Automated nightly evals: 1,200-question golden set +
RAGAS(faithfulness, answer_relevancy, context_precision) +PromptFoofor prompt regressions. Slack alert if faithfulness < 0.90. - Observability:
LangSmith+OpenTelemetry→ Grafana: P95 latency, cost per conversation, human escalation rate.
Result at Client A after 8 weeks: accuracy 91%, P95 latency 1.8s, average cost €0.018/conversation (own model on vLLM), human escalation 4.2% (previously 23%). ROI at 6 months: 3.4x (net savings of €280k/year in broker time).
When to use a proprietary vs. open model: the BAOSS decision rule
| Criterion | GPT-4o / Claude 4 | Llama 3.1 70B / Nemotron 3 Ultra (vLLM/Ollama) |
|---|---|---|
| Strict latency < 800 ms | ❌ | ✅ (batch + speculative decoding) |
| Sensitive data on-prem mandatory | ❌ (except Azure/OpenAI Enterprise) | ✅ |
| Complex multi-step reasoning (> 5 tools) | ✅ | ⚠️ (needs LoRA fine-tune) |
| Cost per 1 M output tokens | $15 | $0.6 (own A100/H100 GPU) |
| Time-to-market < 3 weeks | ✅ | ⚠️ (infra + MLOps) |
In practice, 65% of our 2026 projects are hybrid: orchestrator agent (Claude 4) + specialized workers (Llama 3.1 LoRA) via MCP. A logistics client (“Client B”) classifies 12,000 delivery notes/day: LayoutLMv3 extractor → 7B LoRA classifier (98.3% accuracy) → Claude 4 validator only on edge cases (2.1%). Total cost: €0.004/document.
Autonomous agents: from chat to operations
The leap from 2024 to 2026-2027 is going from “responding” to “executing”. Mature frameworks:
- LangGraph: deterministic state graphs, native checkpointing, ideal for regulated flows (KYC, claims).
- CrewAI: agent role-playing (researcher, writer, reviewer), fast for content prototypes.
- AutoGen 0.4: multi-agent conversation with sandboxed code execution, powerful for data analysis.
Real case (“Client C”, private banking): “KYC Onboarding” agent on LangGraph. Flow: 1) ID + selfie ingestion (OCR + face-match), 2) sanctions list check (World-Check API via MCP), 3) risk report generation, 4) qualified e-signature, 5) onboarding in the core banking system. Average time: 3 min 12 s (previously 45 min manual). Error rate: 0.7% (human review). Deployment: 6 weeks, 82% reduction in operating time.
Governance, security and evals: what separates a pilot from a product
- Automated red-teaming:
Garak+ custom adversarial prompts (prompt injection, system prompt extraction, PII). Run in CI/CD on every merge. - Runtime guardrails:
NVIDIA NeMo Guardrails(Colang rules) +Presidiofor anonymization before calling the LLM. - Living golden dataset: 5% of real conversations labeled weekly by subject matter experts; feeds monthly LoRA fine-tuning.
- Cost governance: per-agent/day budgets in
LangSmith; automatic kill-switch if the threshold is exceeded.
Key metric we require before go-live: faithfulness ≥ 0.92, answer_relevancy ≥ 0.88, context_precision ≥ 0.85 on the golden set. If it isn’t met, it doesn’t leave staging.
BAOSS 2026-2027 technical stack (executive summary)
| Layer | Default choice | Alternative |
|---|---|---|
| Agent orchestration | LangGraph | CrewAI / AutoGen |
| Proprietary models | Claude 4 Sonnet / GPT-4o | Gemini 2.0 Flash |
| Open models (self-hosted) | Llama 3.1 70B / Nemotron 3 Ultra (vLLM) | Qwen 2.5 72B / Mistral Large 2 (Ollama) |
| Embeddings | bge-m3 (dense) + ELSER v2 (sparse) | Nomic v2 / SFR-Embedding |
| Vector DB | Qdrant (HNSW + quantization) | Milvus / PGVector |
| Graph DB | Neo4j Aura | Kuzu / FalkorDB |
| Tools / MCP | Typed MCP servers (FastAPI + Pydantic) | Native function calling |
| Evals / Observability | LangSmith + RAGAS + PromptFoo + Grafana | Phoenix / Weights & Biases |
| Infra / MLOps | K8s (EKS/GKE) + ArgoCD + KServe | Vertex AI / Azure ML |
Mistakes that keep killing projects (and how we avoid them)
- Naive chunking: splitting by fixed 512 tokens breaks tables and lists. We use semantic chunking with the
llama-indexchunker+ layout detection. - Ignoring temporal metadata: a policy clause valid in 2023 is not valid in 2026. Mandatory
valid_from / valid_tometadata on every chunk; pre-retrieval filter. - Prompt engineering as spaghetti code: prompts versioned in Git, Jinja2 templates, unit tests with
PromptFoo. - No measurable human-in-the-loop: we define escalation triggers (confidence score < 0.72, sensitive entities, user asks for a human) and measure the human handoff rate weekly.
- Underestimating token burn in loops: max_iterations = 3 hard-coded in the graph; token budget per node monitored in
LangSmith
Prefer to talk to us directly? Contact the BAOSS team and tell us about your challenge.
Related articles: Kafka and ksqlDB: Real-Time Data Streaming / AI agent risk: how to control what your company is already deploying.
