This technical blueprint demonstrates how developers can implement conversational financial intelligence using the official Google Gen AI SDK v3.3.0 (@google/genai and google-genai). It implements read-only tool calling over transaction ledgers, formats structured financial outputs for generative UI charts, and demonstrates user-managed memory lifecycles mirroring Google's Memory Summary.
The conversational financial assistant pipeline follows a five-stage deterministic lifecycle that guarantees zero mutation of user accounts:
@Google Wallet with an expense query or budget goal.fetchTransactions, fetchSubscriptions, fetchHistoricalBudgets).@google/genai v3.3.0)import { GoogleGenAI, Type } from "@google/genai";
const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
// 1. Define Read-Only Financial Query Tools
const walletTools = [
{
name: "fetchTransactions",
description: "Fetches historical read-only transactions across linked bank accounts and Google Wallet cards.",
parameters: {
type: Type.OBJECT,
properties: {
startDate: { type: Type.STRING, description: "ISO start date YYYY-MM-DD" },
endDate: { type: Type.STRING, description: "ISO end date YYYY-MM-DD" },
category: { type: Type.STRING, description: "Optional filter: dining, grocery, tech, travel, utilities" },
},
required: ["startDate", "endDate"],
},
},
{
name: "auditSubscriptions",
description: "Scans recurring merchant transactions to detect subscription cadence and price increases.",
parameters: {
type: Type.OBJECT,
properties: {
lookbackMonths: { type: Type.INTEGER, description: "Number of trailing months to audit (e.g. 12)" },
},
required: ["lookbackMonths"],
},
},
];
// 2. Execute Interactions API with automatic continuation
const interaction = await client.interactions.create({
model: "gemini-4-hydrogen", // Fast execution engine
input: "@Google Wallet Review my spending from last quarter so I can save $1,000 over the next 3 months.",
config: {
system_instruction:
"You are a personal finance assistant. You have READ-ONLY access to Google Wallet and linked Plaid accounts. You cannot transfer money, make purchases, or modify credentials. Return spending breakdowns with structured visual charts.",
thinking_level: "high",
automatic_continuation: true,
tools: walletTools,
},
});
for (const step of interaction.steps) {
if (step.thought) console.log("[Reasoning]:", step.thought);
if (step.tool_call) console.log("[Read-Only Tool Call]:", step.tool_call);
if (step.output) console.log("[Assistant Response & Chart Payload]:", step.output.text);
}
google-genai v3.3.0)from google import genai
from google.genai.types import InteractionsConfig, Tool
client = genai.Client()
# Read-only personal finance tool declaration
tools = [
{
"name": "audit_subscriptions",
"description": "Scans recurring payments and flags price hikes across Google Wallet and linked accounts.",
"parameters": {
"type": "OBJECT",
"properties": {
"lookback_months": {"type": "INTEGER", "description": "Trailing audit window in months"}
},
"required": ["lookback_months"]
}
}
]
interaction = client.interactions.create(
model="gemini-4-hydrogen",
input=[{
"role": "user",
"content": "@Google Wallet What subscriptions am I still paying for, and did any of them go up in price this year?"
}],
config=InteractionsConfig(
system_instruction="Strictly read-only financial advisor. Never mutate accounts. Detect recurring charges and flag price changes.",
thinking_level="high",
automatic_continuation=True,
tools=tools
)
)
for step in interaction.steps:
if step.thought:
print("[CoT]:", step.thought)
if step.output:
print("[Output]:", step.output.text)
To implement user-controlled memory adhering to Google's Memory Summary model, apps should persist extracted goals in a transparent document collection that users can audit:
// User Memory Model for Personal Intelligence
interface UserMemoryEntry {
id: string;
category: "financial_goal" | "dining_preference" | "budget_constraint";
statement: string; // e.g. "Targeting $1,000 savings in Q1 2027"
confidence: number;
extractedAt: string;
sourceInteractionId: string;
}
// User-facing pruning method (Right-to-be-forgotten / User control)
function deleteMemoryEntry(userId: string, memoryId: string): void {
// Permanently purges the specific memory vector from the user's Personal Intelligence context
database.collection("user_memories").doc(memoryId).delete();
}
Experience dynamic cash flow visualizations, subscription price hike auditing, and the Memory Summary inspector live in our companion playground: Gemini Personal Finance & Google Wallet Studio [SIMULATED DEMO] →