Skip to content

chore(core): update __parse_tool to return which parameters were bound and authenticated #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

anubhav756
Copy link
Contributor

This commit introduces functionality to the parse_tool helper to identify and report which bound and authentication keys are actively used during tool parsing. This is a foundational step towards implementing a more robust and predictable client through a new strict mode.

The ability to determine used keys will allow the client to:

  • Provide errors when users supply unnecessary authentication or bound parameters (in non-strict mode).
  • Enforce that all provided authentication and bound parameters are consumed by the loaded tools, ensuring no extraneous or potentially misleading information is present (in strict mode).

@anubhav756 anubhav756 self-assigned this Apr 21, 2025
@anubhav756 anubhav756 marked this pull request as ready for review April 21, 2025 12:16
@anubhav756 anubhav756 requested a review from a team as a code owner April 21, 2025 12:17
@anubhav756 anubhav756 force-pushed the anubhav-auth-token-getter branch from 508c460 to a37e5cc Compare April 21, 2025 12:21
Copy link
Contributor

@kurtisvg kurtisvg left a comment

Choose a reason for hiding this comment

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

I think this PR is doing a couple of different things that would be better done separately.

  1. Adding "add_auth_token_getters" to langchain-toolbox (and deprecating 'add_auth_tokens'
  2. Adding two additional returns to "__parse_tool" helper function in the ToolboxTool class.

It's important we separate these, the first is a breaking breaking change and the second is an internal refactor building up to some other changes?

@kurtisvg
Copy link
Contributor

Alright, I'm slightly confused on what this PR presents -- I see #182, but the diff seems to show the diff vs main?

@anubhav756 anubhav756 force-pushed the anubhav-auth-token-getter branch 3 times, most recently from 508c460 to 2388dc9 Compare April 21, 2025 16:11
@anubhav756
Copy link
Contributor Author

I think this PR is doing a couple of different things that would be better done separately.

  1. Adding "add_auth_token_getters" to langchain-toolbox (and deprecating 'add_auth_tokens'
  2. Adding two additional returns to "__parse_tool" helper function in the ToolboxTool class.

It's important we separate these, the first is a breaking breaking change and the second is an internal refactor building up to some other changes?

I remember I had bifurcated these PRs 🤔

@anubhav756
Copy link
Contributor Author

Alright, I'm slightly confused on what this PR presents -- I see #182, but the diff seems to show the diff vs main?

I think that was because I hadn't yet pushed the base PR. Can you check now. Thanks! 🙂

@anubhav756 anubhav756 requested a review from kurtisvg April 21, 2025 16:15
@anubhav756 anubhav756 force-pushed the anubhav-parse-tool-used branch from 5d59af9 to e841bc1 Compare April 21, 2025 16:17
@kurtisvg kurtisvg changed the title feat: Introduce Tracking of Used Auth and Bound Keys in parse_tool for Client Strictness chore(core): update __parse_tool to return which parameters were bound and authenticated Apr 21, 2025
@twishabansal
Copy link
Contributor

Just pushed the feat to add headers to Toolbox: #178.

Should we also return the client headers along with the bound and the auth params?

@anubhav756 anubhav756 force-pushed the anubhav-auth-token-getter branch 2 times, most recently from c1f1e27 to d0d61f5 Compare April 29, 2025 10:28
Base automatically changed from anubhav-auth-token-getter to main April 29, 2025 10:30
…r Client Strictness

This commit introduces functionality to the `parse_tool` helper to identify and report which bound and authentication keys are actively used during tool parsing. This is a foundational step towards implementing a more robust and predictable client through a new `strict` mode.

The ability to determine used keys will allow the client to:

* Provide errors when users supply unnecessary authentication or bound parameters (in non-`strict` mode).
* Enforce that all provided authentication and bound parameters are consumed by the loaded tools, ensuring no extraneous or potentially misleading information is present (in `strict` mode).
@anubhav756 anubhav756 force-pushed the anubhav-parse-tool-used branch from e841bc1 to 9a0c077 Compare April 29, 2025 10:41
@anubhav756
Copy link
Contributor Author

Just pushed the feat to add headers to Toolbox: #178.

Should we also return the client headers along with the bound and the auth params?

Currently, we return the bound keys and auth keys used during tool loading. This logic doesn't directly apply to client headers. Client headers are inherently part of the tool's invocation request, guaranteeing their presence. Therefore, unlike bound and auth keys, there's no immediate need to validate their usage. Consequently, this PR won't return client headers from the helper function. We can revisit this in a future PR if we decide to introduce client header validation (e.g., specifying required headers in the tools file).

@anubhav756 anubhav756 merged commit edd1f3a into main Apr 29, 2025
19 checks passed
@anubhav756 anubhav756 deleted the anubhav-parse-tool-used branch April 29, 2025 10:54
@release-please release-please bot mentioned this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants