AI Assistant Connected to Bank Accounts: A Technical Breakdown for Personal Finance

    This article examines how to build an AI assistant that connects to bank accounts for personal finance use cases. It covers a five-layer architecture, a read-only permission model based on least-privilege authorization, the account linking flow through a financial data aggregation service, data visibility and privacy boundaries, semantic layer design for natural-language-to-query, answer composition, anomaly detection, visualization, security and compliance requirements, and practical engineering recommendations. The core takeaway is that the difficulty lies not in the model itself but in the tight coordination of permissions, data, and semantics.

    1. Scenario and Problem Definition

    Personal finance management has long relied on multiple banking and payment apps. Users have to switch back and forth between different interfaces just to piece together a complete picture of their spending. Once a large language model is introduced into this scenario, the assistant is no longer just a “chat entry point.” It needs to do three things: aggregate scattered account data, translate the user’s natural-language questions into executable data queries, and organize the results into answers that are readable, verifiable, and traceable.

    From a technical perspective, this is a typical natural-language-to-data question answering system, layered with strong privacy constraints and a business boundary of weak operational permissions. The system must satisfy three goals at the same time: accurate answers, least privilege, and explainable processes. Missing any one of them will be amplified into a trust problem in a financial context.

    2. Layered Architecture

    A usable financial question answering assistant can usually be split into five layers:

    1. Access layer: handles user identity recognition, subscription validation, and the session entry point, ensuring that only authorized users can enter the finance zone.
    2. Authorization layer: completes read-only authorization for bank accounts through a third-party data aggregation service. The assistant itself never touches the user’s online banking password.
    3. Data layer: handles normalized storage and modeling of accounts, credit limits, and transaction records, and provides searchable query interfaces.
    4. Semantic layer: handles intent recognition, parameter extraction, query orchestration, and result generation. This is the core of natural-language-to-data.
    5. Presentation layer: presents aggregated results, charts, calendars, and dashboards in a readable form, with annotations for data definitions and error notes.

    The key value of this layering is that permissions, data, and semantics are decoupled, making it easier to perform security audits and canary releases separately.

    3. Read-Only Permission Model and Least-Privilege Principle

    The most critical design decision in this scenario is to position the assistant as “reading numbers, not moving money.” In implementation, this means:

    • The interface side exposes only query capabilities, such as balance lookup, transaction search, and statement summaries. Write operations such as transfers, automatic deductions, and credit limit changes are not opened.
    • The authorization side uses read-only credentials. What the data aggregation service returns is a “readable” access token, not a full online banking login session.
    • The business side makes the boundary explicit in answers, for example, “I cannot transfer money for you, but I can tell you whether this month’s rent share looks abnormal.”

    Least privilege is not only a compliance requirement but also directly reduces the attack surface: even if the prompt is manipulated, the model cannot reach any fund operation through tool calls. From an engineering standpoint, it is recommended to manage the tool list with a whitelist and record an audit log for every call to support later tracing.

    4. Account Connection and Authorization Flow

    Account connection usually relies on a financial data aggregation service, and the flow can be abstracted as:

    1. User initiates connection
    2. -> Assistant generates a one-time authorization request
    3. -> User logs in to the bank on the aggregation service page and completes identity verification
    4. -> User selects the accounts to connect and the authorization scope (read-only)
    5. -> Aggregation service returns an access token and account metadata
    6. -> Assistant pulls balances, credit limits, and historical transactions, then completes ingestion and indexing

    There are three key design points:

    1. Passwords never land on the assistant side: the user’s bank password is entered only on the aggregation service’s hosted page, and the assistant side never gets it, avoiding becoming a “password custodian.”
    2. Authorization can be revoked: users can unlink at any time. After unlinking, the token becomes invalid and the assistant can no longer pull new data. Cached data should be cleaned up or marked invalid according to policy.
    3. Scope can be narrowed: users can choose to connect only certain cards or a single account instead of granting full access, reducing the data exposure surface.

    5. Data Visibility and Privacy Boundaries

    In terms of data granularity, a reasonable design is “just enough”: account name and type, last four digits of the account number, current balance and credit limit, and up to about two years of transaction records are usually enough to support the vast majority of financial question answering. Sensitive fields such as full card numbers, CVV, and online banking passwords should not enter the assistant’s context.

    Privacy handling needs to clearly distinguish two zones:

    • In-zone conversations: sessions used for financial question answering are not used for model training by default and should support an independent data retention policy.
    • Out-of-zone conversations: follow the user’s regular privacy settings.

    The engineering significance of this “zone-based” handling is to physically or logically isolate highly sensitive data from general conversation data across three stages: storage, retrieval, and training sampling, reducing the risk of cross-scenario leakage.

    6. Natural Language to Query: Semantic Layer Design

    The semantic layer needs to solve three sub-problems:

    1. Intent recognition: determine whether the user is asking about a balance, transactions, a categorized summary, a trend, or a term explanation.
    2. Parameter extraction: map expressions such as “this month,” “rent,” and “before payday” into time ranges, categories, and balance definitions.
    3. Query orchestration: break a complex question into multiple data queries and then aggregate them. For example, “how much money is left before payday” requires first fetching the balance and then subtracting planned fixed expenses.

    A simplified orchestration example:

    1. def answer(question, context):
    2. intent = classify_intent(question) # balance / transactions / summary / trend / explanation
    3. params = extract_params(question, context) # time range, category, account scope
    4. rows = query_ledger(params) # read-only query
    5. summary = aggregate(rows, by=params.group) # categorized summary
    6. return compose_answer(intent, summary, caveats=CAVEATS)

    From an engineering standpoint, it is recommended to separate “computation” from “expression”: numbers come from deterministic queries and aggregation, and the model is only responsible for organizing the results into natural language. This significantly reduces the probability of “number hallucination” and makes answers easier to verify.

    7. Result Composition: From Numbers to Verifiable Answers

    A qualified answer usually contains four parts: conclusion, details, definitions, and notes. Taking “where did my money go this month” as an example, a reasonable answer structure is:

    • Conclusion: this month’s total spending and the share of the largest category.
    • Details: amounts broken down by categories such as rent and utilities, dining, and transportation.
    • Definitions: the statistical interval, whether pending transactions are included, and whether multiple accounts are combined.
    • Notes: key numbers are recommended to be checked against the bank statement.

    For users unfamiliar with financial terms, the answer should also include a “explain first, then calculate” step. For example, if a user asks “how much did the annual percentage rate cost me this year,” the assistant first explains the meaning of the annual percentage rate and how interest is calculated, then gives an estimate based on the actual outstanding balance and interest calculation cycle, and marks it as an estimate rather than a statement number.

    8. Anomaly Detection and Proactive Alerts

    Beyond passive question answering, the assistant can perform some lightweight proactive analysis to help users spot anomalies:

    • Duplicate charges: the same merchant, the same amount, appearing multiple times at similar times.
    • Unexpected fees: newly added recurring charges or suddenly appearing service fees.
    • Bill increases: a noticeable rise in recurring bills over consecutive months.

    In implementation, there is no need to pursue complex models. Rules and statistical thresholds can cover most scenarios:

    1. def detect_anomalies(transactions):
    2. flags = []
    3. for t in transactions:
    4. if is_duplicate(t, transactions): flags.append(("duplicate charge", t))
    5. if is_new_recurring(t, transactions): flags.append(("new recurring bill", t))
    6. if is_spiking(t, transactions, threshold=0.2): flags.append(("abnormal bill increase", t))
    7. return flags

    What matters is giving the basis for “why it is judged this way” rather than just throwing out a conclusion. Explainable alerts are more easily accepted by users and are also convenient for manual review.

    9. Visualization and Dashboards

    Financial data is naturally suited to visualization. Common forms include weekly spending bar charts, category share donut charts, bill calendars, and custom dashboards. Design recommendations:

    • The default view shows “overview + largest category” to avoid information overload.
    • Support switching time granularity, such as week/month/quarter.
    • Chart data and text answers use the same query result to avoid inconsistent definitions.

    10. Security and Compliance Essentials

    For consumer-facing financial scenarios, security design needs to cover the following areas:

    1. Encryption in transit and at rest: sensitive fields are encrypted at rest, logs are masked, and plaintext is not written to disk.
    2. Access control: data is isolated per user, and query interfaces enforce ownership checks to prevent unauthorized access.
    3. Auditing and traceability: record who queried what data when and which tools were called.
    4. Prompt injection defense: protect against prompt injection, limit the scope of tool calls, and reject any write operation outright.
    5. Error disclaimers: clearly state that answers may contain errors and that key numbers are subject to the bank’s information.

    In addition, at the product level, the boundary of “no embedded ads and no selling of financial products” should be made explicit to avoid answers being polluted by commercial recommendations. This is not only a compliance requirement but also a prerequisite for maintaining user trust in the long run.

    11. Engineering Practice Recommendations

    For teams preparing to build similar capabilities, it is recommended to start with the following points:

    • Do read-only first, then analysis, and only consider any write operation last, with write operations requiring an independent security review.
    • Decouple “numerical computation” from “language generation”: computation goes through a deterministic path, and generation goes through the model path.
    • Build a data definition dictionary to unify the definitions of terms such as “balance,” “available credit,” and “spending,” reducing ambiguity.
    • Sample and evaluate answers, focusing on number accuracy, definition consistency, and unauthorized-access interception rate.
    • Design a clear unlink and data cleanup process to ensure that data truly becomes invalid after the user revokes authorization.

    12. Conclusion

    The essence of connecting an AI assistant to bank accounts is not to let the model “manage money for the user,” but to make the model a translation layer between data and the user: aggregating scattered account information into a financial view that is understandable, verifiable, and actionable. Technically, read-only permissions, least privilege, zone isolation, and explainable answers are the four pillars. On the product side, clear boundaries, refusing commercial recommendations, and preserving a manual verification path are the foundation of long-term trust. For developers, the difficulty of this kind of system lies not in the model itself but in the tight coordination of permissions, data, and semantics.