Architecture Design Document · Rev 1.0 · TOGAF 10 / C4 Model
AutonomIQ Deal Desk
GCP-Native Autonomous Agentic Pipeline for Revenue-Cycle Quote Generation
Author Principal Architect
Status Proposed
Version 1.0.0
Framework TOGAF 10 · C4
Platform GCP + Salesforce
Date April 2026
§00 Abstract

Document abstract

Abstract

This document specifies the complete architecture of AutonomIQ Deal Desk, a GCP-native event-driven agentic system that processes inbound Salesforce opportunity events without human intervention below a configurable deal-value threshold. The pipeline autonomously retrieves CRM context, queries ERP pricing, executes Retrieval-Augmented Generation over a redacted corpus of historical contract precedents hosted in AlloyDB pgvector, computes gross margin via a deterministic BigQuery rule engine, synthesises a compliant quote document via Gemini 1.5 Pro, conditionally routes above-threshold deals for human approval, and writes all artefacts back to Salesforce — within a target end-to-end latency of under 90 seconds for straight-through deals.

The architecture is partitioned into four layers: a collapsed event-and-notification surface (Presentation & Experience), a Vertex AI Agent SDK-based orchestration tier (Agent Orchestration), a Gemini + RAG intelligence tier (MLOps & Intelligence), and a hardened GCP infrastructure tier. Nine Architecture Decision Records document material design choices with full rationale, considered alternatives, and explicit rebuttals to the strongest counterarguments.

Vertex AI Agent SDKGemini 1.5 ProRAGGCP Salesforce CRMCPQReAct LoopPub/Sub Cloud RunAlloyDB pgvectorBigQueryTOGAF 10 Autonomous Quote GenerationApproval Routing
<90s
Target e2e latency for straight-through deals
4
Architectural layers with explicit ownership boundaries
9
ADRs covering all material design choices
0
Human interventions required below deal threshold
§01 Problem Statement

Motivation and problem domain

Enterprise deal desks operate at the intersection of revenue velocity and commercial compliance. The canonical workflow involves six to nine discrete information-gathering steps: CRM opportunity retrieval, pricing-tier lookup, inventory check, contract-precedent review, margin computation, quote document generation, compliance flag resolution, and approval routing. In manually operated environments this requires coordination across three to five systems and two to four human participants, yielding a median cycle time of 4–24 hours per deal.[1]

For high-volume, low-to-mid-value deals — commonly 60–75% of enterprise pipeline by count but only 20–35% by value — the human cost is disproportionate to the revenue at risk. The opportunity cost of cycle-time delay compounds this inefficiency.[2]

Existing CPQ tools, including Salesforce Revenue Cloud and Einstein CPQ, address within-CRM configuration and pricing but do not provide autonomous end-to-end orchestration across external systems, unstructured contract-precedent retrieval via RAG, or contextual reasoning over multi-variable margin rules. The gap is specifically in agentic orchestration: the capacity to plan, execute, evaluate, and revise a multi-step workflow without human initiation of each step.

Scope Boundary
This system is not a CRM replacement, a pricing engine, or a contract management system. It is an orchestration and intelligence layer that sits above existing systems of record and derives value from their data. AutonomIQ adds autonomous workflow execution; it does not own the data it operates on.
§02 Constraints & Scope

Architectural constraints and non-goals

ConstraintCategoryImplication
All computation below threshold must be non-interactiveFunctionalNo UI rendering, no human polling; all state must be durably held between async steps.
Every quote field must be traceable to source dataComplianceEach line item carries a provenance pointer: source system, record ID, retrieval timestamp.
Salesforce is the authoritative system of recordIntegrationAll writes must be idempotent relative to Opportunity ID. No shadow record creation.
No PII in the vector storePrivacy/GDPRContract corpus must be DLP-redacted before embedding. Named entities stripped to category tokens.
Approval threshold is operator-configurable without redeploymentOperationalThreshold persisted in Cloud Firestore; updated by ops team at runtime.
Agent must be idempotent on duplicate eventsReliabilityPub/Sub at-least-once delivery requires deduplication at the orchestrator entry point.
GCP-only compute; Salesforce is external SaaSPlatformNo on-premise dependencies. SF connectivity via REST/Bulk API v2 over mTLS.

Non-goals

The following are explicitly out of scope: multi-currency conversion engine; contract clause negotiation; customer-facing quote portal; real-time inventory reservation; post-close revenue recognition; procurement system integration downstream of the quote.

§03 System Overview

C4 Level 1 — System context

The C4 L1 diagram establishes the system boundary of AutonomIQ and its external actor relationships. Two human roles interact at defined exception points only; all other interactions are system-to-system.

Fig 1 — C4 L1 · System context · AutonomIQ boundary and external actors
SALES REP [creates opportunity] DEAL DESK MGR [above-threshold approver] AUTONOMIQ DEAL DESK [GCP System] Event-driven · Agentic · ReAct loop Vertex AI · Cloud Run · BigQuery · AlloyDB · Pub/Sub Gemini 1.5 Pro/Flash · Cloud Workflows · GCS · Firestore SALESFORCE CRM [External SaaS] Opportunity · Account · Quote ERP / PRICING SVC Product catalogue · COGS Tiered pricing rules CONTRACT REPO [Cloud Storage / GCS] Historical precedents · Redacted Opp.Created → Pub/Sub Quote writeback Price/COGS query RAG retrieval creates Opportunity receives approval request

3.1 — C4 Level 2: Container diagram

The container diagram decomposes AutonomIQ into its deployable units, showing inter-container communication protocols and data flows.

Fig 2 — C4 L2 · Container diagram · Internal GCP containers and communication topology
GCP PROJECT BOUNDARY · us-central1 EVENT INGRESS Cloud Pub/Sub sf-opportunity-events push → Cloud Run ORCHESTRATOR Cloud Run · Python Vertex AI Agent SDK Tool dispatcher · State mgmt Dedup · Idempotency key ReAct loop · max 12 turns WORKFLOW ENGINE Cloud Workflows Step-fn · durable exec INTELLIGENCE SVC Cloud Run · Python Gemini 1.5 Pro (synthesis) Gemini 1.5 Flash (planning) RAG query builder Prompt templates · grounding MARGIN ENGINE Cloud Run · Python BigQuery ML · deterministic VECTOR STORE AlloyDB PostgreSQL pgvector · HNSW index Contract embeddings CONFIG STORE Cloud Firestore Threshold · rules · dedup QUOTE GENERATOR Cloud Run · Python Jinja2 · GCS PDF/JSON APPROVAL ROUTER Cloud Run · Python Threshold eval · SF Task AUDIT LOG BigQuery dataset deal_desk_audit_events SF CONNECTOR Cloud Run · Python REST/Bulk API · mTLS SECRET MGR GCP Secret Manager push tool call ANN query POST quote
§04 Layer 1 · Presentation & Experience

L1 Presentation & Experience Layer

Architectural Note — Collapsed Presentation Layer
A traditional interactive UI does not exist in this system below the approval threshold. L1 is a collapsed exception surface: it surfaces structured artefacts to existing human-inhabited systems (Salesforce, Slack) only at the two defined human-entry points — above-threshold approval requests and operational monitoring.

The L1 layer comprises three surface types: the Salesforce record surface (primary human-readable output written back by the SF Connector), the approval notification surface (Slack Block Kit messages and Salesforce Approval Tasks from the Approval Router), and the ops observability surface (Cloud Monitoring dashboards consumed by the platform team).

Fig 3 — L1 · Presentation surface topology · human entry points and artefact rendering
AUTONOMIQ Output emitter Approval Router + SF Conn. BELOW THRESHOLD (straight-through) SALESFORCE QUOTE RECORD Auto-attached to Opportunity PDF in Chatter Files ABOVE THRESHOLD (approval required) SF APPROVAL TASK Assigned to Deal Desk Mgr margin + precedents context SLACK BLOCK KIT Structured deal summary Approve/Reject actions OPS DASHBOARD Cloud Monitoring Agent run health · SLA below above threshold

4.1 — Salesforce quote record schema

FieldTypeSourceNotes
QuoteNumber__cStringOrchestratorUUID derived from OpportunityId + timestamp. Idempotency key.
TotalDealValue__cCurrencyMargin EngineSum of line items at agreed unit price.
GrossMarginPct__cPercentMargin Engine(Revenue - COGS) / Revenue. Provenance pointer to BQ audit row.
PrecedentDealIds__cTextIntelligence SvcComma-delimited IDs of top-3 RAG-retrieved contract precedents.
AgentRunId__cStringOrchestratorCloud Workflows execution ID. Links to full audit trail.
ApprovalStatus__cPicklistApproval RouterPENDING_REVIEW / AWAITING_APPROVAL / APPROVED / REJECTED.
QuotePDFUrl__cURLQuote GeneratorSigned GCS URL (72h expiry) to rendered PDF artefact.
§05 Layer 2 · Agent Orchestration

L2 Agent Orchestration Layer

The orchestration layer is the central nervous system of AutonomIQ. It implements a ReAct (Reason + Act) loop using the Vertex AI Agent SDK, constrained to a maximum of 12 reasoning turns per execution. The orchestrator receives a normalised event from Pub/Sub, constructs an initial agent context, and iteratively calls registered tools until a terminal state is reached.

Fig 4 — L2 · Agent ReAct loop · orchestrator state machine with tool invocations and terminal states
START DEDUP Firestore key BUILD CTX Opp + Account REACT LOOP (max 12 turns) REASON Gemini 1.5 Flash Plan next tool call REGISTERED TOOLS get_crm_opportunity(opp_id) get_pricing_rules(acct_segment) retrieve_contract_precedents(ctx) compute_margin(inputs) generate_quote_document(state) evaluate_approval_threshold() post_quote_to_salesforce(payload) ACT Execute tool Update state OBSERVE Eval result QUOTE_GENERATED → SF writeback ROUTING_REQUIRED → Approval Router FAILURE → DLQ + alert next turn Turn counter incremented after each OBSERVE. At turn 12: forced FAILURE state with full context dump to DLQ.

5.1 — Tool manifest and SLA contracts

Tool NameOwner ServiceProtocolTimeoutRetry Policy
get_crm_opportunitySF ConnectorHTTPS REST10s3× exp backoff, jitter
get_pricing_rulesERP ConnectorHTTPS REST8s3× exp backoff
retrieve_contract_precedentsIntelligence SvcgRPC15s2× linear, then FAIL
compute_marginMargin EngineHTTPS REST12s2× exp backoff
generate_quote_documentQuote GeneratorHTTPS REST25s1× retry, then FAIL
evaluate_approval_thresholdApproval RouterHTTPS REST5s3× exp backoff
post_quote_to_salesforceSF ConnectorHTTPS REST15s5× exp backoff (idempotent)
§06 Layer 3 · MLOps & Intelligence

L3 MLOps & Intelligence Layer

The intelligence layer performs three distinct reasoning tasks: contract precedent retrieval via RAG, quote synthesis and compliance reasoning via Gemini 1.5 Pro, and deterministic margin computation via BigQuery. These are explicitly separated to allow independent scaling, observability, and model substitution.

Fig 5 — L3 · RAG pipeline · offline ingestion and online query paths
OFFLINE INGESTION PIPELINE (Cloud Run Job · triggered on GCS upload via Eventarc) GCS RAW contract PDFs pre-redaction REDACT Cloud DLP API PII stripped CHUNK + EMBED 768-token windows text-embedding-004 ALLOYDB pgvector HNSW 1536-dim vectors BQ METADATA contract_id · date segment · value tier ONLINE QUERY PATH (synchronous · called by Orchestrator tool · target <400ms p99) QUERY INPUT from Agent context segment · products · value EMBED QUERY text-embedding-004 → 1536-dim vector ANN SEARCH AlloyDB pgvector HNSW · top-k=5 RERANK Metadata filter segment + value tier CONTEXT → returned to Agent 3 precedents + IDs Target online retrieval latency: <400ms p99 · HNSW approximate search · 10M vector capacity baseline

6.1 — Gemini model selection and task routing

TaskModelRationaleApprox tokens
Agent planning / tool selection (ReAct turns)gemini-1.5-flash-002Low latency (<1s), sufficient for structured tool-call decisions over a known 7-tool manifest.500–800 / turn
Quote document synthesis + compliance reasoninggemini-1.5-pro-002Multi-document reasoning over RAG context + pricing state. Large context window required.4,000–12,000
Margin anomaly detection (post-compute)gemini-1.5-flash-002Binary classification over structured JSON. No generation required.300–500
§07 Layer 4 · Infrastructure

L4 Infrastructure Layer

All compute is containerised on Cloud Run (fully managed, serverless). No persistent compute VMs are provisioned. Storage is tiered: AlloyDB for vector workloads, BigQuery for analytics and audit, Cloud Firestore for configuration and deduplication state, and Cloud Storage for artefact persistence.

Fig 6 — L4 · Infrastructure topology · GCP service map with VPC, IAM, and storage boundaries
VPC: deal-desk-vpc · us-central1 SUBNET: compute 10.1.0.0/24 ORCHESTRATOR 2vCPU 8GiB min-1 scale-to-20 INTELLIGENCE 4vCPU 16GiB min-1 scale-to-10 MARGIN ENGINE 1vCPU 4GiB min-0 QUOTE GEN 1vCPU 4GiB min-0 APPR. ROUTER 1vCPU 2GiB min-0 SF CONNECTOR 1vCPU 2GiB min-1 SUBNET: data 10.2.0.0/24 · Private Service Connect ALLOYDB HA · 2 replicas 8vCPU 64GiB FIRESTORE Config · dedup BIGQUERY Audit · pricing 500 slot rsv. MANAGED / EXTERNAL VERTEX AI APIS Gemini · Embedding · Agent SDK PUB/SUB ingress + DLQ topics SECRET MANAGER SF OAuth · API keys · certs CLOUD STORAGE Quote PDFs · raw contracts CLOUD ARMOR + APIGEE WAF · rate limit · mTLS

7.1 — Infrastructure sizing baseline

ServiceSpecScale policyRationale
Cloud Run — Orchestrator2 vCPU / 8 GiB, min 1Scale to 20 on queue depthMin-1 eliminates cold-start on the critical path
Cloud Run — Intelligence4 vCPU / 16 GiB, min 1Scale to 10 on CPUGemini client requires memory for response streaming; 4-vCPU enables gRPC concurrency
AlloyDB Primary8 vCPU / 64 GiB, 2 read replicasRead replica autoscaleHNSW in-memory index for 10M vectors requires ~60 GiB working set
BigQuery500 slot reservationAutoscale to 2000Reservation prevents slot contention from analytics workloads on the latency-critical margin path
§08 End-to-End Data Flows

Happy path: straight-through deal below approval threshold

Fig 7 — Sequence diagram · straight-through deal processing (below threshold · target ~70s)
SALESFORCE / Pub/Sub ORCH- ESTRATOR INTELLIG- ENCE SVC ALLOYDB (pgvector) MARGIN ENGINE QUOTE GENERATOR APPROVAL ROUTER SF CONNECTOR 1 Opp.Created → Pub/Sub push [t=0] 2 dedup check 3 get_crm_opportunity(opp_id) → Account + Opp JSON [~500ms] 4 get_pricing_rules(MID_MARKET) → pricing JSON [~300ms] 5 retrieve_contract_precedents ANN cosine query top-k=5 → 3 precedent chunks [~400ms] 6 compute_margin(inputs) → BigQuery SQL → {gm_pct: 0.42, total_rev: ...} [~800ms BQ] 7 generate_quote_document(state) · Gemini 1.5 Pro → quote JSON + PDF GCS URI [~18s Gemini] 8 evaluate_approval_threshold(deal_val=$48.5k, gm=42%) → PASS (below $75k threshold) [t=~55s] 9 post_quote_to_salesforce(quote_payload) → 201 Created · QuoteNumber__c assigned [t=~68s] 10 → BQ audit row written · agent_run_id logged [t=~70s] TOTAL: ~70s (within 90s SLA) · 6 ReAct turns · 0 human interactions
§09 Approval Routing Flow

Above-threshold deal: approval routing path

Fig 8 — Approval routing decision tree · threshold evaluation and escalation paths
QUOTE GENERATED margin computed · precedents retrieved THRESHOLD EVAL BELOW AUTO-APPROVE → SF writeback ABOVE MARGIN FLOOR? BELOW FLOOR AUTO-REJECT ABOVE FLOOR HUMAN APPROVAL DECISION 24h SLA APPR. SF WRITEBACK Status: APPROVED REJECTED SF UPDATE Status: REJECTED TIMEOUT (24h) ESCALATE Sales VP + alert THRESHOLD PARAMETERS (Firestore) auto_approve_max: $75,000 margin_floor_pct: 18% approval_sla_hours: 24 Stored in Cloud Firestore No redeployment on change
§10 Data Model

Agent execution state machine

Fig 9 — Agent execution state machine · lifecycle of a deal-desk run
RECEIVED dedup CONTEXT_ BUILDING RAG_ RETRIEVAL MARGIN_ COMPUTING QUOTE_ GENERATING POSTED_ TO_SF AWAITING_ APPROVAL APPROVED terminal REJECTED terminal FAILED DLQ below above
§11 Architecture Decision Records

ADR log — material design decisions

Each ADR follows the Nygard template[3] extended with an explicit Rebuttal field addressing the strongest counterargument to the accepted decision.

ADR-001 Vertex AI Agent SDK over custom ReAct implementation Accepted
Context
The orchestration layer requires a ReAct loop with tool-calling, state management, and retry handling. Two options: implement the loop directly in Python against the Gemini API, or use the Vertex AI Agent SDK which provides these primitives.
Decision
Use the Vertex AI Agent SDK. It provides managed tool-call dispatch, turn-limit enforcement, structured memory, and built-in Vertex AI tracing — all required capabilities.
Alternatives
LangChain/LangGraph (OSS, more portable); custom Python ReAct (maximum control); Vertex AI Reasoning Engine (higher abstraction).
Consequences
Coupling to the Vertex AI ecosystem. Migration requires re-implementing the tool manifest and state model. Positive: managed retry, tracing, and quota enforcement reduce implementation surface by ~40%.
Rebuttal to primary objection
Objection: LangGraph is framework-agnostic and avoids GCP lock-in. — Architecturally valid, but the lock-in is accepted because the full system is GCP-native; portability to another cloud is not a defined requirement. Operational benefits of native tracing, IAM-bound service accounts, and managed quota enforcement outweigh the portability cost within the defined deployment boundary.
ADR-002 AlloyDB with pgvector over Vertex AI Vector Search for contract embeddings Accepted
Context
Contract precedent retrieval requires ANN vector search over ~500K document chunks. Metadata filter requirement (segment, value tier, date recency) and transactional consistency with chunk metadata favour a relational-plus-vector store.
Decision
AlloyDB PostgreSQL with the pgvector extension and HNSW indexing. Metadata filters are expressed as SQL WHERE clauses on the same relation as the vector column, eliminating a cross-system join.
Alternatives
Vertex AI Vector Search (fully managed, higher QPS); Pinecone (best-in-class ANN); Spanner with vector; BigQuery ML vector search.
Consequences
AlloyDB cluster requires HA configuration and backup policy. HNSW index must be rebuilt on major corpus updates. At 10M vectors, HNSW in-memory index requires ~60 GiB RAM on the primary node.
Rebuttal to primary objection
Objection: Vertex AI Vector Search is fully managed and scales to billions of vectors without operational overhead. — For billion-scale corpora this is decisive. At 500K chunks, AlloyDB with HNSW provides sub-millisecond ANN latency with full SQL filter expressibility at significantly lower operational cost. Graduation to Vertex AI Vector Search is documented in §Day 2 if corpus exceeds 5M chunks.
ADR-003 Deterministic margin computation in BigQuery, not via LLM Accepted
Context
Gross margin calculation is a financially material computation involving multi-variable arithmetic over structured data: unit COGS, discount schedules, FX rates, partner tier adjustments. LLMs can produce these computations but are non-deterministic.
Decision
Margin computed exclusively via parameterised BigQuery SQL against a versioned pricing rules table. The LLM receives the pre-computed result as grounding context and does not perform arithmetic. BQ row IDs provide full provenance.
Alternatives
Gemini with function-calling arithmetic tools; Python Cloud Run service with embedded rules engine; Drools/Open Policy Agent.
Consequences
Pricing rule changes require schema migration in BigQuery, not prompt modification. Adds ~800ms to the critical path for BQ slot allocation and query execution.
Rebuttal to primary objection
Objection: Gemini with code-execution tool calls can compute margin correctly and eliminates a separate service. — Code execution tool calls are deterministic when the code is well-specified, but they introduce a code-generation surface where the LLM writes the arithmetic. A single hallucinated variable name or formula produces a financially incorrect quote with no detection path. BigQuery SQL is explicit, reviewable, and version-controlled. The 800ms penalty is acceptable given the auditability requirement.
ADR-004 Cloud Run over GKE for all compute services Accepted
Context
Six pipeline services require isolated compute with independent scaling. The deal volume profile is spiky with long idle periods.
Decision
All services on Cloud Run (fully managed). Min-instances set to 1 for latency-critical paths (Orchestrator, SF Connector) and 0 for batch-tolerant paths.
Alternatives
GKE Autopilot (more control, Kubernetes API); GKE Standard (full control, full overhead); Cloud Functions (single-purpose, 9MB limit).
Consequences
Cloud Run max request timeout is 3600s, sufficient for all services. gRPC streaming is supported on Cloud Run and used for the Intelligence ↔ AlloyDB path.
Rebuttal to primary objection
Objection: GKE Autopilot provides sidecar injection, advanced traffic management via Istio, and superior observability. — Operational complexity of GKE is not justified at 6 services. Cloud Run integrates natively with Cloud Trace, Logging, and Monitoring. GKE is the documented graduation path in §Day 2 if service count exceeds 20 or advanced canary deployment requirements emerge.
ADR-005 Approval threshold configuration in Firestore, not environment variables Accepted
Context
Approval threshold changes on a quarterly cadence and must be modifiable by the Deal Desk ops team without engineering involvement or service redeployment.
Decision
Threshold parameters stored as a Firestore document in deal_desk_config collection. Approval Router reads with a 60s local TTL cache. Changes take effect within 60 seconds of a Firestore write.
Alternatives
Environment variables (requires redeployment); Secret Manager (correct for secrets, not business config); Remote Config (Firebase, appropriate for mobile apps).
Consequences
Audit trail of threshold changes maintained via Cloud Audit Logs (all Firestore writes are logged). Previous threshold value preserved in Firestore document history.
Rebuttal to primary objection
Objection: Business rules belong in a rules engine (Drools, OPA). — The threshold evaluation is a single numeric comparison: deal_value < threshold AND margin_pct > floor. A rules engine introduces unnecessary abstraction for a three-variable decision. Migration to OPA is the documented path if approval logic grows to multi-dimensional conditions.
ADR-006 Pub/Sub push subscription over pull for event delivery Accepted
Context
Salesforce Outbound Messages deliver opportunity events via Apigee to Pub/Sub. The Orchestrator (Cloud Run) must process these events. Two delivery patterns available: push or pull.
Decision
Push subscription to the Orchestrator Cloud Run service URL. Push eliminates the polling loop, triggers Cloud Run scale-out directly, and integrates with the min-instance configuration to handle concurrent deal bursts.
Consequences
At-least-once delivery requires idempotency at the Orchestrator. Deduplication uses Pub/Sub message ID as Firestore key with 7-day TTL.
Rebuttal to primary objection
Objection: Pull subscriptions give the consumer rate-control and prevent thundering-herd at volume spikes. — Cloud Run's concurrency model provides equivalent rate control without a polling loop. For throughput >500 events/minute, pull with explicit batching is preferable. At the target deal volume (<50 events/minute at peak), push is simpler and lower-latency.
ADR-007 Gemini 1.5 Pro for quote synthesis; 1.5 Flash for planning turns Accepted
Context
Two distinct model quality/cost trade-offs: (1) ReAct planning turns — structured JSON tool selection over a known 7-tool manifest (simple classification); (2) Quote synthesis — multi-document reasoning over RAG context, pricing state, and compliance clause generation (complex generation).
Decision
Gemini 1.5 Flash for all ReAct planning turns (<800ms, ~600 tokens/turn). Gemini 1.5 Pro for quote synthesis (<20s, up to 12K tokens).
Consequences
Two distinct billing dimensions. Model versions must be pinned (e.g., gemini-1.5-flash-002) to prevent behaviour drift on model updates.
Rebuttal to primary objection
Objection: Using Flash for planning risks lower-quality tool selection, potentially requiring more turns and increasing total latency beyond Pro in fewer turns. — For structured tool-call decisions over a 7-tool manifest, Flash achieves >95% accuracy at temp=0 with a well-specified system prompt. If Flash accuracy falls below 90% in production (measurable via agent-turn telemetry), the planning model can be upgraded to Pro independently.
ADR-008 Cloud DLP API for PII redaction before embedding Accepted
Context
Historical contracts contain PII: customer names, signatory personal details, contact information. Embedding PII into the vector store creates a GDPR-scope data subject rights problem — erasure from a dense vector store is practically infeasible without full re-embedding.
Decision
All contracts pass through Cloud DLP before chunking. Named entity recognition identifies PERSON, EMAIL, PHONE, ADDRESS entities and replaces them with category tokens (e.g., [PERSON_1]). Redacted text is embedded; original retained in GCS with restricted IAM.
Consequences
DLP redaction adds ~2–5s to offline ingestion pipeline per document (not on critical online path). Category substitution reduces semantic precision for queries targeting specific named parties — acceptable because the use case is structural, not identity-based.
Rebuttal to primary objection
Objection: LLM-based NER would provide more context-aware redaction than rule-based DLP. — LLM NER would improve recall but introduces non-determinism in the redaction boundary — a compliance risk. DLP's rule-based detection is auditable, reproducible, and certifiable. For the required entity types, DLP precision is sufficient.
ADR-009 BigQuery for audit log persistence, not Cloud Logging alone Accepted
Context
Every agent run must produce a durable, queryable audit trail: tools called, inputs, results, model used, decision made. Must support both real-time operational queries and historical analytics (margin distribution, approval rate by segment).
Decision
Agent run events written to BigQuery (deal_desk_audit_events, partitioned by date, clustered by opportunity_id). Cloud Logging receives the same events via Log Sink. BigQuery is the primary analytical surface; Cloud Logging provides real-time operational search.
Consequences
BigQuery streaming inserts incur cost (~$0.01/200MB). At target deal volume (<10K/day), streaming insert path is appropriate.
Rebuttal to primary objection
Objection: Cloud Logging with structured log fields provides sufficient auditability without the cost and schema management of BigQuery. — Cloud Logging's 30-day default retention and limited query expressibility make it unsuitable as the sole audit store for a compliance-sensitive system. The requirement for cross-deal analytics (approval rate trend, margin distribution) cannot be satisfied by Logging alone.
§12 Architectural Rebuttals

Consolidated rebuttal register — system-level objections

R1 — "This could be built entirely within Salesforce with Einstein CPQ and Flows"

Rebuttal R1

Salesforce Flow and Einstein CPQ address the within-CRM configuration-and-pricing problem well. The design gap is twofold: (1) cross-system orchestration — Flow governor limits (CPU: 10s, heap: 6MB per transaction) make multi-step retrieval from external systems within a single execution context impractical; and (2) unstructured document reasoning — Einstein has no RAG infrastructure over external contract corpora. The RAG requirement alone mandates a vector store and an embedding pipeline, neither of which exist natively in Salesforce. The GCP layer performs specific capabilities that Einstein's architecture cannot provide.

R2 — "Autonomous financial decisions introduce unacceptable risk"

Rebuttal R2

This conflates risk magnitude with risk category. Below-threshold deals (<$75K) represent low-monetary-risk transactions where the cost of a deal-desk error is bounded and recoverable. The system can be deployed at $0 threshold (all deals routed for approval) and the threshold raised incrementally. Three independent safety mechanisms: (1) a margin floor below which any deal is auto-rejected; (2) a maximum ReAct turn limit with forced failure and human DLQ review; (3) a full immutable audit trail enabling post-hoc review. Risk is managed by parameterisation, not architecture removal.

R3 — "LLM-generated quote documents cannot be compliant without human review"

Rebuttal R3

Quote generation is template-constrained generation, not open-ended text generation. The Jinja2 template defines the structural and contractual skeleton; Gemini 1.5 Pro fills only factual fields (product descriptions, deal-specific line items, precedent-derived clause selections from a fixed Legal-approved library). No free-text clause invention occurs. All numeric fields are sourced from deterministic upstream computations, not LLM generation. The quote PDF is attached to a Salesforce record where the sales team reviews before customer delivery. Compliance review targets the template and clause library, not each individual LLM invocation.

§13 Security Architecture

Identity, trust boundaries, and data classification

Fig 10 — Trust boundary model · IAM service accounts, secret management, and data controls
EXTERNAL / UNTRUSTED SALESFORCE (SaaS) Outbound Msg → Apigee mTLS · OAuth 2.0 JWT ERP / PRICING API Internal REST · VPN tunnel API key via Secret Manager GCP TRUSTED BOUNDARY · VPC SERVICE ACCOUNTS sa-orchestrator@proj pubsub.subscriber · firestore.user sa-intelligence@proj aiplatform.user · alloydb.client sa-sfconnector@proj secretmanager.secretAccessor SECRET MANAGER sf-oauth-client-secret (v3) erp-api-key (v2) alloydb-password (v5) CMEK-encrypted · rotated 90d DATA CONTROLS VPC Service Controls perimeter AlloyDB · BigQuery · GCS in scope CMEK: Cloud KMS per service Key rotation: 365d Cloud DLP: pre-embedding redact 8 infoTypes · PERSON/EMAIL/PHONE PERIMETER CONTROLS Cloud Armor: WAF on Apigee Apigee: API gateway · rate limit Cloud Audit Logs: 90d retention GOOGLE MANAGED VERTEX AI APIS Private endpoints · no internet PUB/SUB · FIRESTORE Within-VPC access paths

13.1 — Data classification

Data ElementClassificationStorageControl
Raw contract PDFsCONFIDENTIALGCS restricted bucketIAM binding to ingestion SA only; CMEK; VPC-SC
Redacted contract embeddingsINTERNALAlloyDBSA binding; PSC endpoint; CMEK
Quote JSON + PDFCONFIDENTIALGCS + SalesforceSigned URLs (72h TTL); SF field-level security
Agent audit eventsINTERNALBigQueryColumn-level security; no external export
Salesforce OAuth credentialsSECRETSecret ManagerCMEK; versioned; 90-day rotation; access audit logged
§14 Observability

Metrics, tracing, and alerting architecture

Signal TypeSourceDestinationKey Metrics / Use
Agent tracesVertex AI Agent SDKCloud TraceE2e latency per tool call; ReAct turn count distribution; breakdown by tool
Service logsCloud Run structured logsCloud LoggingPer-service request rate, error rate, latency; opportunity_id for correlation
Business metricsAgent runs (BigQuery writes)BigQuery → LookerQuote generation rate; approval rate; margin distribution; STP rate; model token consumption
Infrastructure metricsCloud MonitoringCloud MonitoringCloud Run instance count; AlloyDB replication lag; BigQuery slot utilisation; Pub/Sub backlog
AlertingCloud Monitoring alert policiesPagerDuty / SlackP0: DLQ non-empty; AlloyDB unreachable. P1: failure rate >5%; p95 latency >120s. P2: approval SLA breach

14.1 — SLA targets

SLITargetMeasurement window
Straight-through deal completion rate>99%Rolling 7 days
End-to-end latency p95 (below threshold)<90sRolling 24 hours
Agent error rate (unhandled → DLQ)<1%Rolling 7 days
Quote provenance completeness100%Per audit event
Approval notification delivery<60s from decisionPer event
§15 Day 2 Operations

Operational evolution, graduation paths, and maintenance model

Day 2 operations encompasses the steady-state posture post-initial deployment, including model maintenance, corpus management, threshold calibration, and the architectural graduation paths triggered by growth or changed requirements.

Day 2.0 — Baseline steady state (Months 1–3)
Post-launch operational baseline

Monitor ReAct turn distribution. Calibrate approval threshold using actual deal-value and margin distribution data from BigQuery. Run fortnightly contract corpus re-ingestion jobs (new deals added to GCS trigger Cloud Run Job via Eventarc). Review Cloud DLP false-negative rate against redacted output samples.

Day 2.1 — Model version management
Ongoing cadence

Model pinning policy: all Gemini model versions are pinned in Vertex AI endpoint configuration. On new model release: (1) run offline evaluation harness against 500-deal golden dataset; (2) shadow-traffic 5% of live deals to new model for 72 hours; (3) compare quote JSON structure and margin-grounding accuracy; (4) promote if both metrics improve or are neutral. Rollback via endpoint version repin — no redeployment required.

Day 2.2 — Corpus scale graduation (5M+ chunks)
Triggered by corpus size

When the corpus exceeds 5 million embeddings, AlloyDB HNSW in-memory index requirement (~300 GiB) becomes cost-prohibitive. Migration path: deploy Vertex AI Vector Search index alongside AlloyDB. Run dual-retrieval for 30 days, validating recall@5 parity. Cut over AlloyDB to metadata-only store; all ANN queries route to Vertex AI Vector Search.

Day 2.3 — GKE graduation (20+ services)
Triggered by service proliferation

At >20 Cloud Run services, the absence of a service mesh becomes an operational burden. Migration path: deploy GKE Autopilot cluster; migrate services incrementally using Cloud Run → GKE tooling; deploy Istio via Cloud Service Mesh for mTLS, circuit breaking, and canary deployment. Cloud Run remains as the external ingress tier.

Day 2.4 — Multi-region DR
Business continuity requirement

Current design targets us-central1 single region. DR graduation: AlloyDB read replicas in us-east1; BigQuery multi-region dataset; Cloud Run services to us-east1 behind Global Load Balancer; Pub/Sub regional failover. RTO target: <15 minutes; RPO: <5 minutes via AlloyDB replication.

15.1 — Day 2 operational runbooks

RB-01 Dead-letter queue: processing failed agent runs

Failed runs are published to deal_desk_dlq Pub/Sub topic. The DLQ subscription delivers to a separate Cloud Run service (dlq-processor) which: (1) writes a structured failure record to BigQuery with full agent state dump; (2) creates a Salesforce Task assigned to the Deal Desk ops team with the failure summary; (3) sends a P0 alert via Cloud Monitoring. The ops team reviews the agent state JSON, identifies the failure cause, and either re-triggers the event via a retry Cloud Function or manually processes the deal in Salesforce.

RB-02 Contract corpus re-ingestion procedure

New contracts are added to deal-desk-contracts-raw GCS bucket. Eventarc triggers a Cloud Run Job which: (1) runs DLP redaction on new files only (incremental, tracked via Firestore metadata); (2) chunks to 768-token windows with 10% overlap; (3) generates embeddings via Vertex AI Embedding API in batches of 250; (4) upserts to AlloyDB using contract_id as deduplication key; (5) writes ingestion metadata to BigQuery. Full re-embedding (required only on embedding model change) runs as a batch Cloud Run Job with 1000-document parallelism.

RB-03 Threshold calibration procedure

Quarterly threshold review: the Deal Desk Manager queries the BigQuery audit dataset for the trailing 90-day deal distribution. The recommended query surfaces: approval rate by deal value decile; margin distribution for approved vs. rejected deals; false-positive rate (above-threshold deals subsequently approved without modification). The Manager updates the Firestore config document directly via an internal admin UI. Changes take effect within 60 seconds. The previous threshold value is preserved in Firestore document history for audit.

§16 Risk Register

Architectural risk register

R-01
Gemini hallucination in quote synthesis
HIGH

Gemini 1.5 Pro produces structurally valid but factually incorrect quote fields. Mitigated by: template-constrained generation; numeric fields from BQ only; grounding on retrieved documents; Pydantic schema validation before PDF render. Residual risk: clause selection may be semantically inappropriate without detection.

R-02
AlloyDB single-region unavailability
HIGH

AlloyDB primary failure during active deal processing halts RAG retrieval. Mitigated by: HA cluster with 2 read replicas; automatic failover <30s; agent retry policy handles transient unavailability. Residual risk: failover during a ReAct turn consumes turns; resolution is routing long-running operations through the Cloud Workflows durability layer.

R-03
Salesforce API rate limit exhaustion
MEDIUM

High deal volume causes SF REST API rate limit to be hit, blocking CRM context retrieval. Mitigated by: SF daily API call monitoring via Cloud Monitoring; SF Connector implements exp backoff with jitter; Bulk API v2 for writeback at scale.

R-04
Idempotency key TTL expiry on slow processing
MEDIUM

A run stuck in AWAITING_APPROVAL could receive a duplicate Pub/Sub redelivery after the dedup key expires. Mitigated by: Firestore dedup TTL set to 7 days; Pub/Sub message acknowledgment on receipt, not on completion. Correct mitigation prevents redelivery from occurring under normal conditions.

R-05
Embedding model drift on version change
MEDIUM

If the embedding model is updated, cosine similarity scores between existing corpus and new query embeddings become incomparable. Mitigated by: embedding model version stored per-vector in AlloyDB metadata; query uses same versioned model; version mismatch alert triggers a full re-embedding job.

R-06
BigQuery slot contention on pricing query
LOW

Slot reservation shared with analytics workloads. A large analytical query could consume reserved slots and delay margin computation. Mitigated by: dedicated slot reservation for deal_desk project separate from analytics project; pricing queries use LIMIT and parameterised inputs, not full table scans.

§17 References

Bibliography

  • [1]Gartner, "Optimize Deal Desk Operations to Accelerate Revenue," Gartner Research Note G00766843, 2023.
  • [2]Forrester Research, "The State of B2B Quote-to-Cash Automation," Forrester Wave Q3 2024.
  • [3]M. Nygard, "Documenting Architecture Decisions," cognitect.com/blog, 2011.
  • [4]Y. Yao, J. Zhao, et al., "ReAct: Synergizing Reasoning and Acting in Language Models," ICLR 2023. arXiv:2210.03629.
  • [5]The Open Group, "TOGAF® Standard, 10th Edition," 2022.
  • [6]Simon Brown, "The C4 Model for Visualising Software Architecture," c4model.com, 2018.
  • [7]Google Cloud, "Vertex AI Agent SDK Documentation," cloud.google.com/vertex-ai/docs/agents, 2025.
  • [8]Google Cloud, "AlloyDB for PostgreSQL: pgvector Extension," cloud.google.com/alloydb/docs/pgvector, 2025.
  • [9]P. Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks," NeurIPS 2020. arXiv:2005.11401.
  • [10]Google Cloud, "Gemini 1.5 Technical Report," deepmind.google, 2024.
  • [11]NIST SP 800-204B, "Attribute-based Access Control for Microservices," 2021.
  • [12]Salesforce, "Salesforce REST API Developer Guide," developer.salesforce.com, 2025.