Ground the recommendation in retrieved policy
Understand how RAG retrieves refund policy and distinguish its evidence from the fixed learning response of the order tool.
Question for this chapter
Which policy evidence should be found before the AI recommends a refund decision?
Understand RAG in this situation
RAG prevents the model from relying only on memory. It retrieves relevant passages from refund_policy
and places them in the response context. A high-value laptop request may need the 30-day window, the
over-$500 escalation rule, and the high-value electronics condition together.
Try it
If model credentials are configured, start a new session with the refund-approval Agent and enter a
clearly labeled learning request:
Review a refund for order ORD-DEMO-007.
The reason is defective and the requested amount is $650.
The Agent uses two tools:
get_enriched_order— returns order, customer, and risk contextsearch_refund_policy— retrieves policy passages for the reason and amount with RAG
Policy evidence can contain both auto-approval and escalation rules. A request over $500 meets a current human-review condition.
Confirm the fixed learning response
The current get_enriched_order does not query risk_assessed_orders. It preserves only the submitted
order_id and returns this fixed learning context for every session:
| Field | Fixed value |
|---|---|
| Customer | CUS-001, Kim Minjun, gold |
| Order amount | $1,299.99 |
| Past refunds | 2, totaling $1,549.98 |
| Risk | 0.52, medium |
The ORD-DEMO-007 session is therefore a runtime demonstration, not a lookup that verifies the
12-row batch output from the previous chapter.
Next decision
You have order context and policy evidence for an AI recommendation. Next, confirm that no downstream Actor runs before a person approves the decision.