AI Assistant Connected to Bank Accounts: A Read-Only Approach to Personal Finance Analysis

    This article explains how to build an AI assistant that connects to bank accounts in a read-only manner for personal finance analysis. It covers the four-layer architecture, least-privilege authorization and data scope, separating deterministic calculations from generative responses, anomaly detection and visualization, and privacy, security, and explainability practices. The focus is on turning scattered financial data into clear, verifiable insights without ever moving money.

    1. Background: From Switching Apps to Natural-Language Q&A

    Personal finance management has long suffered from a structural friction: funds are spread across multiple banks, credit cards, and payment accounts. To answer simple questions such as “Where did my money go this month?” or “How much available balance is left before payday?”, users must switch between several apps, add up numbers manually, and sometimes rely on spreadsheets and memory. Once an AI assistant is connected to account data, the interaction shifts from “people searching for data” to “data finding people”: users ask questions in everyday language, and the system aggregates across accounts, breaks spending down by category, and delivers conclusions in natural language and charts.

    The capability boundary needs to be emphasized. The core purpose of such a feature is to “read the numbers, not move the money”: it only performs queries and analysis, and never initiates transfers, allocates assets, or executes any transaction. This positioning is both a compliance requirement and a first principle of product design—separating “read” from “write” completely can significantly reduce the risk of misoperation and unauthorized access.

    2. Overall Architecture: Four Decoupled Layers with Least Privilege

    A robust implementation is typically divided into four layers that communicate through clear contracts:

    1. Access layer: Handles account authorization and data retrieval through a licensed financial data aggregation service. The user logs in to the bank and completes identity verification and read-only authorization on the aggregation platform; the assistant side never touches bank passwords.
    2. Data layer: Standardizes, anonymizes, and stores pulled account and transaction data with minimization, keeping only the fields required for analysis.
    3. Analysis layer: Parses natural-language questions into structured query intents, executes deterministic calculations, and then lets the model organize the response and explain terminology.
    4. Presentation layer: Outputs conclusions, category breakdowns, charts, and dashboards, along with data source and timeliness notes.

    The key principle is “separate deterministic calculation from generative expression.” Numbers such as amounts, balances, and interest must be computed by deterministic code, while the model only handles intent understanding, terminology explanation, and narrative organization, suppressing numerical hallucination at the root.

    3. Authorization and Data Scope: Read-Only, Minimal, Revocable

    The common approach to account connection is: the user completes bank-side login and multi-factor authentication, the aggregation service issues a read-only token, and the assistant side only obtains read access within a restricted scope. The data scope should follow minimization:

    • Account metadata: institution name, account name and type, last four digits of the account number, balance, and credit limit;
    • Transaction records: time, amount, merchant, category, usually limited to a window of about two years at most;
    • Explicitly not collected: bank passwords, full account numbers, payment credentials, and so on.

    Token lifecycle management is equally important: tokens are stored encrypted, rotated regularly, and support one-click unbinding; after unbinding, they immediately become invalid and stop subsequent pulls, while data deletion and export capabilities are provided.

    1. {
    2. "scope": "read_only",
    3. "accounts": [
    4. {"institution": "Example Bank", "type": "checking", "last4": "1234", "balance": 5120.44},
    5. {"institution": "Example Bank", "type": "credit", "last4": "9876", "credit_limit": 8000.00}
    6. ],
    7. "transactions_window": "24_months",
    8. "pii": {"full_account_number": false, "password": false}
    9. }

    4. Analysis Layer Implementation: From Intent Parsing to Deterministic Calculation

    A typical pipeline is: question rewriting → intent and slot extraction → generating a structured query → executing the calculation → handing the result to the model for narration. Sample code:

    1. # Illustrative only: separating intent parsing from deterministic calculation
    2. def parse_intent(question: str) -> dict:
    3. # A real implementation can use constrained model output (JSON Schema validation)
    4. return {"metric": "available_before_payday", "window": "current_month"}
    5. def compute(accounts, txns, intent):
    6. if intent["metric"] == "available_before_payday":
    7. planned = [t for t in txns if t["status"] == "planned"]
    8. balance = sum(a["balance"] for a in accounts if a["type"] == "checking")
    9. return {"available": round(balance - sum(t["amount"] for t in planned), 2)}
    10. raise ValueError("unsupported metric")
    11. # The model is only responsible for turning the structured result into natural language and explaining terms
    12. answer = render(intent, compute(accounts, txns, parse_intent(q)))

    In the sample scenario, total spending for the month is about 4309.37 USD, with rent and utilities accounting for more than half and dining about 1024.51 USD; after deducting four planned expenses before payday, the available balance is about 1393.22 USD. Such output must include a statement of the “calculation basis, data cutoff time, and that bank records prevail.”

    5. Anomaly Detection and Visualization

    Beyond aggregation, a rules engine can identify common anomalies: duplicate charges, unexpected new fees, recurring bills that keep rising, and subscription spending quietly accumulating. The implementation relies mainly on deterministic rules with statistical baselines as a supplement, and each alert provides an evidence chain (the transactions involved, time, amount, and historical comparison).

    For visualization, it supports weekly spending bar charts, bill calendars, and custom dashboards, with parameters (time window, category, account scope) adjustable by the user at any time. Engineering-wise, it is recommended to serialize chart configurations into a declarative structure for reuse and auditing.

    6. Privacy, Security, and Explainability

    • Training isolation: conversations in a dedicated zone are not used for model training; interactions outside the dedicated zone follow the user’s regular privacy settings, which need to be clearly distinguished in the interface.
    • Transmission and storage: end-to-end encryption, encrypted storage of tokens and sensitive fields, role-based least-privilege access, and audit logs for operations.
    • Prompt injection protection: external text such as transaction notes is always treated as untrusted data and must not change system instructions; output is filtered for sensitive information.
    • Explainability and disclaimer: explain terminology (for example, how an annual interest rate translates into actual interest expense), note that results may contain errors, and advise consulting licensed professionals and regulated institutions for major financial decisions.
    • Commercial neutrality: no embedded ads or paid recommendations, and no selling of credit cards, loans, savings, or other financial products to users, distinguishing it from fintech platforms that target conversion.

    7. Implementation Suggestions on Baidu AI Cloud

    The architecture above can be implemented by combining general capabilities of Baidu AI Cloud: use object storage to hold anonymized data and reports, use a message queue to decouple data pulls from analysis tasks, use a container platform to host compute and inference services, use logging and monitoring with alerting for auditing and anomaly tracking, and combine key management with access control for permission governance. On the model side, constrained output and structured validation ensure the numerical pipeline is always closed within deterministic code.

    8. Conclusion

    The value of read-only personal finance analysis lies not in making decisions for users, but in translating scattered, jargon-heavy data into clear, verifiable insights. Holding to the four principles—separation of read and write, least privilege, deterministic calculation, and revocable authorization—is what enables a sustainable balance between experience and risk.