You are helping me build the following AI agent workflow. ## Goal Invoice Processing: Monitors Google Drive for new PDF invoices, uses AI to classify expenses and generate XML. ## Specification - What it does: You save time on bookkeeping by letting this agent automatically find your PDF invoices in Google Drive, classify their expenses, and convert the data into XML for accounting systems. It routes high-value invoices to you via email for approval while sending routine notifications directly to Slack. - Trigger: Triggered by an event (Event ยท on new PDF in Google Drive or manual webhook) - Autonomy: You approve along the way - Expected setup effort: a few focused days - Tools/services involved: - Google Drive: Monitor and download invoice PDFs - OpenAI Chat Model: Classify expenses and detect anomalies - Google Sheets: Archive processed invoices - Slack: Notify finance team of updates - Gmail: Send approval requests for high value invoices ## Known pitfalls, handle each one explicitly in your implementation 1. PDF text extraction often fails on scanned images, so add an OCR step like Tesseract before sending data to the LLM. 2. XML generation might fail due to invalid characters from extracted text, so sanitize strings with regex before serialization. ## Reference implementation https://n8n.io/workflows/11911 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/automated-invoice-processing-with-ai/ via usecasesforagents.com