Accounts Payable AI Agent Resources

Overview

This walkthrough demonstrates how AI powered automations can streamline the Accounts Payable process — a common bottleneck for finance teams. AP inboxes often receive a mix of invoices, supplier inquiries, and unrelated emails, all of which typically require manual triage. The solution shows how to automatically classify messages, extract key data, and respond efficiently — reducing errors, preventing SLA breaches, and improving supplier communication and cash flow visibility.

The emails are fetched from the inbox of the Accounts Payable team. All inquiries are responded to directly. Invoices are processed and then submitted to the invoice submission page.

The solution uses a Goal Based AI Agent to orchestrate the end-to-end workflow. The agent classifies incoming emails using an AI Skill, extracts inquiry details with another AI Skill, and leverages research tools to fetch missing data before responding or processing invoices. This approach minimizes manual intervention, accelerates processing times, and enhances accuracy.

Navigate to Bots > AP Inbox Agent folder in your Control Room and follow the steps below to build the solution.

1. Configure the Inquiry Extraction AI Skill

Objective:

The InquiryExtractionAISkill is used to extract information from supplier email inquiries and return structured data. This skill is currently missing some prompts and variable mappings

Steps:

  1. 1. Navigate to the Bots > AP Inbox Agent > Inquiry Extraction Tool folder.
  2. 2. Open the InquiryExtractionAISkill.
  3. 3. In the System Prompt section, enter the following
  4. Context: You are an AI extractor analyzing supplier email text provided as UnstructuredMessage. Extract structured information about supplier inquiries related to payment status, missing invoices, remittance advice, PO processing, or contracts.
  5. 4. In the User Prompt section, enter the following
  6. Objective: Analyse the input message in $sMessage$. Return only the required information in JSON format. If the subject is vague (e.g., “Query regarding”), rewrite it into a concise, intent-based subject using the body context.
    
    Style & Rules: 
    
      Extract exact values; no additions or summaries.
      SupplierName: from signature or end of message.
      InquirySubject: If vague → rewrite using key intent from body:
    
      1. Payment inquiry → “Payment status for ”
      2. PO inquiry → “Processing status of ”
      3. Remittance → “Remittance advice for ”
      4. Missing invoice → “Missing invoice ”
      5. Contract → “Contract status” (or specific if clear)
    
      InquiryBody: full email body text.
      RelatedInvoiceNumber: exact invoice/PO ID if present.
      Return empty strings if not found.
    
    Tone: Neutral, professional, precise.
    Audience: AI systems and developers verifying data extraction accuracy.
    Response: Output only this JSON (nothing before or after): $sJSONResponseValue$
    
    Example:
      Input: Email Subject: Query regarding PO-5285 Email Body: Hello, Could you confirm whether PO-5285 has been processed? Thank you, Initech LLC
      Output:
      {
        "SupplierName": "Initech LLC",
        "SupplierID": "",
        "InquirySubject": "Processing status of PO-5285",
        "InquiryBody": "Hello, Could you confirm whether PO-5285 has been processed? Thank you, Initech LLC",
        "RelatedInvoiceNumber": "PO-5285",
        "InvoiceStatus": "",
        "InquiryResponse": ""
      }
  7. 5. On the right pane, under Prompt Input, there are two input variables to configure:
    • The $sMessage$ input variable is used to pass the email contents into the prompt. In the $sMessage$ input variable, enter the following test value by clicking the pencil icon (✏️).
    • Email Subject: Query regarding PO-5285 Email Body: Hello, Could you confirm whether PO-5285 has been processed? Thank you, Initech LLC
    • The $sJSONResponseValue$ input variable is used to pass a template for the structured data to be returned. Enter the following JSON node.
      {
        "SupplierName": "",
        "SupplierID": "",
        "InquirySubject": "",
        "InquiryBody": "",
        "RelatedInvoiceNumber": "",
        "InvoiceStatus": "",
        "InquiryResponse": ""
      }
  8. 6. Test the AI Skill by clicking on the Get response button
  9. 7. Save and close the AI Skill to apply the changes.

2. Modify the Inquiry Extraction API Task

Objective

The InquiryExtractionAPITask is responsible for invoking the AI Skill we created earlier. However, the AI Skill has not yet been linked to this task, so we need to add it to complete the workflow. Once connected, the remaining steps in the API Task will take the AI Skill’s output and populate it into the SupplierInquiry node within our JSON schema.

Steps:

  1. 1. In the same folder, open the InquiryExtractionAPITask API Task.
  2. 2. From the Actions pane on the left, add an AI Skill: Execute Action into the main workspace, between Steps #2 and #3, right below the comment.
  3. 3. On the right, in the parameters section, perform the following actions:
    1. (i) Click Choose and browse for the InquiryExtractionAISkill we just created in the Bots > AP Inbox Agent > Inquiry Extraction Tool folder.
    2. (ii) Map the input variable sMessage to the $sEmailBody$ variable.
    3. (iii) Map the input variable sJSONResponseValue to the $sJSONResponseValue$ variable.
    4. (iv) In the Save the response to a variable field, map the output of the AI Skill to the $sInquiryJSON$ variable
  4. 4. Save and close the InquiryExtractionAPITask to apply the changes.

3. Configure the Goal Based AI Agent

Objective:

The AP_Inbox_AI Agent will be used to orchestrate the workflow after extraction of the email contents from the inbox. We need to define the Role, Goal, Action Plan and Ending state definitions.

Steps:

  1. 1. Navigate to AP Inbox Agent folder and click on AP_Inbox_AI Agent AI Agent.
  2. 2. If prompted to generate a prompt, click on Skip.
  3. 3. Under the Prompt section, in the Role field, enter the following
  4. You are an accounts payable automation expert specializing in email triage, invoice processing, and supplier communication. You have advanced expertise in AI-driven email classification, data extraction, validation, and workflow orchestration to optimize AP team efficiency.
  5. 4. In the Goal field, enter the following
  6. Your goal is to classify and process all incoming AP-related emails, ensuring accurate invoice handling, timely supplier responses, and compliance with organizational and regulatory standards. Utilize available tools to maintain data integrity, track provenance, and escalate issues as needed.
  7. 5. In the Action Plan field, enter the following
  8. # Assumptions
      - Incoming emails to this inbox may contain structured data such as invoice PDFs or unstructured data such as inquiries from suppliers.
      - The data may have missing fields, eg Invoices may be missing key fields and the inquiry emails may be missing key terms needed for referencing data.
      - To respond to inquiries with all the details, we make use of research tools - GetSupplierID and LookupInvoiceDetails - that fetch key details from an API endpoint that interfaces with our internal database.
      - We respond to inquiries with missing data by asking for more information
      - We submit valid invoices to a portal after processing them directly.
      - The sOutputJSON string variable is passed through all tools and populated with the result of the tools
      - The sOutputFolder is used to inform the tools about where to download the invoices.
      - The sEmailContents refer to the contents of the emails extracted from the inbox.
    
      # Process
      1. Begin the workflow by classifying the type of email you have just received by calling the 'ClassificationToolAPITask' to classify emails into categories: Invoice, Supplier Inquiry, or Other.
      2. Populate a 1 line summary about the contents of the email and the result of the tool call in the Meta.Summary node in the sOutputJSON Schema.
      3. If the email is classified as Invoice:
          3.1 Use the 'GetSupplierID' to lookup the name of the supplier and get the Supplier ID
          3.2 Populate the Invoice.InvoiceNumber node in the output JSON with the invoice number of the submitted invoice using all the information we have right now.
          3.2 The 'Invoice Processor' extracts key fields using the user approved variables (e.g. InvoiceDate, InvoiceTotal, PO_Number) and submits the invoice to the Invoice submission portal.
          3.3 Invoice Processor returns a completed JSON Schema to mark the successful end of the process.
          3.4 In the Meta.Summary node in the JSON Schema, add a line about the result of the tool call.
    
      4. If the email is classified as Supplier Inquiry:
          4.1 Use the 'InquiryExtractionAPITask' to extract inquiry details (e.g., InquirySubject, InquiryBody, RelatedInvoiceNumber) and update sOutputJSON.
          4.2 Use the 'GetSupplierID' tool to fetch supplier ID using the name of the supplier.
          4.3 Using that supplier ID, research answers to the query asked by the supplier using 'LookupExistingInvoice' .
          - Generate a clear and professional response that answers the query using the 'Email Reply Tool'.
          - If blank fields are returned in the Output JSONSchema, add them to the list of missing fields in the Status.MissingFields node in the JSON Schema. If there are missing data, respond to the consumer explicitly asking for these details using the Email Reply Tool.
          - In the Meta.Summary node in the JSON Schema, add a line about the result of the tool call.
    
        4. If classified as Other, take no action
    
      # Guidelines
          - Ensure all communications with suppliers are professional, clear, and consistent.
          - Maintain compliance with organizational policies and regulatory requirements.
          - Track provenance of all processed data in the Status.Provenance node in the JSON Schema to ensure auditability.
          - Prioritize timely responses to maintain strong supplier relationships.
          - Regularly review and optimize workflows to improve efficiency and accuracy.
  9. 6. In the Completed Field, enter this
  10. Either a response has been sent to the supplier, or details of an invoice have been uploaded into the invoice submission portal.
  11. 7. In the Failed Field, enter this
    The invoice could not be submitted to the portal or the inquiry was not responded to.
  12. 8. In the Cancelled Field, enter this
    Stop executing
  13. 9. Create the following input variables:
    • $sJSON_Schema$ : String

      JSON schema that collects state variables after tool execution

    • $sEmailContents$ : String

      The full email body including subject line and signature extracted from the inbox

    • $sOutputFolder$ : String

      The output folder to download invoices and their processed output

  14. 9. Navigate to the Tools tab and add the InquiryExtractionAPITask that we just created.
  15. 10. Save and close the AI Agent to apply the changes.

4. Run the driver Process

Objective:

The AP_Inbox_AI Agent is invoked through a process that first extracts an unread email from the inbox, extracts key fields, and then calls the AI Agent for further processing.

Steps:

  1. 1. Navigate to the AP Inbox Agent > Run_AP_Inbox_Process process
  2. 2. Click on the Run button to start the process.
  3. 3. Enable the $sOutputFolder$ field and specify the folder path where you want the invoices to be downloaded. This directory will only be used if the incoming email is classified as containing an invoice.
  4. 4. Monitor the process execution.
  5. 5. Close any tabs that have the inbox open before executing the process.