LyraLearn AI Learning Platform
Exams
← Module 15 Β· Enterprise AI Architecture
🎧 Listen

Integration Patterns

An AI feature is only as good as the content behind it, and that content lives in other systems β€” a CMS, SharePoint, a partner API, your own transactional tables. The architect's job is to keep the AI's knowledge fresh, consistent, and cheap to maintain as those sources change. That means choosing the right integration pattern for each kind of change, rather than re-embedding the world every night and hoping.

Content changes reach the AI index through an instant webhook path and a nightly reconciliation sweep, with a transactional outbox and worker re-embedding only the changed chunk.

Syncing external content: webhooks plus reconciliation

There are two ways to learn that source content changed, and a robust system uses both:

Webhooks keep you current minute-to-minute; reconciliation guarantees you're never quietly stale. Neither alone is enough for an enterprise.

Durable async work: the outbox and a queue

Re-indexing is slow and failure-prone β€” it chunks text, calls an embedding model, and writes vectors. You must never do that inline on a web request, and you must never lose the work if a process restarts mid-batch. The pattern is the transactional outbox:

  1. The webhook handler (or reconciliation job) writes an outbox row β€” ReindexLesson(lessonId) β€” in the same SQL Server transaction as any business update. The intent to re-index is now as durable as the data itself.
  2. A background ingestion worker polls the outbox (or a queue fed from it), processes each message, and marks it done only after the embeddings are committed.
  3. Failures retry with backoff; poison messages move to a dead-letter table for a human.

Because the outbox commits atomically with the data, you can never end up with updated content and a lost re-index, or vice versa. The pipeline is at-least-once and idempotent β€” running a message twice produces the same vectors.

Re-process only what changed

The cardinal efficiency rule: embed deltas, not everything. Embedding is the expensive step, so before re-indexing, compare the new content hash to the stored one β€” if it matches, skip the work entirely. Chunk content stably (by heading or paragraph) so an edit to one section only invalidates that section's chunks, leaving the rest untouched.

In LyraLearn, editing a single lesson's markdown fires one webhook, writes one outbox row, re-embeds only that lesson's changed chunks, and leaves the other thousands of vectors alone. Costs stay proportional to change, not to catalog size β€” which is exactly what makes the system affordable to keep current.

🧠 Quiz yourself on this lesson →

Ask the AI Tutor

Grounded in the course lessons β€” it cites its sources and says when it doesn't know.