About the project

Inspiration

  • We wanted to turn the existing Bank of Anthos into a smarter, safer banking experience—without changing its core—by layering explainable AI for spending insights, fraud signals, and investment guidance.
  • Real users struggle with opaque statements and static rules; we aimed for clear, actionable, and trustworthy advice in near real time.

What we built

  • An AI orchestration layer with specialized agents:
    • Transaction Analyzer (agents/transaction-analyzer/main.py): categorization, patterns, anomaly detection.
    • Investment Advisor (agents/investment-advisor/main.py): risk profiling, portfolio insights, personalized recommendations.
    • Financial Advisor (agents/financial-advisor/main.py): routes queries via A2A, aggregates results with Gemini Pro, returns a single answer.
  • Infrastructure: Kubernetes manifests in k8s/, deploy scripts in scripts/, and an MCP server in services/mcp-server/.

How we built it

  • Agents in Python using an ADK-style interface (agents/adk/), with tools for capabilities and an A2A protocol for inter-agent messaging.
  • Gemini Flash for fast transaction categorization; Gemini Pro for reasoning and synthesis.
  • Strict prompt contracts that return typed JSON, mapped to data models in each agent’s models.py.
  • Non-invasive integration via MCP to Bank of Anthos APIs; no changes to the core microservices.
  • Deployed on GKE using manifests under k8s/ and automated with scripts/deploy-ai-components.sh.

What we learned

  • Prompt engineering for structured outputs: designing JSON-first prompts drastically reduces parsing errors.
  • Batching and backpressure matter: grouping transactions improved cost/latency without losing accuracy.
  • Schema-first design makes agents composable; typed models let us swap prompts/models without breaking callers.
  • Observability upfront (timings, counts, IDs) makes debugging multi-agent flows tractable.
  • Security-by-default (PII masking, secrets management) must be designed in, not bolted on.

Challenges we faced

  • Ensuring deterministic-enough LLM outputs: mitigated with low temperature, JSON schemas, and fallbacks.
  • Latency under load: solved via batching, async IO, and lightweight summaries before deep insights.
  • Data quality and PII handling: consistent masking and least-privilege access through MCP.
  • Cross-agent orchestration: timeouts, retries, and idempotent tool calls to avoid cascading failures.
  • Deployment complexity: aligning secrets, quotas, and HPA settings for different agent workloads.

A little math behind the scenes

  • Portfolio guidance used a simple mean–variance framing: [ \max_{w} \; w^\top \mu - \lambda \, w^\top \Sigma w \quad \text{s.t.} \quad w \ge 0,\; \mathbf{1}^\top w = 1 ] where (w) are asset weights, (\mu) expected returns, (\Sigma) covariance, and (\lambda) risk aversion.
  • Basic anomaly scoring leverages z-scores for spend spikes: [ z = \frac{x - \mu}{\sigma} ] with thresholds tuned per category to reduce false positives.

What’s next

  • Production-grade Risk Assessment and Market Intelligence agents.
  • Deeper portfolio analytics (factor exposure, drawdown), backtesting, and explanation graphs.
  • Feedback loops for adaptive prompts and A/B testing across user segments.
  • Richer UI drill-downs and one-click actions tied to agent recommendations.

  • High-level: We layered a multi-agent, explainable AI system on top of Bank of Anthos to deliver real-time insights and personalized advice—non-invasively, reliably, and ready to scale.

Built With

  • adk
  • audit-logging-apis-and-data-sources-bank-of-anthos-rest-apis-(accounts
  • balances)-market-data-apis-(for-investment-analysis)-google-ai-api-(gemini)-kubernetes-manifests-ai-agents-and-mcp-server-deployments-(`k8s/ai-agents/`
  • bash
  • css
  • docker
  • gemini
  • google-cloud-logging/monitoring-google-secret-manager-for-secrets-tls
  • grafana
  • javascript
  • k8s/investment-advisor-agent.yaml`
  • k8s/transaction-analyzer-agent.yaml`
  • mcp
  • pydantic
  • python
  • rbac
  • scripts/deploy-bank-of-anthos.sh`
  • scripts/run-tests.sh`)-observability/security-(as-designed-in-architecture)-prometheus
  • transactions
  • yaml
Share this project:

Updates