The AgentivUse cases

Customer service · About a week · Thailand

The AI never sees your customers' ID numbers

A guard on your own server detects Thai national ID numbers, phone numbers, bank accounts and six other kinds of personal data in customer messages before the AI customer service agent reads them, masks or tokenises each kind by a policy you set, releases a real phone number only to the tool that sends an OTP, blocks any message with a card number, and the owner reviews what was flagged

The problem

Thai customers type their ID number, phone number or bank account straight into a chat, and an AI agent that reads the chat sends all of it to a model, into tool calls and into logs. Under PDPA you are responsible for every copy, and most shops only find out where the numbers went when someone asks.

Architecture

  1. Channel
    • Customer chat channel
    • Guard on your server
  2. Agent
    • Reads masked message
    • Answers the customer
    • Calls OTP tool with token
  3. Tools
    • Policy file per data type
    • Token store with expiry
    • Audit log without values
  4. Human
    • Owner reviews flagged messages

Where the data stays: Detection runs on your own server with no network call; the model sees tokens and labels, the token store holds real values until expiry and must be guarded like a secret, and the audit log never holds a value.

Design flow

  1. Customer message arrives on your server
  2. Guard detects 9 data types and acts per policy
  3. Card number found: message blocked, nothing sentOnly sometimes
  4. Agent answers from masked text; OTP tool resolves token
  5. Reply to customer shows tokens masked
  6. Owner reviews flagged and blocked messages, tunes policyHuman checkpoint

Setup

Total time: 5 h 45 min our estimate

  1. 45 min

    The README says the CLI never prints a value and runs on Node only. This step shows you which data types your customers actually send before you write a policy.

    Done when: You exported a week of chat history (JSONL, CSV or a LINE OA export), ran the CLI on it, and have a count per data type without a single real value printed.

  2. 1 h

    The example policy tokenises phones (only otp_send may resolve them), labels ID numbers, shows bank accounts as last 4 digits and blocks card numbers. Start from it and change only what your business needs.

    Done when: A JSON policy sets one of redact, mask, tokenise, hash, flag or block for each of the nine types, and the owner can say in one sentence why each choice was made.

  3. 1 h 30 min

    The example's README recommends setting your own AI_GATEWAY_API_KEY, says the default placeholder channel auth must be replaced before customers use it, and notes the OTP sender is a stub that only logs what it would send.

    Done when: The example in examples/pdpa-agent runs with eve dev on eve 0.80.x, calls Claude Haiku 5.5 through the AI Gateway with your own key, and a test message with a phone number shows the model a token, not the number.

  4. 2 h

    The README says eve's HTTP channel is not masked on the way out and that a broken token store fails closed, so test both: a reply containing a token and a deliberately broken store.

    Done when: Your channel (the example says LINE, Telegram or Slack channels can be wrapped the same way) goes through pdpa.channel, the token store is a guarded Redis with expiry set, and a missing key stops the agent from starting.

  5. 30 min

    Done when: Once a week the owner reads the audit log's flagged and blocked entries (counts and types, never values), checks for customers who were blocked wrongly, and adjusts the policy or the cue words.

Ticks are saved on this browser.

Download the kit (zip)

Starter prompt

Written from how the use case works and its sources. Replace the parts in square brackets.

You are the customer service agent for [your shop]. Messages reach you after a privacy guard has run: some values arrive as tokens like [tok:...] or as labels like [national ID], [licence plate] or a bank account shown as last four digits only. Treat a token or label as the customer's real value: never ask the customer to repeat the full number, never try to guess or reconstruct it, and never write it into notes. When a step needs the real phone number, such as sending an OTP, call the OTP tool with the token and let the tool resolve it. If a message was blocked because it contained a card number, apologise, explain that we never accept card numbers in chat, and point the customer to [your payment link or counter]. Answer in Thai, politely, in no more than four sentences, and hand over to a person for [refunds, complaints, anything about a specific order you cannot see].

Risks and data

Data

The guard reduces copies of personal data but creates one sensitive place: the token store, which holds real phone numbers until tokens expire. Keep it on your own infrastructure, set the shortest expiry the job allows, guard its credentials like any secret, and remember names and addresses are not detected yet, so the model may still see those.

How it goes wrong

Two ways it goes wrong: a real ID number written without the cue word slips past as plain digits, or a valid looking 13 digit order number is blocked and a customer gets no answer. You notice the first in the weekly review of what the model saw, and the second when a customer complains in another channel. The README calls its accuracy figures an upper bound, so test on your own old chats before you trust the counts.

Data protection. This use case touches personal data, so check the rules where you operate (for example GDPR, PDPA). This use case is about PDPA: ID numbers, phone numbers, bank accounts and the other six types are personal data, and the guard reduces how many copies exist. It does not make you compliant on its own; the project says so itself. You still need a lawful basis for the chat, a retention rule for the token store and the chat history, and a way to answer a customer who asks what you hold.

How the agent works

  1. It starts

    A guard runs on your own server between the customer channel and the AI agent; the open source project says no AI is involved in the detection and nothing goes over the network.

  2. The agent works

    Every inbound message is cleaned first (Thai and full width digits become ordinary digits, invisible characters inside numbers are removed), then checked for nine types of personal data: national ID, phone, email, bank account, credit card, LINE user ID, licence plate, date of birth and passport number, each with a confidence score from checksums (mod 11 for the ID, Luhn for cards), patterns and cue words such as เลขบัญชี. A JSON policy file sets one action per type: redact, mask, tokenise, hash, flag or block. In the example agent a phone number becomes a token the model can pass around but not read, and only the tool that sends an OTP can swap it back, for that purpose, in the same chat, for five minutes; bank accounts show the last four digits, an ID number becomes the label [เลขบัตรประชาชน], and a credit card number stops the whole message. Replies going back to the customer show tokens masked like xxx-xxx-7777. An audit log records what was found and done, never the value.

  3. The result

    The owner reviews the flagged and blocked messages and tunes the policy.

Worked example

eve-pdpa-extension is an MIT licensed open source project published by mintelligence-dev (copyright 2026 M Intelligence), with 186 commits and the newest ones on 25 November 2026 adding Express, Hono and Next.js middleware (GitHub, opened 26 November 2026). Its README states the job as detecting and protecting Thai personal data before it reaches an AI model, an AI agent, a tool, a log or a human reviewer, with the guard sitting between your customers and the AI on your own server. The pipeline is: normalise digits, detect 9 types with checksums and cue words, settle overlapping matches, act per policy (redact, mask, tokenise, hash, flag or block), swap a token back only for an allowed purpose in the same session before expiry (at most 3600 seconds), and audit without ever storing a value. The example agent, built for a fictional Thai shop, turns phone numbers into tokens that only the otp_send tool may resolve for 5 minutes, shows bank accounts as the last 4 digits, labels ID numbers, LINE user IDs, licence plates, birth dates and passports, fingerprints emails and blocks any message with a credit card number; its token store holds real values until tokens expire, so the README says to guard it like any secret. No named business is using it yet, the Used by section is empty, and the README says it is a technical tool, not a certification of compliance with Thailand's PDPA.

The project's example agent runs on the eve agent framework (eve 0.80.x only, not 1.x yet) and calls Claude Haiku 5.5 through Vercel's AI Gateway, which is why Claude is the tag; the guard itself is model agnostic, so OpenAI and Gemini are listed for a build that calls another model. The core library has no dependencies and runs on Node 18.18 and later, Deno, Bun, Cloudflare Workers and browsers; the CLI scans old chat exports (JSONL, CSV, LINE OA); middleware for Express, Hono and Next.js was being added in the newest commits and the README said it was not yet on npm. Names and addresses are not detected yet, eve's HTTP channel is not masked on the way out, and the README calls the accuracy figures from synthetic data an upper bound.

Join the Agent OS Club

Get hours back with a team of AI agents for every department, set up step by step for the tools you use, with a person answering your questions. Founding member price: USD 14.95 a month or USD 150 a year, locked for as long as you stay. Cancel any time.

Founding offer, ends 31 December 2026 or at member 100

Join the Agent OS Club

Building this for an organization? Learn more at theagentiv.com

Sources

Published: 2026-11-26

Related use cases

Members pick Video

A second agent watches every coaching turn

A coaching agent on Claude runs a 10 minute guided onboarding conversation grounded in the company's own curriculum while a second agent checks every turn for clinical risk and off topic drift and opens a Zendesk ticket with a risk level and a summary; the human coaches follow up by severity

Customer serviceEffort: A project
ClaudeZendeskAlso works with:OpenAIGemini

A coaching, wellness or advisory business wants an assistant to welcome new clients and answer first questions, but one wrong answer about a health or money matter is unacceptable, and a single model asked to be warm, on topic and vigilant at the same time does neither well. Human coaches cannot read every chat, so the risky ones must find them.

Members pick Video

A second agent checks every support answer

One support agent instead of one per topic: it works out the issue from hundreds of topics, loads the team's playbooks from a repository, drafts the answer, a peer review agent checks it is grounded in approved sources before the customer sees it, and anything that fails goes to an engineer with notes

Customer serviceEffort: A project
Copilot StudioDynamics 365 Customer ServiceAzure DevOps

A support team that builds one bot per topic ends up with a dozen narrow agents, each needing its own build and update, and a customer whose problem sits between two topics gets routed badly. The same team cannot afford a person to read every automated answer before it goes out, so either the bot answers unchecked or it answers almost nothing.

Ask which LINE chats are waiting

An MCP server that lets Claude work your LINE OA Manager inbox the way an admin does: which chats are waiting, what the customer wrote, what the payment slip shows, and a drafted reply that goes out only after the staff member says OK

Customer serviceEffort: An afternoonThailand
ClaudeClaude CodeLINE

LINE's Messaging API is built for bots: it cannot see the chats already in LINE OA Manager, their history, or search them, so most AI add ons replace the admin with an auto reply instead of helping the admin. Meanwhile the admin scrolls the chat list to find who is still waiting, opens chats one by one to see whether anyone else reported the same problem, and opens every payment slip by hand.