Code

cookbook/tools/google_bigquery_tools.py
from agno.agent import Agent
from agno.tools.google_bigquery import GoogleBigQueryTools

agent = Agent(
    instructions=[
        "You are a data analyst assistant that helps with BigQuery operations",
        "Execute SQL queries to analyze large datasets",
        "Provide insights and summaries of query results",
    ],
    tools=[GoogleBigQueryTools(dataset="your_dataset_name")],
    markdown=True,
)

agent.print_response("List all tables in the dataset and describe the sales table")

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Set your credentials

export GOOGLE_CLOUD_PROJECT=your-project-id
export GOOGLE_CLOUD_LOCATION=US
export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
export OPENAI_API_KEY=xxx
3

Install libraries

pip install -U google-cloud-bigquery openai agno
4

Run Agent

python cookbook/tools/google_bigquery_tools.py