Skip to content

chore(toolbox-core): Create helper sync tool and sync client protected methods to load tools and return future #234

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

Closed
wants to merge 19 commits into from

Conversation

anubhav756
Copy link
Contributor

@anubhav756 anubhav756 commented May 9, 2025

This change adds protected helper methods to return a future while loading tool/toolset.

These helpers are intended for use in an upcoming PR (#229) where we wrap toolbox-langchain onto toolbox-core.

@anubhav756 anubhav756 self-assigned this May 9, 2025
@anubhav756 anubhav756 requested a review from a team as a code owner May 9, 2025 19:20
@anubhav756 anubhav756 changed the title chore: Make sync tool member variables protected chore: Make sync tool private members protected read-only May 9, 2025
@anubhav756 anubhav756 changed the title chore: Make sync tool private members protected read-only chore: Expose sync tool private members as read-only protected members May 9, 2025
@anubhav756 anubhav756 changed the title chore: Expose sync tool private members as read-only protected members chore: Expose sync tool and sync client private members as read-only protected members May 9, 2025
@anubhav756 anubhav756 changed the title chore: Expose sync tool and sync client private members as read-only protected members chore(toolbox-core): Expose sync tool and sync client private members as read-only protected members May 9, 2025
@anubhav756 anubhav756 changed the title chore(toolbox-core): Expose sync tool and sync client private members as read-only protected members chore(toolbox-core): Expose sync/async tool and sync client private members as read-only protected members May 9, 2025
@anubhav756 anubhav756 force-pushed the anubhav-perm-error branch from d12c73e to 7c61263 Compare May 12, 2025 14:14
@anubhav756 anubhav756 force-pushed the anubhav-protected branch from b55bf7a to 266291e Compare May 12, 2025 14:14
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.

Could we get some more explanation? Why do we want to expose these are properties? Do we need to access them outside of the class? What's an example of the intended use?

My concern is we are taking internal implementation details and turning them into public APIs, which limits how we can change things in the future.

@anubhav756 anubhav756 force-pushed the anubhav-perm-error branch from 7c61263 to 4b52872 Compare May 13, 2025 11:42
@anubhav756 anubhav756 force-pushed the anubhav-protected branch 2 times, most recently from 897f627 to 4351473 Compare May 14, 2025 12:42
@anubhav756 anubhav756 force-pushed the anubhav-perm-error branch from 4b52872 to 09c0de1 Compare May 14, 2025 12:42
@anubhav756
Copy link
Contributor Author

anubhav756 commented May 14, 2025

Could we get some more explanation? Why do we want to expose these are properties? Do we need to access them outside of the class? What's an example of the intended use?

My concern is we are taking internal implementation details and turning them into public APIs, which limits how we can change things in the future.

These properties are intended for use in an upcoming PR (#229) where we wrap toolbox-langchain onto toolbox-core. Specifically, toolbox-langchain will need to access toolbox-core's event loop/thread via these properties to schedule tasks and ensure operations run in the correct context. (screenshot & screenshot).

Added this to the PR's description as well.

@anubhav756 anubhav756 requested a review from kurtisvg May 14, 2025 12:53
@kurtisvg
Copy link
Contributor

These properties are intended for use in an upcoming PR (#229) where we wrap toolbox-langchain onto toolbox-core. Specifically, toolbox-langchain will need to access toolbox-core's event loop/thread via these properties to schedule tasks and ensure operations run in the correct context. (screenshot & screenshot).

Added this to the PR's description as well.

Thanks for the additional context. I looked at the other PR and am concerned it's not the right approach.

Can we just use asyncio.to_thread instead? In this scenario, we don't have to worry about the connection pool passing through the thread/loop boundary.

Alternatively, we could add async functions to the sync classes so they can be used for both.

@anubhav756 anubhav756 force-pushed the anubhav-protected branch 2 times, most recently from 12c725b to 65e8fab Compare May 16, 2025 15:47
@anubhav756 anubhav756 force-pushed the anubhav-perm-error branch from 09c0de1 to 090a02a Compare May 16, 2025 15:50
@anubhav756
Copy link
Contributor Author

These properties are intended for use in an upcoming PR (#229) where we wrap toolbox-langchain onto toolbox-core. Specifically, toolbox-langchain will need to access toolbox-core's event loop/thread via these properties to schedule tasks and ensure operations run in the correct context. (screenshot & screenshot).
Added this to the PR's description as well.

Thanks for the additional context. I looked at the other PR and am concerned it's not the right approach.

Can we just use asyncio.to_thread instead? In this scenario, we don't have to worry about the connection pool passing through the thread/loop boundary.

Alternatively, we could add async functions to the sync classes so they can be used for both.

Thanks for the suggestions. I resonate more with adding async functions to sync classes (I've made them protected funcs for now), and was able to remove the properties that expose internal state. Hope that alleviates your concerns 🙂

@anubhav756 anubhav756 changed the title chore(toolbox-core): Expose sync/async tool and sync client private members as read-only protected members chore(toolbox-core): Create helper sync tool and sync client protected methods to load tools and return future May 16, 2025
@anubhav756 anubhav756 force-pushed the anubhav-perm-error branch from 090a02a to c6e67f5 Compare May 16, 2025 19:47
@anubhav756 anubhav756 force-pushed the anubhav-protected branch from 0a9cc0e to 2f29249 Compare May 16, 2025 19:49
Base automatically changed from anubhav-perm-error to main May 16, 2025 19:50
This change introduces a warning that is displayed immediately before a tool invocation if:
1. The invocation includes an authentication header.
2. The connection is being made over non-secure HTTP.

> [!IMPORTANT]
The purpose of this warning is to alert the user to the security risk of sending credentials over an unencrypted channel and to encourage the use of HTTPS.
@anubhav756 anubhav756 force-pushed the anubhav-protected branch from 2f29249 to 6ead1af Compare May 16, 2025 19:51
@anubhav756 anubhav756 force-pushed the anubhav-protected branch from 6ead1af to 0754b99 Compare May 16, 2025 20:22
@anubhav756
Copy link
Contributor Author

Per offline discussion, we are changing the approach to use asyncio.to_thread() in the wrapping toolbox-langchain async interfaces. So this PR essentially is not required at all since no helpers or additional changes are required in the toolbox-core package. The changes in the toolbox-langchain package are done in #229.

@anubhav756 anubhav756 closed this May 16, 2025
@anubhav756 anubhav756 deleted the anubhav-protected branch May 16, 2025 20:38
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.

2 participants