3CX BigQuery SQL Agent Powered by Gemini & Google ADK

3CX BigQuery SQL Agent Powered by Gemini & Google ADK

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:

  1. The user asks a question via the CLI

  2. The ADK Runner forwards the request to the agent

  3. The LlmAgent sends prompts and tool definitions to Gemini

  4. Gemini decides which tool to call (e.g., execute SQL)

  5. The BigQueryToolset executes the query in BigQuery

  6. Results are returned to Gemini for formatting

  7. 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

  1. Download the Python source code

  2. Install dependencies:

pip install -r requirements.txt
  1. Create a .env file based on .env.example and 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.