Integration effort is the true heart of the project: The most complex development did not focus on prompt engineering, but on creating a robust, asynchronous middleware (FastAPI and Cloud Run) capable of preventing Google Chat API timeouts
State management with Agent Platform sessions: Integrating this component is essential to preserve conversational context during complex, multi-turn SQL troubleshooting queries
Total observability through BQAA (BigQuery Agent Analytics): Streaming agent events to BigQuery allows the team to monitor performance, analyze user behavior, and control API costs in real-time
Immediate friction-free adoption: Deploying the agent directly where teams already collaborate (existing Google Chat rooms) bypassed the usual change management hurdles
Maximum cost-efficiency with scale-to-zero: Hosting on Cloud Run ensures the infrastructure completely shuts down at night and on weekends, reducing operational costs to the absolute minimum
Carrefour transformed internal support by deploying a serverless, RAG-based AI assistant in Google Chat, reducing resolution times from hours to under two minutes while resolving 75% of queries.
How do you scale platform support for thousands of internal data users without burning out your engineering team?
Scaling platform support for thousands of internal data users without burning out your engineering team is a massive challenge. At Carrefour, a global retail leader, the central Data Platform team solved this bottleneck by building a serverless, Retrieval-Augmented Generation (RAG) agent that handles complex technical and SQL-related questions directly inside Google Chat. The first MVP was built by Group Data Architect Guillaume Blaquière in just a single weekend, and this architecture has successfully reduced support resolution times from several hours down to under two minutes.
This article dives into the technical stack, the custom middleware integration, and the operational wins of this implementation. For the complete, unedited community discussion and code background, check out the original article on Google Discuss.
To ensure rapid deployment, high observability, and strict cost control, the team leveraged a vertically integrated, serverless Google Cloud stack. At the center of orchestration is the Google Cloud ADK, which coordinates the core agent reasoning loops, tool routing, session state with Agent Platform Sessions (which maintains conversational context across complex, multi-turn SQL queries and troubleshooting paths) and observability with near real-time agent event streaming to BigQuery thanks to the BigQuery Agent Analytics (BQAA) plugin (allowing the team to track performance, usage patterns, and costs in real-time).
The analytical brain is powered by Gemini 2.5 Pro, selected for its advanced reasoning capabilities and European regional availability. For the retrieval pipeline, Agent Platform Search (Discovery Engine) indexes internal Confluence wikis and historical Google Chat threads to capture unwritten "tribal" knowledge.
The entire setup is hosted on Cloud Run, which runs both the middleware and the ADK code. This serverless model is particularly efficient because it scales completely to zero during inactive hours, eliminating idle compute costs. Finally, a BigQuery Managed Context Protocol (MCP) server allows the agent to safely inspect database metadata to generate valid BigQuery SQL queries on the fly.
While building the reasoning logic with Google Cloud ADK was straightforward, the real engineering challenge lay in the integration. This integration effort cannot be understated; bridging the gap between a real-time messaging interface and a complex, multi-step RAG pipeline requires robust, production-grade middleware. To handle this, the Carrefour team invested significant engineering cycles into designing an asynchronous architecture that prevents timeouts and guarantees message delivery.
In a standard webhook architecture, a messaging platform like Google Chat expects an immediate synchronous response to prevent timeout errors. However, RAG pipelines and LLM generation can take up to several seconds to fully process. To overcome this, the Carrefour team built an asynchronous, serverless middleware layer using FastAPI on Cloud Run.
Designing and implementing this custom middleware was where the bulk of the development complexity resided. It required careful management of background worker threads, API payload formatting, and secure communication protocols with both Google Cloud and Google Chat APIs, demonstrating that the success of modern AI agents is often 90% integration and 10% model prompting.
The middleware receives the HTTP POST webhook from the Google Chat API and immediately returns a 200 OK status to the platform. Simultaneously, it triggers a background worker task using FastAPI’s BackgroundTasks utility. This background task sends the user's query to the ADK agent endpoint, which retrieves relevant context through Agent Platform Search and prompts Gemini. Once the agent generates the response, complete with formatting and sample SQL queries, the middleware uses the asynchronous Google Chat API client to push the answer back into the correct conversation thread.
This native integration has had a massive impact on daily operations. Traditional support resolution times dropped from several hours or even a full working day down to less than two minutes. Because the AI assistant resolves roughly 75% of incoming queries successfully on its own, it has saved approximately half of a full-time employee's workload (0.5 FTE).
This allows the platform engineers to step away from repetitive support duties and focus entirely on core platform development. Furthermore, because Cloud Run scales to zero on nights and weekends, the infrastructure costs are kept to a bare minimum.
The project highlighted two key architectural lessons for modern development teams. First, teams should focus sprint cycles on integration. Many spend too much time tuning prompts or selecting models. This project proved that because modern LLMs and orchestration frameworks like the ADK are already highly advanced, the bulk of your engineering resources should be dedicated to data ingestion, session persistence, and middleware connectivity.
Second, it is crucial to meet users where they already collaborate. Building a standalone web portal for an AI assistant often fails due to low user adoption. By deploying the assistant straight into the active Google Chat support rooms, Carrefour minimized change management.
Both focusing on solving real business problems and meeting the users where they are—at the cost of substantial integration effort—are the keys to success in agentic deployment. Furthermore, when the agent’s response is incomplete, human engineers can jump directly into the thread to help—which seamlessly feeds back into the historical RAG data for the next query.
With a multi-format network of more than 15,000 stores in more than 40 countries, the Carrefour Group is one of the world leaders in food commerce.
Industry: Retail
Location: France
Products: Google Cloud ADK, Agent Platform Sessions, BigQuery, BigQuery Agent Analytics (BQAA), Gemini 2.5 Pro, Agent Platform Search (Discovery Engine), Cloud Run, BigQuery Managed Context Protocol (MCP) server, Google Chat API