Introduction
The MABQ BigQuery Agent is built on Google Agent Development Kit (ADK) using theLlmAgent class. It serves as a natural language to SQL translation engine with strict read-only security controls.
The agent is specifically designed for the TRANSELEC S.A. organization, operating on the
STG_ACTIVOS dataset in the datawarehouse-des project.What is Google ADK?
Google Agent Development Kit (ADK) is a framework for building AI agents powered by Vertex AI. TheLlmAgent class provides:
- Model Integration: Direct connection to Gemini and other LLMs
- Tool Orchestration: Ability to use external tools like BigQuery
- Session Management: Built-in conversation state handling
- Instruction Prompting: Customizable system prompts for agent behavior
Agent Definition
The agent is defined inagent.py:71-77 using the LlmAgent class:
Key Components
Model Configuration
The agent uses Gemini 2.5 Pro as the default model (
gemini-2.5-pro), configurable via environment variables.Agent Identity
Named
bigquery_agent_stg_activos with a clear description of its purpose: answering questions about BigQuery data.Instruction Prompt and Security Guardrails
The agent’s behavior is governed by a comprehensive instruction prompt (agent.py:38-68):Security Features
Operational Rules
The instruction prompt defines strict operational behavior:- Greeting Handling: Responds briefly to greetings like “hola”
- Mandatory Tool Usage: MUST use
bigquery_toolsetto validate queries before responding - Output Format: Returns ONLY the SQL code block without explanations
Example Response Format
Example Response Format
- Adding explanatory text like “Aquí está la consulta”
- Explaining what the query does
- Summarizing the results
Agent Lifecycle
Entry Point Configuration
The agent is registered inadk.yaml:
Access Function
Theget_root_agent() function provides access to the agent instance:
Use Cases
The MABQ BigQuery Agent is designed for:- Data Exploration: Query BigQuery datasets using natural language
- SQL Generation: Automatic translation from business questions to valid SQL
- Read-Only Analytics: Safe data access without modification risks
- Corporate Compliance: Enforced security guardrails for enterprise use
The agent operates exclusively on the
STG_ACTIVOS dataset and rejects any attempts to modify data, making it safe for production analytics workloads.