Incremental LLM Adoption Strategy in Email Processing API Platform

nylas · Tech · 2023 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Incremental generative-AI adoption in an email-processing API platform

Nylas wanted to introduce generative AI into its Extract AI email-processing product family without betting the production system on immature, costly, and slower LLMs. The team needed to build confidence, justify roadmap capacity to leadership, automate low-risk work first, improve annotation speed/cost, then use LLMs only where they fit production latency and economics.

Constraints:

Architecture

Nylas used a three-month staged adoption strategy. First, it ran a two-week spike to compare OpenAI, Mistral, Meta, Google, and Anthropic on cost and fit. Then it built a GitHub Actions multi-agent workflow for toil tasks: a developer agent checks ground-truth data and proposes regex/config changes, a scripted QA tester runs tests, and an LLM reviewer approves or requests another iteration before a pull request is opened for human review. Next, GPT-4 replaced a blind dual-contractor annotation workflow, cutting annotation cost and cycle time. Finally, production Extract AI kept its fast strategy library as the primary path and used LLMs only as a low-confidence fallback, processing 1-3% of emails through LLMs. In parallel, Nylas built Llama.cpp-based self-hosted inference on GCP with prompts, model registry, feature storage, and model swapping to control costs at scale.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  Nylas_platform["Nylas platform"] --> Extract_AI["Extract AI"]
  Email_data["Email data"] --> Extract_AI
  Email_data --> Annotation_tool["Annotation tool"]
  Email_data --> LLM_Anonymizer["LLM Anonymizer"]
  Adoption_strategy["Adoption strategy"] --> Model_spike_sprint["Model spike sprint"]
  Model_spike_sprint --> OpenAI_models["OpenAI models"]
  Model_spike_sprint --> Mistral_models["Mistral models"]
  Model_spike_sprint --> Meta_models["Meta models"]
  Model_spike_sprint --> Google_models["Google models"]
  Model_spike_sprint --> Anthropic_models["Anthropic models"]
  Adoption_strategy --> GitHub_Actions_workflow["GitHub Actions workflow"]
  GitHub_Actions_workflow --> Budget_limiter["Budget limiter"]
  Budget_limiter --> Developer_agent["Developer agent"]
  Ground_truth_data["Ground truth data"] --> Developer_agent
  Developer_agent --> QA_tester["QA tester"]
  QA_tester --> Reviewer_agent["Reviewer agent"]
  Reviewer_agent --> Developer_agent
  Reviewer_agent --> Engineer_reviewer["Engineer reviewer"]
  Adoption_strategy --> Annotation_tool
  Annotation_tool --> Blind_annotation_system["Blind annotation system"]
  Annotation_tool --> GPT_4_annotation_system["GPT-4 annotation system"]
  Adoption_strategy --> Extract_AI
  Extract_AI --> Strategy_library["Strategy library"]
  Strategy_library --> Confidence_estimator["Confidence estimator"]
  Confidence_estimator --> LLM_fallback["LLM fallback"]
  LLM_fallback --> Customers["Customers"]
  Extract_AI --> Inference_service["Inference service"]
  LLM_fallback --> Inference_service
  Inference_service --> Prompt_DB["Prompt DB"]
  Inference_service --> Model_registry["Model registry"]
  Inference_service --> Feature_storage["Feature storage"]
  Inference_service --> Llama_cpp_runtime["Llama.cpp runtime"]
  Llama_cpp_runtime --> GCP_L4_GPU_nodes["GCP L4 GPU nodes"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Nylas platform Email, calendar, and contact API platform used by businesses. Extract AI, Email data
Email data Customer email content processed for intelligence functions, annotations, and Extract AI strategies. Extract AI, Annotation tool, LLM Anonymizer
Adoption strategy Three-month staged plan moving from team learning to development automation, annotation, and production fallback. Model spike sprint, GitHub Actions workflow, Annotation tool, Extract AI
Model spike sprint Two-week evaluation of multiple providers and model sizes to narrow options. OpenAI models, Mistral models, Meta models, Google models, Anthropic models
GitHub Actions workflow Scheduled automation environment that runs the multi-agent development loop and opens pull requests. Developer agent, QA tester, Reviewer agent, Engineer reviewer, Budget limiter
Budget limiter Caps multi-agent iterations to avoid infinite loops. Developer agent, Reviewer agent
Developer agent LLM role that checks new ground-truth data and proposes regex/config changes. Ground truth data, QA tester, Reviewer agent
Ground truth data Source of new data that triggers regex or configuration updates. Developer agent
QA tester Scripted test role that runs integration and unit tests on proposed changes. Developer agent, Reviewer agent
Reviewer agent LLM role that reviews proposed changes, flags broad regexes, and requests iteration or opens a PR. QA tester, Developer agent, Engineer reviewer
Engineer reviewer Human reviewer who adds customer/product context and closes hallucinated or unmergeable PRs. Reviewer agent, GitHub Actions workflow
Annotation tool Internal tool for contractors or LLMs to annotate email data. Email data, GPT-4 annotation system
Blind annotation system Prior dual-contractor workflow where two annotations were reconciled on disagreement. Annotation tool, GPT-4 annotation system
GPT-4 annotation system LLM annotation replacement that produced annotations faster and cheaper than blind annotation. Annotation tool, Email data
Extract AI Production email intelligence product using fast template/statistical strategies and LLM fallback. Email data, Strategy library, LLM fallback, Inference service
Strategy library Non-LLM extraction strategies based on email templates, statistics, and expected fields. Extract AI, Confidence estimator
Confidence estimator Determines whether the existing strategy did well enough or should trigger fallback. Strategy library, LLM fallback
LLM fallback Reprocesses low-confidence emails and returns LLM results to customers. Confidence estimator, Inference service, Customers
LLM Anonymizer Internal tool for removing PII from emails before LLM processing. Email data
Inference service Self-hosted LLM serving layer used by Extract AI and other use cases. Prompt DB, Model registry, Feature storage, Llama.cpp runtime
Prompt DB Stores prompts for multiple inference-service use cases. Inference service
Model registry Stores models loaded at service initialization and supports model swapping. Inference service, Feature storage
Feature storage Supports fine-tuned model deployment in the same serving infrastructure. Model registry, Inference service
Llama.cpp runtime Framework used for flexible self-hosted inference on GCP/Kubernetes. Inference service, GCP L4 GPU nodes
GCP L4 GPU nodes Self-hosted infrastructure using G2 instances, L4 GPUs, and CUDA bootstrap storage. Llama.cpp runtime

Data flow

For development automation, a cron job starts a GitHub Actions workflow with a budgeted multi-agent loop: the developer agent reads new ground-truth data and proposes changes, QA tests run as scripts, the reviewer agent evaluates the change and either opens a PR or asks for another iteration, and engineers review the PR. For production Extract AI, incoming emails are processed by existing template/statistics strategies; if confidence is low, the email is reprocessed with an LLM and that result is returned. For self-hosting, Extract AI calls an inference service, which selects prompts from a prompt DB, runs a model loaded from the model registry, and can support fine-tuned models through feature storage.

3 supporting quotes
“chrome job that spin gab action workflow that actually goes to open PR into our code base”transcript, stated
“when a new email comes into the system we check quickly in in what are the field we expect to find in this email”transcript, stated
“the blue is our struct eyes making an API call to the inference service in red”transcript, stated

Why this architecture

Nylas deliberately avoided a big-bang LLM replacement. Low-risk internal milestones built skill and leadership confidence, annotation automation proved cost/time value, and production Extract AI kept the low-latency deterministic path while routing only low-confidence edge cases to LLMs. Self-hosting was added once API economics made break-even analysis favorable.

3 supporting quotes
“having a very easy and applicable uh strategy uh having a easy strategy has helped me as a manager to actually get approval”transcript, stated
“it was clear to us that we couldn't replace our system with llm which is a great news right”transcript, stated
“good for us we decide instead to use llm as a fullback strategy”transcript, stated

Models used: OpenAI models · Mistral models · Meta models · Google models · Anthropic models evaluated and dropped for cost · GPT-4 · GPT-4 Turbo · Llama.cpp-served open source models · fine-tuned models under exploration

Scale

Alternatives considered (roads not taken)

Jump straight to production LLM replacement

Rejected because: The team needed confidence, experience, and clearer production fit before touching Extract AI.

“I added two internal Milestone the one that is related more to using in development and the second one instead of improving our annotation workflow”transcript, stated
“and then we would have work on the production part”transcript, stated

Use Anthropic models

Rejected because: They liked model quality but cost was almost double for their use case.

“we really like it uh anthropic but when we did like a cost comparison it turned out that on our use case an Tropic was costing us almost double”transcript, stated

Keep blind dual-contractor annotation

Rejected because: It doubled cost and required weeks for 5,000 emails, while GPT-4 annotation was much faster and cheaper.

“two contractor doing the same annotation the system in the back compared the two annotation and if there are discrepancy”transcript, stated
“you ended up needing more than 200 hour which is weeks of work”transcript, stated

Replace Extract AI entirely with LLMs

Rejected because: LLMs were too slow and too expensive for all monthly email traffic.

“it was clear to us that we couldn't replace our system with llm”transcript, stated
“latency with alignment that tend to be seconds and our customer won't be happy with that”transcript, stated

Use cloud-provider model garden only

Rejected because: It was quick but lacked autoscaling and fixed hardware/model flexibility.

“you can deploy any model that they have available in less than five minutes”transcript, stated
“however does not Autos scale it has fixed hardware and you can change the model if you want a different model”transcript, stated

Patterns

multi-agent-orchestration (agent-architecture)

Nylas uses LLM developer and reviewer agents plus a scripted QA tester to iterate on regex/config updates and open PRs.

“there are actually three roles there is a developer there is a reviewer which are actually both based on LMS”transcript, stated
“the third role that is the QA tester which is just a script integration test unit test all collected in an easy script”transcript, stated

human-in-the-loop-gate (governance)

Engineers review generated PRs and provide missing product/customer context before merge.

“when we have the pr open our engineer just have to review it so it actually take them like maybe 10 minutes”transcript, stated
“having engineer reviewing the pr was actually giving the extra context and allow us to avoid uh to merge those PR”transcript, stated

fallback-degradation (resilience)

Extract AI keeps the fast existing strategy path and sends only low-confidence emails to LLM fallback.

“if we actually predict that we didn't do that great so at that point we actually reprocess the email with the llms”transcript, stated
“thanks to this fullback strategy we actually monthly just process 1 to 3% of the email with llms”transcript, stated

cost-aware-routing (operations)

Nylas compares provider costs, limits LLM fallback volume, and self-hosts when API call volume crosses break-even.

“monthly just process 1 to 3% of the email with llms which make the cost of llm reasonable for us to accept”transcript, stated
“if you call your own system more than 10,000 time you are actually starting saving M money”transcript, stated

eval-driven-development (quality)

The adoption plan starts with spike testing models and uses tests, annotation quality, PR merge rates, latency, cost, and bug tickets to decide next steps.

“another important thing for us was actually making sure to have a spike Sprint uh at the beginning uh to actually test it out multiple uh models”transcript, stated
“the result of the script together with the proposed change goes instead to the reviewer”transcript, stated

privacy-preserving-processing (governance)

Nylas built an internal LLM Anonymizer to remove PII from emails before LLM processing.

“we also develop an another internal tool called llm anonymizer which help you to remove a pii from emails”transcript, stated
“I didn't have time to uh show you our llm anonymizer it's an internal tool”transcript, stated

Tradeoffs

Adoption sequence

Chose development automation and annotation milestones before production over start directly with a production-grade LLM replacement.

Rationale: Smaller, lower-risk milestones built team confidence, leadership support, and concrete evidence of value.

“I added two internal Milestone the one that is related more to using in development and the second one instead of improving our annotation workflow”transcript, stated
“don't jump immediately to work on the production grade model but let's work on some smaller use case”transcript, stated

Production LLM role

Chose LLM fallback for low-confidence emails over LLM primary path for all emails.

Rationale: Fallback captures edge cases and reduces bug tickets while preserving sub-second latency and manageable cost.

“if we actually predict that we didn't do that great so at that point we actually reprocess the email with the llms”transcript, stated
“monthly just process 1 to 3% of the email with llms which make the cost of llm reasonable”transcript, stated

Annotation workflow

Chose GPT-4 annotation replacement over two-contractor blind annotation.

Rationale: The LLM system was far cheaper and faster while avoiding weeks of delay when annotation definitions changed.

“this system actually worked out so well that we decide to completely replace the blind on assist system with the new eln notation system”transcript, stated
“saving uh 20 times money and having a system that actually was 60 times faster”transcript, stated

Model serving infrastructure

Chose Llama.cpp framework deployment over GCP Vertex AI Model Garden quick setup.

Rationale: The framework route required more build effort but supported autoscaling, model swapping, and flexibility.

“we decide to go with a second solution uh we really like flexibility and uh we uh we are using the Lama CPP framework”transcript, stated
“this solution is definitely more flexible you can choose your order it can autoscale very well uh and you can switch the model inside the same infrastructure”transcript, stated

Provider selection

Chose remove Anthropic from tested options for this use case over pay almost double for a liked model.

Rationale: Cost efficiency mattered more than raw model preference for the target use case.

“we really like it uh anthropic but when we did like a cost comparison it turned out that on our use case an Tropic was costing us almost double”transcript, stated
“an Tropic was costing us almost double so we we had to remove that”transcript, stated

Gotchas (what bit them)

LLM agents lacked full business context for many generated PRs.

Root cause: Customer exceptions and product requirements were not fully represented in the agent context.

Resolution: Keep human engineer review before merge and close unmergeable PRs.

“maybe the developer and reviewer didn't have the full context you know sometimes you make exception for a specific customer”transcript, stated
“having engineer reviewing the pr was actually giving the extra context”transcript, stated

LLM-generated PRs hallucinated.

Root cause: The developer/reviewer agents sometimes produced invalid changes despite the workflow.

Resolution: Use engineer review and close hallucinated PRs instead of auto-merging.

“we also had roughly 10% cases in which yes the llms were hallucinating”transcript, stated
“those PR were just identified by the engineer and close it”transcript, stated

LLM replacement would violate production latency expectations.

Root cause: Extract AI runs in under half a second while LLM latency tends to be seconds.

Resolution: Use LLMs only as a fallback path for low-confidence emails.

“our system is able to process an email in less than half of a second so latency with alignment that tend to be seconds”transcript, stated
“good for us we decide instead to use llm as a fullback strategy”transcript, stated

LLM cost could make product pricing impossible.

Root cause: Processing tens of millions of monthly emails through APIs would not fit fractional per-call pricing.

Resolution: Limit LLM usage to 1-3% fallback and build self-hosting economics for higher-volume use.

“we process 20 to 30 millions of email per uh per month and how much it's going to cost you process with llm”transcript, stated
“this make it impossible for your system to be sold at a fraction of a dollar per API call”transcript, stated

Cloud-provider model garden was fast to launch but operationally rigid.

Root cause: The managed option lacked autoscaling and easy model swapping within the same infrastructure.

Resolution: Use Llama.cpp/Kubernetes-style framework deployment for flexibility.

“you can deploy any model that they have available in less than five minutes”transcript, stated
“this solution is definitely more flexible you can choose your order it can autoscale very well”transcript, stated

Evaluation

Nylas evaluated adoption through a two-week model spike, operational metrics for the multi-agent PR workflow, annotation cost/time calculations, production latency and monthly volume constraints, fallback email share, bug-ticket reduction, and self-hosting break-even analysis.

Metrics: two-week spike sprint · 200+ PRs opened, roughly 50 merged · roughly 10% hallucinated PRs · weekly to daily updates: 7x latency reduction · annotation cost: $0.22 per annotation, then $0.10 with GPT-4 Turbo · 5,000-email annotation set: $1,100 LLM cost versus $10,000 blind annotation · 20x money saved and 60x faster annotation system · Extract AI latency: less than half a second · 20-30 million emails per month · 1-3% monthly emails processed by LLM fallback · bug tickets dropped more than 90% · self-hosting break-even example: 10,000 API calls

4 supporting quotes
“this two week Sprint actually helped us to limit the number that we would have test”transcript, stated
“since then we have opened more than 200 PR and of this roughly under 50 were actually merged”transcript, stated
“we ended up with this system saving uh 20 times money and having a system that actually was 60 times faster”transcript, stated
“however since we introduced this llm strategy those ticket number dropped by more than 90%”transcript, stated

Outcomes

The transcript is an internal engineering talk with ASR noise, but the operational numbers are specific enough to be useful. The main reusable lesson is not one model choice; it is the staged adoption sequence that uses low-risk internal workflows to learn before introducing LLMs into production paths.

4 supporting quotes
“those project were really small we actually saw surprising results”transcript, stated
“seeing the result and showing them the long-term investment and what would have mean for the team”transcript, stated
“we are actually having a system more stable and we also save a lot of engineering time”transcript, stated
“it has been like a good um a good thing to actually unlock more use Cas in my team”transcript, stated