feat: add 1P BigQuery skill for guided data analysis#4678
feat: add 1P BigQuery skill for guided data analysis#4678caohy1988 wants to merge 5 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new first-party BigQuery data analysis skill to the ADK framework. This skill provides structured, guided workflows and comprehensive reference materials, allowing agents to leverage both raw BigQuery tools and curated expertise. The primary goal is to standardize and improve the quality of data analysis workflows, thereby reducing the need for extensive manual prompt engineering and making BigQuery interactions more efficient and reliable for agents. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Response from ADK Triaging Agent Hello @caohy1988, thank you for your contribution! To move forward with your pull request, please address the following:
These steps are necessary to ensure your contribution can be reviewed and merged. Thank you! |
There was a problem hiding this comment.
Code Review
The pull request introduces a new 1P BigQuery skill for guided data analysis, which is a valuable addition for improving agent workflows. The design document, README, and skill content (SKILL.md, error_handling.md, schema_exploration.md, sql_patterns.md) are well-structured and provide clear guidance. The unit tests cover the skill's functionality and integration effectively. However, there are a couple of areas related to credential handling and string formatting in the sample agent that could be improved for better security and readability.
| credentials_config = BigQueryCredentialsConfig( | ||
| client_id="YOUR_CLIENT_ID", | ||
| client_secret="YOUR_CLIENT_SECRET", |
There was a problem hiding this comment.
Hardcoding client_id and client_secret directly in the agent.py file, even as placeholders, is not ideal for security and maintainability. It's best practice to load these sensitive credentials from environment variables or a secure configuration store to prevent accidental exposure and facilitate easier management across different environments.
| credentials_config = BigQueryCredentialsConfig( | |
| client_id="YOUR_CLIENT_ID", | |
| client_secret="YOUR_CLIENT_SECRET", | |
| credentials_config = BigQueryCredentialsConfig( | |
| client_id=os.environ.get("BIGQUERY_CLIENT_ID", "YOUR_CLIENT_ID"), | |
| client_secret=os.environ.get("BIGQUERY_CLIENT_SECRET", "YOUR_CLIENT_SECRET"), | |
| ) |
| pip install google-adk[bigquery] | ||
| ``` | ||
|
|
||
| 2. Set up OAuth credentials: |
There was a problem hiding this comment.
It's generally recommended to avoid hardcoding sensitive information like client_id and client_secret directly in code files, even if they are placeholders in a sample. This practice can lead to accidental exposure if not handled carefully. Consider suggesting the use of environment variables or a secure configuration management system for these credentials.
6cbdbae to
da6bf7c
Compare
Pre-packaged BigQuery data analysis skill following the agentskills.io specification. Users combine BigQueryToolset (raw tools) with SkillToolset (curated guidance) for progressive disclosure of workflow instructions and reference materials. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
da6bf7c to
e43e2aa
Compare
Refactor the design document for First-Party Skills for ADK Toolsets, emphasizing motivation, proposal, and implementation patterns.
|
Re: "There is no automatic inclusion" (DESIGN.md, Proposal §4) Automatic inclusion would change existing |
Canonical location is now google.adk.integration.bigquery. The old path google.adk.tools.bigquery.bigquery_skill remains as an alias for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Re: Directory Structure — moving skills to Done in 73c918b. Skill files now live at their canonical location under Both import paths work:
This establishes |
All BigQuery source files (toolset, credentials, client, config, tools) now live under google.adk.integration.bigquery as the canonical location. The old google.adk.tools.bigquery package is a thin alias that registers the canonical modules in sys.modules, ensuring full backward compatibility including mock.patch.object in existing tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Re: Directory Structure — moving BigQuery tools to Done in 3068d5e. All BigQuery source files (toolset, credentials, client, config, query/metadata/data-insights tools, skill, and skill directory) now live under the canonical location The old
This ensures full backward compatibility — all existing imports, DESIGN.md updated to reflect the new structure and backward-compatibility approach. |
|
Re: API ergonomics — An alternative to the two-line pattern: # Current (explicit, two toolsets)
bigquery_toolset = BigQueryToolset(credentials_config=creds)
bq_skill_toolset = SkillToolset(skills=[get_bigquery_skill()])
agent = LlmAgent(tools=[bigquery_toolset, bq_skill_toolset])
# Proposed (single flag)
bigquery_toolset = BigQueryToolset(credentials_config=creds, load_skills=True)
agent = LlmAgent(tools=[bigquery_toolset])Pros:
Cons:
Could be a good Phase 2 convenience on top of the current composable primitives. The explicit two-toolset pattern ships first as the foundation, then we can add the flag as sugar if the pattern proves too verbose in practice. |
BigQueryToolset(load_skills=True) automatically includes the 1P BigQuery skill tools alongside the raw BQ tools. Defaults to False for backward compatibility. The explicit SkillToolset pattern remains available for composing custom skill sets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Re: Why not Phase 1 — done. Added # Single-line UX
bigquery_toolset = BigQueryToolset(credentials_config=creds, load_skills=True)
agent = LlmAgent(tools=[bigquery_toolset]) # 10 BQ tools + 4 skill tools
|
Summary
BigQueryToolset(raw tools) withSkillToolset(curated guidance) for progressive disclosure of workflow instructions and reference materialsNew files (10)
src/google/adk/tools/bigquery/skills/bigquery-data-analysis/SKILL.mdsrc/google/adk/tools/bigquery/skills/bigquery-data-analysis/references/sql_patterns.mdsrc/google/adk/tools/bigquery/skills/bigquery-data-analysis/references/schema_exploration.mdsrc/google/adk/tools/bigquery/skills/bigquery-data-analysis/references/error_handling.mdsrc/google/adk/tools/bigquery/bigquery_skill.pyget_bigquery_skill()convenience loadercontributing/samples/1p_bigquery_skill/__init__.pycontributing/samples/1p_bigquery_skill/agent.pycontributing/samples/1p_bigquery_skill/README.mdcontributing/samples/1p_bigquery_skill/DESIGN.mdtests/unittests/tools/bigquery/test_bigquery_skill.pyTest plan
pytest tests/unittests/tools/bigquery/test_bigquery_skill.py -v— 7/7 tests pass_validate_skill_dirreturns empty problems list)./autoformat.shcleanadk web contributing/samples(requires BQ credentials)🤖 Generated with Claude Code