TechExplainedTechExplained
|
Use CaseDomain: Microsoft FoundryIndustry: Retail

Retail: Customer service agent with tools on Microsoft Foundry

An e-commerce retailer replaces separate scripts with a single agent that looks up order data and consults return policy, published into the service team.

TechExplained 2 min readPublished: 26 juli 2026
Microsoft FoundryAzure AI SearchMicrosoft Entra ID
#agents#tools#grounding#prompt injection
Team discusses the architecture of a Foundry customer service agent with order system and return policy integrations on a screen

Business challenge

An e-commerce retailer received a high volume of repeat questions about order status and return policy, handled by a collection of separate scripts and an outdated knowledge base. Answers were inconsistent between agents, and every policy update required a manual change in multiple places at once.

Architecture

A single agent on Foundry Agent Service combines two kinds of knowledge: the order system through an OpenAPI tool for current order status, and return policy through a RAG connection to Azure AI Search for policy questions. The agent decides for itself which tool is needed based on the question, instead of an agent having to know which system applies to what. The deployment uses serverless capacity because volume varies strongly throughout the day, with prompt caching so repeated context parts are not reprocessed every time.

Why this choice

One agent with tools and grounding replaces the separate scripts with a single point of maintenance: return policy is updated in one place and works through immediately in every answer. Serverless capacity fits the strongly variable volume of a service channel, where fixed capacity for peak moments would cost unnecessarily outside those peaks.

Alternatives

Extending the existing collection of scripts with even more separate rules was possible, but would have increased the maintenance problem instead of solving it. A fully human service team for all repeat questions remained an option, but did not address the core problem (inconsistency, slow turnaround under volume).

Trade-offs

  • One agent with multiple tools requires careful tool-selection logic; a wrongly chosen tool gives an answer that sounds convincing but is wrong.
  • Serverless capacity fits variable volume, but gives less predictable latency than Provisioned Throughput during unexpected spikes.
  • Prompt caching speeds up repeated interactions, but requires attention at policy changes: a stale cache must never produce a stale answer.

Microsoft products

Microsoft Foundry (Foundry Agent Service, OpenAPI tools, content safety), Azure AI Search (grounding on return policy), Microsoft Entra ID (Entra Agent ID and access control).

Best practices

  • Give the agent least-privilege tool scopes: access to order data is not the same as access to modify an order.
  • Turn on prompt shields against prompt injection through customer input, since customer messages are an untrusted source.
  • Give the agent an Entra Agent ID and audit every tool action, so a disputed order can be traced to the exact agent step.

Lessons learned

In the first version, a customer could, through a carefully worded message, coax the agent into reasoning outside return policy. After turning on prompt shields and tightening the system instruction to answer exclusively from the linked policy, this behavior disappeared without degrading legitimate questions.

Architecture at a glance

Click a component for details

Foundry agent

Order system (OpenAPI)

Current order status, retrieved via an OpenAPI tool.

The agent picks the right tool per question itself; prompt shields protect against manipulation through customer input.

Retail: Customer service agent with tools on Microsoft Foundry | TechExplained