3CX BigQuery SQL Agent Powered by Gemini & Google ADK
Talk to Your Call Center Data — No SQL, No Dashboards, Just Questions
Large Language Models (LLMs) are powerful at reasoning and summarization, but their real business impact emerges when they are connected to structured, governed enterprise data.
In this article, we demonstrate how a Google AI Agent built with the Agent Development Kit (ADK) and Gemini can query 3CX Call Detail Records (CDRs) stored in BigQuery. This enables supervisors and analysts to interact with call center data conversationally—without writing SQL or opening dashboards.
The result is a secure, enterprise-ready conversational interface to 3CX CDR data that runs locally via CLI while respecting strict access controls.
Why Google ADK Is a Natural Fit for AI Agent Development
Google’s Agent Development Kit (ADK) provides a structured framework for building production-grade AI agents that can:
-
Query enterprise databases
-
Retrieve relevant information
-
Present insights in human-readable form
-
Operate without requiring knowledge of database schemas or SQL
Gemini handles reasoning and natural language understanding, while ADK ensures that database access remains controlled, auditable, and secure.
This architecture makes ADK ideal for enterprise AI deployments.
How the Agent–BigQuery Flow Works
At a high level, the system operates as follows:
-
The user asks a question via the CLI
-
The ADK Runner forwards the request to the agent
-
The LlmAgent sends prompts and tool definitions to Gemini
-
Gemini decides which tool to call (e.g., execute SQL)
-
The BigQueryToolset executes the query in BigQuery
-
Results are returned to Gemini for formatting
-
The user receives a clear, structured response
This separation ensures that the LLM operates with restricted database access, making the solution suitable for real enterprise environments.
Configuration & Setup
Prerequisites
-
Python installed and working
-
3CX phone system connected to a BigQuery data source
-
Gemini API access
Installation Steps
-
Download the Python source code
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile based on.env.exampleand add:
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_API_KEY=your-gemini-api-key
Authentication Options
-
Service Account JSON
-
Application Default Credentials:
gcloud auth application-default login
Run the Agent
python main.py
Practical Use Cases
From a simple CLI interface, users can ask questions such as:
-
“What datasets are available?”
-
“Show me the schema of the cdroutput table.”
-
“How many calls did X answer in the last 30 days?”
-
“Which calls were spam-related or abusive?”
-
“Are there any calls involving impersonation of the Tax Department?”
-
“Generate a performance summary and coaching suggestions for X.”
-
“List all questions I asked during this session.”
The agent acts as an on-demand data analyst, powered by real call detail record data.