Best Way to Build a Customer Support AI Agent That Checks Order Status
A support agent should see order status, shipment and tracking, not every column. Typed answers drive the reply. Refunds above the limit wait for a person.
Claix · November 2026. Related guides: automate refunds with limits, safe Supabase access, and n8n. Product: Claix Retrieve and Claix Guard.
A customer support agent needs live data. It needs to answer “Where is my order?”, “Has my payment been processed?”, “Can I change my delivery address?” and “Can I get a refund?” That means access to a database. It should not have access to every order, every customer or every column.
This guide explains how to build that agent with typed answers, scoped tables and columns, and escalation to human approval.
Why a support agent needs a database
A support agent that only uses a knowledge base can answer general questions. It cannot answer questions about a specific order. The live data it needs may include order status, delivery date, tracking number, payment status, customer contact details, refund eligibility and return status. It needs enough to help the customer. It does not need the entire database.
The two halves of the problem
| Problem | What it controls | What Claix provides |
|---|---|---|
| What can the agent read? | Tables, columns, rules and answer format | Claix Retrieve |
| What can the agent change? | Inserts, updates and deletes | Claix Guard |
What Claix Retrieve does
Claix Retrieve connects to a relational database and lets the support agent retrieve only the tables and columns you allow, within the rules and limits you define. It does not copy your data into a vector store. The agent queries the database where the orders live. A smaller retrieval surface means less exposure if a prompt is manipulated.
Routes define what an agent can read
A route specifies tables, columns and a guide with your rules and vocabulary. You create it once and attach it to as many agents as you need. For support, that might be orders, customers, shipments, returns and refunds. It does not need every table.
Agents define who can access what
An agent is the identity that uses one or more routes. It has its own endpoint, business prompt, attached routes and response mode. A support bot and an internal assistant can share the same database while seeing different data. Give the support agent the narrow set.
How to call Claix Retrieve from n8n
n8n calls POST https://claix.dev/retrieve/{agent_name} with an x-api-key header. Each question can include a format. The response mode is set on the agent, not in the body.
{
"questions": [
{ "question": "What is the status of order 4821?", "format": "string" },
{ "question": "Has order 4821 been shipped?", "format": "boolean" },
{ "question": "What is the tracking number for order 4821?", "format": "string" }
]
}The response fields are user_ask, ia_response and log_id. ia_response follows the question order, so the workflow can read status, then the shipped boolean, then the tracking number. Use log_id in Traces. The same call works from Make, Zapier or your own backend. Docs: call an agent.
What you get back
| Mode | What you get |
|---|---|
| Raw | JSON rows returned by the database |
| Reasoned | A single typed value per question |
In raw mode, each answer is the JSON rows. In reasoned mode, each answer matches the format you requested. A support workflow usually wants reasoned values: a string status, a boolean, a tracking number.
What typed answers mean
The agent often has to decide from a specific value: is this order shipped, is this payment processed, is this return eligible, how many refunds has this customer received. Typed booleans, numbers, lists and JSON objects let the next step branch without parsing a paragraph.
Why scoped tables and columns matter
The agent may need order status, delivery date, tracking number and customer contact details. It may not need payment details, internal notes, salary information, another customer’s data, or every column on the orders table. Scoped tables and columns reduce what a prompt injection can pull into the reply. Tenant isolation still belongs in the database, with row-level security where people share a table. Do not let the prompt decide which customer the agent is serving.
How to control writes
If the agent updates an address, a status or a refund record, Guard checks the proposed INSERT, UPDATE or DELETE against rules you approved. Allowed means your code can execute it. Denied means it should not, and the agent receives the reason. Claix does not execute the statement. n8n or your backend does, with its own credentials. A denial is still HTTP 200. Read allowed.
In n8n, add an HTTP Request node that calls POST /check-sql before the node that writes. If allowed is true, the next node runs the statement. If it is false, stop or return the reason.
What Guard can enforce
| Control | What it prevents |
|---|---|
| Operation type | Unwanted inserts, updates or deletes |
| Target table | Changes to tables outside the agent’s scope |
| Target columns | Changes to sensitive or protected fields |
| Record selection | Updates or deletes that affect too many records |
| Value limits | Discounts, quantities, amounts or statuses outside allowed ranges |
| State transitions | Invalid changes from one status to another |
| Rate limits | Too many changes in a short period |
| Human review | High-risk actions that require approval |
| Audit trail | Missing evidence of what was proposed and decided |
- Agents can create and update orders, but never delete them.
- Agents can update an order status, but never its price.
- Discounts cannot exceed 20 percent.
- Refunds above a threshold require human review.
- An update or delete must target a specific record.
- Certain status transitions are not allowed.
- The number of refunds per hour is limited.
How to escalate to human approval
A routine status update can usually run automatically. A destructive operation should usually be denied. A refund above a threshold, a large discount, a change to a sensitive customer field, an update that affects more rows than expected, or a deletion on a protected table can be legitimate and still deserve a person.
Guard returns needs_approval for those cases. allowed is false, so the support workflow must not run the statement. Claix can post the SQL to Slack with Approve and Reject. The button calls your endpoint. That endpoint runs the change or tells the customer the request was declined. The setup is in human approval for an n8n agent.
How to get started
Claix supports any SQL database, including Postgres, MySQL and MariaDB, plus Postgres-compatible setups such as Supabase. Connect with a read-only role. Define the support routes and the agent, then call one endpoint for live typed answers. Guard, for writes, supports PostgreSQL, MySQL and MariaDB.
Conclusion
A customer support agent needs live order data and a narrow view of it. Retrieve limits and structures what it can read. Guard checks proposed writes before they run. Traces make requests and decisions reviewable. Do not give the agent unrestricted database access.
You might also like…
Guides · Guard
Best Way to Automate Refunds With an AI Agent: Limits and Approvals
Guides · Supabase
How to Give an AI Agent Safe Access to Your Supabase Database with Claix
Guides · Guard
Human Approval Before AI Agent Writes to Database: A Step-by-Step n8n and Slack Workflow
Guides · Retrieval
Read Replica vs Production for AI Agents: When a Replica Is Enough and When It Is Not