Skip to content

Conversation

ronpal
Copy link
Contributor

@ronpal ronpal commented Sep 8, 2025

Description

Adding version to the QueryKnowledgeGraphAgentToolConfiguration to be on par with the API. Chose not to go with enum since string is more future-proof.

Screenshot 2025-09-08 at 12 13 05

Please describe the change you have made.

Checklist:

  • [] Tests added/updated.
  • Documentation updated. Documentation is generated from docstrings - these must be updated according to your change.
    If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • The PR title follows the Conventional Commit spec.

@ronpal ronpal requested review from a team as code owners September 8, 2025 10:16
Copy link
Contributor

Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.78%. Comparing base (317439b) to head (d86c965).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2324      +/-   ##
==========================================
- Coverage   90.78%   90.78%   -0.01%     
==========================================
  Files         170      170              
  Lines       25662    25665       +3     
==========================================
+ Hits        23297    23299       +2     
- Misses       2365     2366       +1     
Files with missing lines Coverage Δ
cognite/client/data_classes/agents/agent_tools.py 98.42% <100.00%> (+0.02%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@andeplane andeplane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have yet not tested it, but see comment about string literal

Args:
data_models (Sequence[DataModelInfo] | None): The data models and views to query.
instance_spaces (InstanceSpaces | None): The instance spaces to query.
version (str | None): The version of the query generation strategy to use. A higher number does not necessarily mean a better query.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would maybe like that we have string literals v1 or v2 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andeplane I considered that, but it gives a tight coupling that needs to be updated again for example if there comes a "v3". On the other hand, string literals is better guidance to the user. How frequently do we expect new versions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must not break old SDK versions if the API suddenly returns v3 etc, so as long as we in docstrings cover valid values (v1 and v2 as of today), and no default value since old agents before we added this field may have no value set (effectively v1 behaviour), we should not overwrite with a v2 default.

andeplane
andeplane previously approved these changes Sep 8, 2025
Copy link
Contributor

@andeplane andeplane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice

@doctrino doctrino self-requested a review September 8, 2025 11:10
doctrino
doctrino previously approved these changes Sep 8, 2025
@doctrino doctrino added the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Sep 8, 2025
@haakonvt haakonvt added the risk-review-ongoing Risk review is in progress label Sep 9, 2025
@haakonvt
Copy link
Contributor

haakonvt commented Sep 9, 2025

Risk review: One outstanding comment from Erlend to be addressed, then ready for unicorn 😄

@haakonvt haakonvt added waiting-for-team Waiting for the submitter or reviewer of the PR to take an action and removed waiting-for-risk-review Waiting for a member of the risk review team to take an action labels Sep 9, 2025
@haakonvt haakonvt self-assigned this Sep 9, 2025
@ronpal ronpal changed the title chore: include version configuration for agent TOOL chore: include version configuration for agent tool Sep 26, 2025
@ronpal ronpal added waiting-for-risk-review Waiting for a member of the risk review team to take an action and removed waiting-for-team Waiting for the submitter or reviewer of the PR to take an action labels Sep 26, 2025
@haakonvt
Copy link
Contributor

haakonvt commented Oct 3, 2025

@ronpal sorry for not getting back to you sooner, please ping me on slack for follow-up on risk review if it takes more than 1 hour 😜

Re. @erlendvollset comment above:

Shouldn't have default values for read classes, it just makes their instantiation more error prone.

When I take a look at the class:
class QueryKnowledgeGraphAgentToolConfiguration(WriteableCogniteResource):
...this looks like a write-version-class, no?

Also, from your screenshot, it seems like data_models is required, but instance_spaces and version are not.

If all of this is true, I think the correct solution is to add back default arg = None for the latter and require only the first.

@haakonvt haakonvt added waiting-for-team Waiting for the submitter or reviewer of the PR to take an action and removed waiting-for-risk-review Waiting for a member of the risk review team to take an action labels Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants