Why AI agents need real-time context
Real-time context for AI agents is the current state of what a user is doing, such as the pages they viewed, the forms they sent and the steps that failed, computed from events and readable while the user is still there. Without it, an agent answers from the conversation and from records loaded earlier, so it asks for details the user just gave or recommends what they just turned down.
What is real-time context for an AI agent?
Real-time context for AI agents is the current state of what a user is doing, computed from the events they generate and readable by the agent while they are still there. It covers the last few actions and when they happened, the screen in view, a form just sent, a step that failed. An agent reasons over what it is handed, so if the newest thing it can see happened yesterday, it answers for the user as they were yesterday.
What is agentic context covers what goes into the picture an agent reads. This page is about timing: what breaks when that picture is late, where a current one comes from, and how it reaches the agent.
What goes wrong when an agent’s context is out of date?
The failures are small and specific, and customers notice every one of them.
It asks for what the user already gave. A customer fills in a support form: account email, the invoice in question, “charged twice”. The form opens a chat. The agent’s first message asks for the account email and a description of the problem. The form went to a ticketing system that syncs to the agent’s data source on a schedule, so the answer exists, just not where the agent looks yet.
It recommends what the user just walked away from. A customer downgrades from the Team plan to Starter, then asks the in-app assistant how to export their reports. The assistant reads an account record loaded before the change, sees a Team customer, and suggests a Team feature, with a nudge to “make the most of your plan”. The customer reads it as an upsell for the plan they left ten minutes ago.
It misses the step that failed. A payment is declined twice at checkout, and the customer opens the chat. Without the session, the agent asks for an order number that does not exist, because the order never completed. What is a customer-facing AI agent walks through this case in full.
In each case the model did its job. It answered correctly for a user who no longer exists. A better prompt does not help, because the fact the agent needed is not in anything it was given.
Where does an agent’s context come from, and how fresh is each source?
Most agents assemble context from several sources, each current to a different moment. The question to ask of each one is: when did the newest fact in it happen?
| Source | Current as of | What it knows about this user | What it lags behind on |
|---|---|---|---|
| Conversation only | This chat, as typed | What the user has said so far | Everything they did and did not mention |
| Conversational memory | The end of past chats | Preferences and decisions stated before | Actions taken outside the chat |
| CRM or warehouse record | The last sync or job, which may be minutes or a day | Account, plan, orders, as last loaded | Anything since that load |
| Retrieval over documents (RAG) | The last index | Policies and product docs, nothing per user | This user entirely |
| Live behavioral attributes | Each event, as it arrives | What the user did this session and recently | Facts nobody tracks as events |
No single row is enough. The CRM record says who the customer is, retrieval supplies the policy, memory holds what they said last month. The live row is the one that knows about the form, the downgrade and the declined card, because each of those was an event minutes ago. Context engineering covers how to choose between the rows for a given step.
How does real-time context reach the agent?
There are three moving parts: events, attributes computed from them, and a way for the agent to read the result.
- An event stream. The app records what users do as events:
plan_changed,support_form_submitted,checkout_error. Server events matter as much as browser ones, since a plan change is usually confirmed by your billing system, not the page. - Attributes per user or session. Raw events are too long and too noisy to hand a model. An attribute is a value computed from events about one key, such as “the plan this user moved to in the last day” or “payment failures this session”. It is updated as each event arrives, so it is ready before the agent asks.
- Delivery to the agent. Either the code around the agent injects the values into the system prompt before the first turn, or the agent calls a tool that returns them when it decides it needs them. Injection guarantees the agent sees the state; a tool call keeps it out of the window until it matters. A tool can be a function in your agent framework or a server that speaks the Model Context Protocol, “an open-source standard for connecting AI applications to external systems”, so any client that supports MCP can call it.
How current the result is depends on step 2. The figure to ask any vendor or internal team for is the time from an event arriving to the attribute that counts it being updated, measured separately from how long a read takes. A fast read of a value computed by last night’s job is still last night’s value. What is feature freshness covers how to measure that gap.
Example: an agent tool that returns live account state
Take the downgrade case. The assistant should know what plan the customer moved to today and whether they sent a support form in the last hour. Defined as attributes keyed on the logged-in user, in the Snowplow Signals Python SDK, that is:
from datetime import timedelta
from snowplow_signals import Attribute, Event, EventProperty, StreamAttributeGroup, user_id
plan_changed = Event(name="plan_changed", vendor="com.example", version="1-0-0")
support_form_submitted = Event(name="support_form_submitted", vendor="com.example", version="1-0-0")
plan_changed_to_1d = Attribute(
name="plan_changed_to_1d",
type="string",
events=[plan_changed],
aggregation="last",
property=EventProperty(vendor="com.example", name="plan_changed", major_version=1, path="to_plan"),
period=timedelta(days=1),
)
support_form_topic_1h = Attribute(
name="support_form_topic_1h",
type="string",
events=[support_form_submitted],
aggregation="last",
property=EventProperty(vendor="com.example", name="support_form_submitted", major_version=1, path="topic"),
period=timedelta(hours=1),
)
# Billing sends plan_changed from the server, so the key is the user id rather than the browser.
saas_assistant_live = StreamAttributeGroup(
name="saas_assistant_live",
version=1,
attribute_key=user_id,
owner="you@example.com",
attributes=[plan_changed_to_1d, support_form_topic_1h],
)
The agent gets a tool that reads them. The docstring is what the model sees when it decides whether to call it:
def get_live_account_state(user_id: str) -> dict:
"""What this customer changed or sent in the last day: plan changes and support forms."""
return sp_signals.get_group_attributes(
name="saas_assistant_live",
version=1,
attributes=["plan_changed_to_1d", "support_form_topic_1h"],
attribute_key="user_id",
identifier=user_id,
)
# {"plan_changed_to_1d": "starter", "support_form_topic_1h": "duplicate_charge"}
With that result, the assistant answers the export question for a Starter customer and skips the Team suggestion. If the form topic is set, it opens with the duplicate charge instead of asking what is wrong. Which of those it does, and how it words it, stays in your prompt and your rules. How agents act on live customer behavior covers what comes after the read.
When does an agent not need real-time context?
When nothing the user does mid-session changes the right answer. An agent that answers general product questions from documentation, or one that runs a nightly report, does well on retrieval and batch data. The case for live context grows with how often users act just before they ask: support after a failed step, shopping after a run of views, onboarding after a stuck setup.
Where Signals fits
You can build the event stream, the streaming computation and the read API yourself, and many teams do. Snowplow Signals is one option for that part: an SDK collects the events, Signals computes attributes like the ones above as events arrive, and an agent reads them, or the session’s recent events as an agentic context in JSON or narrative, over the Python or Node.js SDK, a REST API or an MCP server. Its update and read figures are on real-time attributes, and the agentic contexts documentation covers the session window. Signals does not replace your CRM or hold your policies, though a warehouse table such as plan tier can be served beside the live attributes as a warehouse attribute. It does not decide what the agent says.
The rest of the AI agents and memory topic covers memory, context engineering and customer-facing agents.
See it on your own traffic
Add the SDK, define one attribute, and see an attribute updating against your own traffic in the first session. The free tier runs on the real engine: no card, no sales call.