Sorting looks like the perfect first job for an AI agent. Emails, shared-drive files and tickets arrive faster than anyone can file them, and the right category often depends on meaning, not a sender or keyword. But a sorter touches everything that comes in, and one confident mistake can bury an urgent request or move a file where the wrong people can see it.
First check whether something simpler will do: your email program’s rules, your help desk’s built-in triage, or a fixed automation with one AI classification step. If you still need an agent, build one that labels before it moves anything, sends unclear items to an “unsure” bucket, works only in an approved system, and needs your approval before it deletes, shares or moves anything out of a protected area. Test it on safe sample data, have a person review its work before anything consequential happens, and keep spot-checking after launch. Anthropic’s December 2024 agent-building guide favors the simplest workable solution, and OpenAI’s guide advises starting small, noting that a fixed, rule-following solution may suffice [1, 2]. Features and plans change, so check current vendor pages before relying on details below.
The beginner's guide to building an AI agent covers the overall path. Unlike an agent that answers from your documents, a research agent or an agent that monitors changes, this project decides where incoming information goes.
TL;DR
- Try rules, help-desk triage or a fixed automation with one AI classification step before building an agent.
- Write a handful of non-overlapping categories with definitions and examples, plus a default “Unsure.”
- Let the agent label alone; require approval to delete, share, forward or move anything out of a protected area; never grant permanent deletion.
- Read what each connector’s permission really allows, since one permission can also cover sending or deleting.
First, Check Whether a Simpler Option Is Enough
Some terms. An AI assistant replies within a conversation you steer. An automation follows steps fixed in advance: when X happens, do Y. An AI agent pursues a goal by planning its own steps, using only the tools and limits you allow. Anthropic draws a similar line: workflows follow predefined code paths, while in agents the model decides how to proceed and which tools to call [1]. Agents aren’t better by default, and for sorting one is often overkill.
| Option | Good fit | Where it falls short |
|---|---|---|
| Built-in rules or filters | Items recognizable by sender, subject, keyword or file type | Can’t judge meaning; brittle when wording varies |
| Help desk’s built-in AI triage | Tickets in a help-desk product you already use | Limited to that product’s fields, categories and plans |
| Fixed automation with an AI classification step | One predictable path: classify, then label | Same steps every time; can’t look things up or ask |
| Sorting agent | Items needing context, judgment or a choice of next step | More to set up, test and supervise |
Rules and filters. As of November 2026, Gmail filters can send incoming mail to a label or archive, delete, star or forward it [3]. Outlook rules can move, re-prioritize or delete incoming messages, and each rule needs a name, a condition and an action [4]. They run inside your email service, so no extra tool gets access, and they behave predictably.
Help-desk triage. As of November 2026, Zendesk’s intelligent triage labels new tickets by topic, sentiment and language, attaches a confidence field to each, and lets staff correct the values [5]. Zendesk says the classifications are available on Suite and Support Professional plans and above, and using them in workflows requires its Copilot add-on [5]. As of November 2026, Salesforce’s Trailhead training describes graded automation in Einstein Case Classification: it can recommend values, pre-select the best value for a person to confirm, or, in the paid version, save the value without review above a higher confidence threshold [6].
A fixed automation with an AI step. When labels depend on meaning but the path never changes, one model call per item may be enough. As of November 2026, n8n’s Text Classifier node assigns items to categories you define, each with a description telling the model what it means [7]. Make’s AI Toolkit has a “Categorize text” module that can explain its choice and be limited to one category per item [8]; Make says all plans can use it with Make’s own AI provider, while connecting your own provider needs a paid plan [8]. Zapier’s built-in AI step, AI by Zapier, includes a Classify prompt template [9]. According to Zapier’s help page updated October 28, 2026, the Free plan is marked ineligible: you can preview results but can’t publish a Zap with an AI by Zapier step [9]. BuildAIQ’s AI Automation guides, including the one on automating email sorting and follow-ups safely, cover that route.
When an agent is worth it. OpenAI’s guide says agents suit work involving complex judgment, rules that have become hard to maintain, or heavy reliance on unstructured data such as natural language and documents [2]. For sorting, that usually means the right place depends on facts the item doesn’t contain, or the next step varies: label, look something up, or ask you. If none of that applies, read when you shouldn't build an agent.
What a Sorting Agent Adds
A sorting agent has a goal (“every new item in this folder gets one category label, and nothing is lost”), tools (permitted actions and lookups, such as “apply a label” or “check the client list”) and context (what it can see during the job: the item, your category guide, lookup results). A run is one pass through a batch. Unlike a filter, it picks its next tool itself: it might read a scanned invoice, check the vendor list, label it “Invoices – to approve” and note anything it can’t match. That flexibility is why it needs tighter boundaries; see giving an agent a clear goal, instructions and boundaries and building your first agent without coding.
Step 1: Pick One Source and a Safe Starting Area
Start with one inbox label, one “Incoming” folder or one ticket queue, not your whole mailbox or drive. Assume the items are sensitive: inboxes, shared files and tickets routinely hold personal details, client material, HR matters, health information and financial records. The OWASP security community warns that AI applications can leak personal and financial data, health records, credentials, legal files and confidential business material [10]. Connect only a tool and account your organization has cleared for this data, and ask first if you’re unsure.
Step 2: Write a Category Scheme With an “Unsure” Bucket
Give each of a handful of categories a one-line definition, two or three examples and a note on what does not belong. Avoid overlap: if two colleagues would argue about where an item goes, the agent will struggle too. In a 2023 PNAS study, ChatGPT’s labeling accuracy was moderately correlated (r = 0.46) with how often trained human annotators agreed with each other, which the authors read as better performance on easier tasks [11]. It used gpt-3.5-turbo on tweets and news articles about content moderation, so treat it as a hint, not a guarantee [11].
Always include an unsure category and make it the default. Some tools do something else: as of November 2026, n8n’s Text Classifier drops an item by default when the model finds no clear match, unless you switch on an option that sends it to a separate “Other” branch [7]. A dropped item is worse than an unsorted one: nobody knows it’s missing.
Some labels are themselves sensitive, such as “medical leave.” The UK’s Information Commissioner’s Office says that under UK GDPR, data inferred about health and other special categories counts as special category data if you intend to make that inference, however confident you are that it’s right [12]. Rules differ by country, so check with whoever handles privacy for your organization, and prefer neutral labels such as “HR – restricted.”
Step 3: Decide What the Agent May Do Alone and What Needs Approval
Sort every action into a tier before connecting anything. A permission is the access you grant the agent in a connected app; an approval is a person saying yes before a specific action runs.
| Tier | Example actions | Rule |
|---|---|---|
| Alone | Read, apply or change a label or tag, add a note, suggest a folder | Allowed and logged |
| Alone, inside a working area | Move or file within folders or labels you created for the agent | Only where the move is easy to undo and doesn’t change who can see the item |
| Needs approval | Delete, share, forward, reply, or move out of a protected or shared area | Agent proposes; a person approves |
| Never | Permanent deletion, changing sharing settings, emptying trash | Not granted |
OWASP warns against agents with functions they don’t need, such as a tool meant to read documents that can also modify and delete them, and recommends that a person approve high-impact actions first [13]. OpenAI’s guide says actions that are irreversible, sensitive or high stakes should trigger human oversight [2].
App permissions often bundle more than you want. Google’s Gmail API page, last updated September 10, 2026, says the gmail.modify scope allows reading, composing and sending email, though not immediate permanent deletion [14]. Microsoft’s Graph page, last updated September 14, 2026, says Mail.ReadWrite allows creating, reading, updating and deleting mail, though not sending [15]. As of November 2026, SharePoint’s help says Edit permission on a shared folder lets people move, rename, share and delete what’s inside, so an agent acting through an account with Edit can do the same [16]. Check what each connector requests, and use your tool’s approval step for that tier. As of Zapier’s October 2026 help pages, AI by Zapier can require approval before a specific tool runs [17], though adding tools needs a paid plan [9]. n8n’s documentation describes pausing an AI Agent so a person can approve or deny a tool call, such as deleting data [18]. See making an agent ask before it acts and giving an agent access to tools without too much control.
Step 4: Keep Every Action Reversible
Labels are safest, because removing one undoes it. Deletion is reversible only for a while: as of November 2026, deleted Gmail messages stay in Trash for up to 30 days before permanent deletion [19], and OneDrive keeps deleted items for 30 days on personal accounts or 93 days on work or school accounts unless an administrator changed that [20]. Treat that window as a safety net, not a plan.
Moving is underestimated. As of November 2026, a Google Drive file moved out of a shared folder loses the permissions it inherited there and takes on the destination’s [21], and people who aren’t members of a shared drive could lose access to content moved into it [22]. That’s why such moves need approval.
Keep a log of every action: item, old and new location or label, time and the agent’s stated reason. OWASP’s agent security cheat sheet recommends logging all agent decisions, tool calls and outcomes, and letting people interrupt and roll back agent operations [23].
Step 5: Treat Confidence as a Hint, Not a Guarantee
Be wary of letting the agent act only when it says it’s sure. In a study published at ICLR 2024, researchers asked five language models, including GPT-4 and LLaMA 2, to state their confidence in words on reasoning and knowledge questions; the models tended to be overconfident, mostly giving values between 80% and 100% [24]. Prompting techniques helped, but none worked consistently best and all struggled on questions needing professional knowledge [24]. Those were question-answering tasks with older models, and we found no study measuring self-reported confidence on sorting work like yours.
Product classification scores are different: Zendesk and Salesforce attach confidence values to predictions, and Salesforce requires the threshold for saving a value automatically to be higher than the one for pre-selecting it [5, 6]. Copy that graded approach:
- High on your own test results: the agent labels alone.
- Middling: the agent suggests, and the item goes to your review queue.
- Low, or matching no category: the item goes to “unsure.”
- Anything in the approval tier: always a person, whatever the score.
Set the bars by checking how often labels at each level matched a person’s choice in testing. That is BuildAIQ’s editorial guidance, not a research-derived threshold. Also define escalation, handing an item to a person: OpenAI’s guide suggests limits on retries (repeat attempts after a failure) or actions, with escalation when the agent exceeds them, for example after repeatedly failing to understand a request [2].
Step 6: Test With Safe Sample Data
Evaluation means checking output against what a careful person would have done. Before the agent sees anything real, build a test set of 30 to 50 items resembling your actual mix, with names, account numbers and personal details replaced by made-up ones. (That size is an editorial suggestion.) Label each yourself, then compare.
Include hard cases: items fitting two categories or none, very short messages, forwarded chains, attachments without text, other languages. Run the set more than once, because models don’t always answer the same way; in the PNAS study, repeated runs agreed about 97% of the time at a low randomness setting and 91% at a higher one [11]. Consistent isn’t the same as correct, so score both.
Also plant instructions in a few items. Untrusted content is any text reaching the agent from someone other than you, such as a stranger’s email or an uploaded file. Prompt injection is when that text contains instructions the model treats as commands. Greshake and colleagues showed this in 2023 against Bing’s GPT-4-powered chat and GitHub Copilot’s code completion, systems that have since changed [25, 26], and OWASP lists it first in its Top 10 for LLM applications (2025 edition), advising least-privilege access, sign-off on risky actions and separating untrusted content [27]. A plain line telling the AI to move or forward the item is enough; the agent should flag it, not obey. See protecting an agent from unsafe instructions and untrusted content and testing an agent before you trust its work.
A few good runs don’t prove reliability; they earn a small pilot on real items with every action still reviewed.
Step 7: Set Limits and a Human Review Point
Cap each run’s items, actions and retries; at the cap, the agent stops and reports. That stop condition keeps a confused agent from relabeling a whole drive. As of its October 1, 2026 help page, Zapier pauses an AI by Zapier run for review once it exceeds its task limit (75 by default, up to 500) [17]. See setting spending, time and usage limits.
Then fix the human review point: before anyone relies on the sorting, someone works through a daily or per-run queue of “unsure” items, middling suggestions and actions awaiting approval. For closer supervision, see when an agent needs human supervision.
Three Worked Examples
These illustrate the pattern; they aren’t tested setups.
A shared team inbox. Categories: “Client request,” “Invoice or receipt,” “Meeting logistics,” “Newsletter,” “Unsure.” Alone: read and label. Needs approval: bulk archive, forward, delete. Human review point: someone clears “Unsure” and “Client request” each morning. Sensitive-data flag: client details and contracts in message bodies; where possible, start from metadata such as sender and subject, which Gmail’s API can expose without the body [14], and connect only an inbox cleared for this use.
An “Incoming” folder of scanned documents. Categories: “Invoices,” “Signed contracts,” “Receipts,” “Correspondence,” “Unsure.” Alone: rename and move within “Incoming – sorted” subfolders you created. Needs approval: any move into a shared team folder, because the file takes on that folder’s audience [21]. Human review point: the folder owner approves the day’s batch of moves. Sensitive-data flag: bank details, IDs and signatures; keep the folder in your organization’s sanctioned storage, never a personal account.
An internal IT and HR request queue. Categories: “Access request,” “Equipment,” “Payroll question,” “HR – restricted,” “Unsure.” Alone: set the category and add an internal note. Needs approval: reassigning teams, changing who can see a ticket, closing anything. Human review point: the queue owner checks every “HR – restricted” and “Unsure” ticket before routing. Sensitive-data flag: health, leave and pay details; keep sensitive categories neutrally named and inside HR’s sanctioned system, remembering that financial data is sensitive even though UK GDPR doesn’t make it special category data [12].
Keep Reviewing After Launch
A usually-right sorter can invite automation bias, or over-reliance on automated advice. The evidence base is mixed and predates modern agents; the supervision guide explains the findings and limits in detail [28].
As an editorial rule of thumb, review every “unsure” item plus a random sample of about 20 auto-labeled items each week for the first month, then at least monthly, and re-run your test set whenever you change categories, instructions, model or connected tools. If your corrections climb, pause and fix the category guide. Watch the log for spikes in moves or approval requests, as OWASP recommends [23]. See also monitoring an agent after you launch it.
Practical Takeaways
- Try rules, help-desk triage or a fixed automation with one AI classification step before building an agent.
- Write a handful of non-overlapping categories with definitions and examples, plus a default “Unsure.”
- Let the agent label alone; require approval to delete, share, forward or move anything out of a protected area; never grant permanent deletion.
- Read what each connector’s permission really allows, since one permission can also cover sending or deleting.
- Set confidence thresholds from your own test results, not the model’s self-assessment.
- Test on made-up or redacted samples, including tricky items and planted instructions, before touching real data.
- Keep a weekly spot-check and re-test after every change.
Sources
- Building effective agents. Anthropic, 2024-12-19, accessed 2026-11-13.
- A practical guide to building agents. OpenAI, accessed 2026-11-13.
- Create rules to filter your emails. Google (Gmail Help), accessed 2026-11-13.
- Manage email messages by using rules in Outlook. Microsoft Support, accessed 2026-11-13.
- Automatically classifying tickets with intelligent triage. Zendesk Help, accessed 2026-11-13.
- Turn On Einstein Case Classification (Trailhead module: Einstein Case Classification). Salesforce Trailhead, accessed 2026-11-13.
- Text Classifier node documentation. n8n, accessed 2026-11-13.
- Make AI Toolkit. Make, accessed 2026-11-13.
- Use AI by Zapier to analyze and return data. Zapier Help Center, 2026-10-28, accessed 2026-11-13.
- LLM02:2025 Sensitive Information Disclosure. OWASP GenAI Security Project, 2025, accessed 2026-11-13.
- ChatGPT outperforms crowd workers for text-annotation tasks. Proceedings of the National Academy of Sciences (PNAS), via PubMed Central, 2023-07-18, accessed 2026-11-13.
- What is special category data?. Information Commissioner's Office (UK), accessed 2026-11-13.
- LLM06:2025 Excessive Agency. OWASP GenAI Security Project, 2025, accessed 2026-11-13.
- Choose Gmail API scopes. Google for Developers, 2026-09-10, accessed 2026-11-13.
- Microsoft Graph permissions reference. Microsoft Learn, 2026-09-14, accessed 2026-11-13.
- Share SharePoint files or folders. Microsoft Support, accessed 2026-11-13.
- Migrating from Agents to AI by Zapier. Zapier Help Center, 2026-10-01, accessed 2026-11-13.
- Human-in-the-loop for tools. n8n, accessed 2026-11-13.
- Delete or recover deleted Gmail messages. Google (Gmail Help), accessed 2026-11-13.
- Restore deleted files or folders in OneDrive. Microsoft Support, accessed 2026-11-13.
- Moving content from Drive shared folders. Google Workspace Admin Help, accessed 2026-11-13.
- Move files & folders into shared drives. Google Drive Help, accessed 2026-11-13.
- AI Agent Security Cheat Sheet. OWASP Cheat Sheet Series, accessed 2026-11-13.
- Can LLMs Express Their Uncertainty? An Empirical Evaluation of Confidence Elicitation in LLMs. ICLR 2024 (arXiv version), 2024, accessed 2026-11-13.
- Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. arXiv (published at ACM AISec 2023), 2023-05-05, accessed 2026-11-13.
- Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection (publication record). CISPA Helmholtz Center for Information Security, 2023-11-30, accessed 2026-11-13.
- LLM01:2025 Prompt Injection. OWASP GenAI Security Project, 2025, accessed 2026-11-13.
- Automation bias: a systematic review of frequency, effect mediators, and mitigators. Journal of the American Medical Informatics Association (JAMIA), via PubMed Central, 2012-01, accessed 2026-11-13.
