Read-Only Architecture for Connecting AI Assistants to Bank Accounts
This article breaks down a read-only architecture that lets an AI assistant answer questions about account balances, spending categories, and upcoming bills without ever gaining write access to funds. It explains the four-layer decoupling model, how read-only authorization is enforced through credential isolation and scoped tokens, field-level data minimization, and why calculations should run in deterministic code instead of the model. It also covers security and compliance controls, a cloud deployment reference, and the core conclusion that verifiability matters more than data breadth.
1. Scenario and Core Problem
When a user asks an assistant questions like “which categories did most of my spending go to this month” or “how much is still due before my next paycheck arrives,” the model itself holds no account facts. For the answer to hold up, the system must first retrieve structured facts from an external data source, then hand those facts to the model to organize into a natural-language explanation. This turns what looks like a “conversational capability” requirement into a typical regulated data integration engineering problem.
The technical difficulty here does not sit on the model side but on the integration side, and it comes down to four tensions:
- Usability vs. least privilege: Answer quality depends on data granularity, while compliance requires collecting as little data as possible.
- Real-time response vs. auditability: Users expect instant answers, while financial institutions require every read to be logged and traceable.
- Flexibility vs. determinism: Natural-language questions cannot be enumerated, but fund operations must be absolutely deterministic and never left to the model’s discretion.
- Third-party convenience vs. account holder trust: A bridging layer simplifies integration but introduces new trust and liability boundaries.
The architecturally correct solution is not “give the model more permissions” but reduce permissions to the minimum and keep determinism outside the model.
2. Overall Architecture: Four Decoupled Layers
A practical design is usually split into four layers that communicate through explicit contracts:
- Access layer (authorization and connection): Institutional-side authentication is completed through a standardized bank connection service, so the business never touches user credentials.
- Data layer (normalization and storage): Heterogeneous responses from different institutions are normalized into a unified account and transaction model.
- Capability layer (query and computation): Deterministic code performs aggregation, classification, and cash-flow calculations; the model never iterates over raw transactions directly.
- Interaction layer (explanation and presentation): The model only converts already-computed results into explanatory text and annotates the methodology and data freshness.
The key design principle: the model always sits downstream of a read-only path, and any write path does not exist in the architecture at all rather than being blocked by prompt instructions.
3. How Read-Only Authorization Is Implemented
Read-only is not a promise but the result of three stacked mechanisms:
- Credential isolation: User authentication happens on the institution side or the bridging side; the business system holds only a short-lived access token and never obtains the login password.
- Interface capability constraints: The call set is limited to read capabilities such as account listing, balances, credit limits, and transaction details; no transfer, payment, or investment permissions are requested.
- Scope and expiry: Tokens are bound to a single user and a single purpose, with a short lifetime and a revocation mechanism; once a user withdraws consent, cached data must be invalidated according to policy.
An illustrative capability declaration (pseudocode, expressing design intent only):
# Request read capabilities only, no fund-operation capabilitiesSCOPES = ["accounts.read", "balances.read", "transactions.read"]def fetch_accounts(user_id: str, token: str):# token is a short-lived credential; the business side never touches the user's login passwordaccounts = connector.list_accounts(token, scopes=SCOPES)# discard the account identifier immediately, keeping only the last four digits for displayreturn [normalize(a) for a in accounts]def normalize(a):return {"institution": a.institution_name,"nickname": a.name,"type": a.type, # account type"tail4": a.mask[-4:], # show last four digits only"balance": a.balance,"credit_limit": a.credit_limit, # credit limit, may be empty}
4. Data Minimization and Field-Level Governance
The field list should be finalized after joint review by compliance and security. Typical usable fields include institution name, account alias, account type, last four digits of the identifier, balance, credit limit, and transaction records within a limited window (for example, the past two years). What explicitly must not enter the system is equally important: full account numbers, login credentials, payment verification information, and any field that could be used to initiate a fund movement.
Recommended engineering measures:
- Mask on ingest: Complete masking and truncation before data is persisted, so full identifiers never reach logs.
- Retention policy: Set differentiated retention periods for transaction details by use case, with automatic cleanup on expiry.
- Field-level access control: Different roles see different fields, and only the fields required for the current question are injected into the model context.
- Revocable and deletable: Once the user revokes authorization, derived data and vectorized results are invalidated together.
5. Pushing Computation Down: Why the Model Should Not Iterate Over Transactions
Handing “classification and aggregation” to the model looks convenient but introduces nondeterminism: inconsistent methodology across two answers to the same question, missed items caused by long-context truncation, and confusion over amount units. The more reliable approach is push computation down into deterministic code and let the model only explain:
def monthly_overview(txns, month):buckets = {}for t in txns:if t.date.startswith(month) and t.amount < 0:cat = classify(t) # rules first, model as fallbackbuckets[cat] = buckets.get(cat, 0) + (-t.amount)total = sum(buckets.values())return {"total": round(total, 2), "by_category": buckets}def runway(balance, upcoming_bills, payday):# affordability estimate: balance minus upcoming bills, with a time referencereturn {"available": round(balance - upcoming_bills, 2), "as_of": payday}
For classification, “rules first, model as fallback” is recommended: high-frequency, stable items such as rent, utilities, and subscriptions are matched by rules on merchant and amount patterns, long-tail items are left to the model, and a manually correctable mapping table is retained to keep improving accuracy.
6. Security and Compliance Control Checklist
- Transit and storage: Encryption across the full path, with keys managed in a dedicated key management service and rotated regularly.
- Audit trail: Every read records the caller, purpose, field scope, and timestamp, forming a tamper-resistant audit chain.
- Prompt injection defense: External text such as transaction memos is always treated as untrusted data and is forbidden from triggering any tool call.
- Output disclaimers and boundaries: State clearly that results are statistical inferences based on historical transactions and do not constitute investment, tax, or legal advice.
- Explainability: Answers annotate the data cutoff time, statistical methodology, and missing items to prevent users from misjudging balance freshness.
- Human-in-the-loop evolution: For major financial decisions, licensed professional institutions and regulated services are introduced as a separate step rather than having the assistant deliver conclusions directly.
7. Cloud Deployment Reference
The capabilities above can be carried by general service categories on the cloud: data ingestion and task scheduling use message queues and function compute for asynchronous pulls; normalized data lands in object storage and managed databases; masking and keys are handled by a key management service; and full-path behavior is covered by logging and monitoring with alerting to detect anomalous reads in real time. The capability categories Baidu AI Cloud offers in data security, privacy compliance, and observability can serve as a general baseline selection reference for this kind of architecture.
8. Conclusion
The value of connecting an AI assistant to account data lies not in “seeing more” but in delivering verifiable explanations within a very narrow permission boundary. When read-only authorization, field minimization, computation push-down, and end-to-end auditing all hold at the same time, convenience does not come at the cost of data sovereignty; and when the architecture contains no write path to begin with, security no longer depends on trusting the model’s behavior.
