Skip to main content

BigQuery Agents

This project implements a conversational agent powered by LangGraph and Google Vertex AI's Gemini model to troubleshoot BigQuery jobs. It utilizes custom tools to fetch job details and table schemas, enabling the agent to provide informed suggestions for fixing errors.

Scripts

  • bq_fix is an AI agent uses Gemini 2.0 Flash. Agent suggests fixes to a problematic query by getting Bigquery job id from user. It uses BigQueryJobDetailsTool and BigQueryTableSchemaTool to get the query and error text and suggests some resolutions. If the error includes data type related ones, it uses BigQueryTableSchemaTool tool to get the table schema for more accurate suggestions.
  • bq_fix_basic is a basic version which does not have the schema lookup functionality. can be useful to resolve syntax issues but not that efficient if the error is related to a column data type compared to bq_fix.

Features

  • BigQuery Job Details Retrieval: Fetches details of a BigQuery job, including the query and any error messages.
  • BigQuery Table Schema Retrieval: Retrieves the schema of a BigQuery table, including column names and data types.
  • Error Analysis and Fix Suggestions: Analyzes job details and errors to suggest possible fixes, leveraging table schema information when necessary.
  • Conversational Interface: Allows users to interact with the agent through a command-line interface.
  • LangGraph State Management: Uses LangGraph to manage the conversation flow and state, including messages, job details, and table schemas.
  • Mermaid Graph Visualization: Generates a Mermaid diagram of the LangGraph flow, saved as graph.jpg.

Prerequisites

  • Python 3.12+
  • Google Cloud Platform (GCP) account with BigQuery enabled
  • PROJECT_ID environment variable set to your GCP project ID or hardcoded in the script.
  • Poetry for dependency management

Installation using pip

  1. Install the pypi package:

    pip install bigquery_agents
    

Installation via Github

  1. Clone the repository:

    git clone https://github.com/samkaradag/bigquery-agents.git
    cd bigquery-agents
    
  2. Install dependencies using Poetry:

    poetry install
    

Usage

  1. Set your GCP project ID:

    export PROJECT_ID="your-gcp-project-id"
    

    Or change the PROJECT_ID variable inside the python script.

  2. Authenticate with GCP:

    gcloud auth application-default login
    
  3. Run the agent using the bq_fix:

    bq_fix
    

Langgraph graph visualization

Metadata

Release files for bigquery_agents 0.1.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bigquery_agents 0.1.15
File Size Uploaded Provenance
bigquery_agents-0.1.15.tar.gz 29.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bigquery_agents 0.1.15
File Interpreter ABI Platform
bigquery_agents-0.1.15-py3-none-any.whl Python 3 none any Details

Total release size: 63.1 kB

Release files / bigquery_agents-0.1.15.tar.gz

Download URL bigquery_agents-0.1.15.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
48536721d788dcdb9b61e3bbe9177364d99d443d07e3ba81eaf7477dcf01347b
BLAKE2b-256 checksum
How to use checksums
1f6042d1eded8317ecf89f4a092a06bccf997ad8547e18fc10ea61133a580ed4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0

Release files / bigquery_agents-0.1.15-py3-none-any.whl

Download URL bigquery_agents-0.1.15-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e60eeb0c989c8b9a845e1c910e33fb6733a73af763a2c40d6a23ec2ba879adcb
BLAKE2b-256 checksum
How to use checksums
8e6b39d11a82aa48faf61789285ab85c51f22f6337213af9bb8f291b25f624bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0

Security for bigquery_agents 0.1.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page