How to build a Document Classification Agent

This agent automates the classification of uploaded banking documents and seamlessly records the results in a structured Google Sheet.

Challenge

Manually classifying and recording large volumes of diverse banking documents is time-consuming, error-prone, and inconsistent.

Industry

Finance

Department

IT

Compliance

Integrations

Excel/Sheets

OpenAI

Workflow Overview

1. Files Upload (doc-0)

  • Purpose:
    Users upload files (such as PDFs, Word docs, Excel sheets, etc.) that need to be classified.

  • How it works:
    The node processes the uploaded files, extracting their text content. It supports advanced parsing, including OCR (Optical Character Recognition) for scanned documents and unstructured file types.

  • User Experience:
    You simply upload your files; the system handles all the extraction and preparation for analysis.

2. Document Classification with AI (llm-0)

  • Purpose:
    Automatically classify each uploaded document into a business category relevant to banking.

  • How it works:
    The extracted text from the uploaded files is sent to an AI model (OpenAI’s GPT-4o-mini).
    The AI is instructed to:

    • Assign each file to one of these categories:
      Retail Banking, Commercial Banking, Compliance, Risk, HR, IT, Customer Support, Marketing, Legal, or Management

    • Provide the file name and a clear reasoning for the classification.

    • Output the result as a JSON object (machine-readable, easy to log or process further).

  • User Experience:
    You don’t need to do anything—classification and reasoning are fully automated.

3. Write Results to Google Sheets (action-0)

  • Purpose:
    Log the AI’s classification results into a Google Sheet for record-keeping or further analysis.

  • How it works:
    The JSON output from the AI is written directly into a specified Google Sheet (Sheet1 in your provided spreadsheet).
    This step uses a secure connection to your Google Sheets account.

  • User Experience:
    The results are automatically logged—no manual data entry required.

4. Output Node (out-0)

  • Purpose:
    Display the final result of the workflow.

  • How it works:
    The output node receives the result from the Google Sheets write operation and presents it as the final output of the workflow.

  • User Experience:
    You see confirmation or details of the operation’s result.

Summary Table

Node Name

What Happens

Files (doc-0)

User uploads files; text is extracted and prepared for analysis.

OpenAI (llm-0)

AI classifies each file and provides reasoning in JSON format.

Write to Sheet (action-0)

Classification results are logged into a Google Sheet.

Output (out-0)

Final result is displayed to the user.

In summary:
You upload your documents, the AI classifies them with reasoning, the results are logged in Google Sheets, and you get a clear output—all fully automated.

Get started

Let’s Build AI Agents, Together

Book a demo to see how AI agents can help your team process unstructured documents and perform complex analysis faster and more accurately.

Get started

Let’s Build AI Agents, Together

Book a demo to see how AI agents can help your team process unstructured documents and perform complex analysis faster and more accurately.

Get started

Let’s Build AI Agents, Together

Book a demo to see how AI agents can help your team process unstructured documents and perform complex analysis faster and more accurately.

StackAI cube logo mark
Dark rounded AI processor chip illustration