Your agent evaluates a candidate against a job description. It scores them a 95% match.
There's just one problem: the job description was updated two hours ago. The hiring manager added a new required skill. But your agent's context was assembled from a nightly batch index. It evaluated the candidate perfectly — against a job that no longer exists.
If your agents are reasoning over stale data, their intelligence doesn't matter. They will make confidently wrong decisions.
The Stale Context Problem
Most RAG (Retrieval-Augmented Generation) pipelines run against batch-indexed data.
You sync your database to your vector store once a day, or maybe once an hour if you're ambitious. But your agents are making decisions every second. This mismatch in frequency means agents routinely reason over outdated context.
Event-Driven Architecture for Agents
Event-Driven Architecture (EDA) is how modern backends stay in sync. When something happens (an event), a message is published to a broker (like Kafka), and interested consumers react to it.
For agents, EDA provides a continuous stream of reality. Instead of waiting for the nightly batch job, the agent's context is updated the millisecond a business fact changes.
Batch-Indexed RAG
Event-Driven Context
The Event-to-Context Pipeline
Connecting Kafka to an LLM sounds complicated, but the architectural pattern is straightforward.
| Pipeline Stage | Component | Responsibility |
|---|---|---|
| Source | Database / API | Emits a change event (e.g., "Job Requirements Updated"). |
| Stream | Kafka / Solace | Routes the event to interested consumers. |
| Context Update | In-Memory Cache | Updates the agent's working memory or invalidates stale vector embeddings. |
| Agent Reasoning | The LLM | Evaluates the task using the newly refreshed context. |
Reactive Agents
The true power of EDA isn't just keeping context fresh — it's enabling reactive agents.
Instead of an agent passively waiting for a user prompt, it is triggered by the event itself.
- The hiring manager updates the job description.
- The
JobUpdatedEventfires. - The Re-evaluation Agent wakes up automatically.
- It pulls the 50 candidates in the active pipeline and re-scores them against the new requirement.
- It flags three candidates who no longer meet the bar.
The Consistency Challenge
Real-time doesn't mean perfect consistency. If you've built event-driven systems before, you know the pain of out-of-order events and eventual consistency.
If an agent receives a CandidateHired event before the OfferAccepted event because of a network hiccup, its reasoning might break. Agents are particularly susceptible to partial state updates. If an agent begins a complex reasoning task while the underlying data is mutating beneath it, the resulting output will be schizophrenic.
When Batch is Still Fine
Not everything needs to be real-time.
Static reference data, historical benchmarks, training corpora, and long-term company policies rarely change. Forcing this data through an expensive, complex event-streaming architecture is a waste of engineering bandwidth.
// key takeaway