cd /news/ai-agents/i-added-a-context-resolver-before-an… · home topics ai-agents article
[ARTICLE · art-16107] src=dev.to pub= topic=ai-agents verified=true sentiment=· neutral

I added a context resolver before an AI sales agent replies

A developer building an AI reception agent for chat-driven commerce added a context-resolution step before the AI model generates a reply, preventing the system from acting on ambiguous or conflicting signals. The resolver first determines the most trustworthy commercial context—such as campaign source, CRM stage, or approved sales rule—and outputs a structured object with a confidence level and directive before the model writes a response. This control layer reduces ambiguity, makes replies traceable, and ensures the AI agent's decision is based on a resolved commercial priority rather than raw prompt interpretation.

read2 min publishedMay 28, 2026

Most AI sales agents fail before the model writes a single word.

The failure is not always the prompt. It is usually the context.

In a real chat-commerce workflow, a lead can arrive with several competing signals:

If all of that gets dumped into a prompt, the model may produce a fluent answer based on the wrong clue.

That is not an AI problem in the abstract. It is an operating-system problem.

I was designing an AI reception agent for a chat-driven commerce operation.

The goal was simple: help the business reply faster and more consistently without losing the commercial context behind each lead.

But the first automated reply had a hidden risk.

A customer might send a short message like "hi" or "I want more information." On its own, that message is weak. The stronger signal may be the campaign, source, CRM stage, product page, previous conversation or approved sales rule.

If the AI agent receives all possible context at once, it still has to decide what matters.

That decision should not be left entirely to generation.

I added a context-resolution step before the AI response.

Instead of asking the model to inspect every clue and improvise, the workflow first resolves a smaller object:

{
  "source_priority": "campaign_or_crm_or_message_or_fallback",
  "category": "resolved_commercial_category",
  "confidence": "high_or_medium_or_low",
  "selected_directive": "one_approved_response_rule"
}

The important part is not the exact schema. It is the order of decisions.

The system first decides which commercial context is most trustworthy. Only then does the AI agent write the reply.

The workflow looks like this:

The resolver is intentionally boring.

It is a control layer, not a creativity layer.

It exists to answer questions like:

In business workflows, "more context" is not always better.

More context can mean more ambiguity:

The context resolver reduces that ambiguity before the model responds.

The AI layer becomes easier to debug because every reply can be traced back to a chosen context, confidence level and directive.

The workflow keeps several guardrails around the AI response:

This is not about making the AI sound more impressive.

It is about making the operational decision safer.

The current public version keeps metrics as metrics to collect

, because I do not want to publish numbers that are not validated.

The useful metrics would be:

For AI agents in revenue workflows, the prompt is only one part of the system.

The harder design question is:

What should the model be allowed to know, trust and act on?

That is why I prefer designing AI agents as operating workflows: context resolution, retrieval, guardrails, structured outputs, human review and observability.

The public case study is here:

https://github.com/rkrisa/portfolio-ai-ops/tree/main/cases/context-aware-ai-reception-agent

── more in #ai-agents 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-added-a-context-re…] indexed:0 read:2min 2026-05-28 ·