Skip to main content

Coordinating RAG Retrieval and Business Tool Calls: Static via Retrieval, Dynamic via API

· 4 min read
Jack Ning
Maintainer of Bytedesk

"Where is my rider?"—if the AI agent answers with a three-day-old delivery note from the knowledge base, the answer is guaranteed wrong. Order status, rider location, inventory counts—this information changes every second; refund policies, check-in rules, after-sales processes may change once every few months. Mixing these two kinds of information into one retrieval store is one of the most common architecture mistakes in smart customer service.

This is the seventh article in an experience-sharing series on "AI customer service product and engineering practice," drawn from hands-on practice as an AI Product Manager focused on IM intelligent customer service at a local-life services platform. In this post I want to share how to design the coordination between RAG retrieval augmentation and business tool calls when smart customer service must integrate merchant knowledge bases, platform rules, order data, and real-time fulfillment information simultaneously—solving knowledge-update lag, retrieval conflicts, and inaccurate model generation.

The design condenses to one sentence: static via retrieval, dynamic via API. But the boundary division, conflict resolution, and traceability mechanisms behind that sentence are where the real work lies.

Illustration: Keeping static retrieval in sync with live business data

Three Key Points in RAG–Tool Coordination​

  1. Understand the applicable boundaries of RAG vs. Tool Use—which knowledge should be retrieved and which facts must be queried.
  2. Design knowledge freshness management and multi-source conflict resolution, handling cases where platform rules contradict merchant claims.
  3. Control hallucination through result verification, making answers traceable rather than model free-styling.

Overall Approach​

Step 1: Draw the Boundary Between RAG and Tool Calls​

Static/quasi-static knowledge (policies, rules, FAQ) goes through RAG; dynamic facts (order status, rider location, inventory) must be queried in real time through business tools—using stale retrieved data is forbidden.

This is the fundamental cure for "knowledge update lag": not making retrieval faster, but keeping volatile information out of the retrieval store entirely. The model must never answer "where is my rider" from stale cache.

Step 2: Solve Knowledge Update Lag​

  • Attach "effective time" metadata to every knowledge entry; filter out expired content at retrieval;
  • Update indexes event-driven on policy changes and invalidate old cache versions;
  • Set forced TTLs on high-churn knowledge (promotion rules); auto-offline on expiry.

One goal: users always see the currently valid version.

Step 3: Resolve Retrieval Conflicts​

A merchant claims "7-day returns"; platform rules say "30-day price protection"—such conflicts cannot simply be concatenated for the model. Rank multi-source content by authority:

Platform rules → Regional details → Merchant statements → Historical FAQ

On conflict, do not feed both answers to the model; instead pass the conflicting items plus the priority rule, require answering by authority level, and cite the source. The user gets an answer that is both definitive and explainable.

Step 4: Control Inaccurate Generation​

Enforce "answers must be traceable":

  • Generated results must cite retrieval fragments or tool returns;
  • Key numbers (amounts, times) are taken directly from structured data, not model-generated—the model organizes language, it does not produce facts;
  • Untraceable questions degrade to "human handoff / fallback scripts."

Also maintain an evaluation set for periodic regression, monitoring retrieval hit rate and factual accuracy as dual metrics.

Practice in Weiyu​

Weiyu, the open-source AI customer service system (GitHub, website), embodies this dividing line: the knowledge base module handles maintenance and vector retrieval of policies, rules, and FAQ (with Elasticsearch vector store support)—the "static via retrieval" side; the AI Agent module connects to order and ticket systems via tool calling—the "dynamic via API" side. The two coordinate under the human-AI collaboration framework: what RAG cannot answer goes to tools; what tools cannot resolve goes to human agents. The knowledge base supports category and tag management, providing extension points for authority configuration and TTL management.

Takeaways​

  • Architectural first principle: static knowledge via RAG, dynamic facts via real-time tool queries—volatile information stays out of the retrieval store.
  • Knowledge freshness rests on three tools: effective-time metadata + event-driven updates + forced TTL.
  • Multi-source conflicts resolve by authority ranking (platform → region → merchant → history), with sources cited in the answer.
  • Hallucination control hinges on traceability: key numbers come from structured data; the model only organizes language.
  • Monitor continuously with dual metrics—retrieval hit rate and factual accuracy.