Skip to content
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

Use uvx to make the tools executable scripts #46

Open
fmhall opened this issue Feb 5, 2025 · 3 comments
Open

Use uvx to make the tools executable scripts #46

fmhall opened this issue Feb 5, 2025 · 3 comments

Comments

@fmhall
Copy link

fmhall commented Feb 5, 2025

If you packaged and published the tools as scripts with uv, it would simplify the installation process and usage. The LLM could then just run uvx web_scraper... and not have to worry about dependencies

@grapeot
Copy link
Owner

grapeot commented Feb 6, 2025

Yeah I think that's a great idea. I will try to do this change this week.

@grapeot
Copy link
Owner

grapeot commented Feb 9, 2025

I'm not an uv expert, but after some research, I've got a few questions. As I understand it, uvx functions like temporary, implicit virtual environment management. It offers the convenience of not having to manually create or manage any virtual environments. However, if we're looking to do something more long-term, it may be better to explicitly manage a virtual environment using tools like pip, uv, or poetry.

So my current concern is more about balancing the initial setup convenience against the long-term maintainability. Given that our current approach works reasonably well and strikes a balance between these two aspects, I lean towards saying that uv is a superior all-in-one Python management tool in the doc. It's encouraged to use uv, but not to mandate it—especially with uvx. What do you think?

@fmhall
Copy link
Author

fmhall commented Feb 11, 2025

uv is definitely great. My initial thinking was that if you could do something like this:

Install flow:

  1. Get uv if you don't have it already
  2. Copy some rules files to your local

Thats actually it. Users don't even need to download the tools.

Then when the agent invokes the tools, they do so like:

uvx llm_api --prompt "Your verification question" --provider {openai|anthropic} --image path/to/screenshot.png

And uvx handles the creation of the env in the background for them. Whereas with uv only, the users still need to install the tools.

However, if we're looking to do something more long-term, it may be better to explicitly manage a virtual environment using tools like pip, uv, or poetry.

My understanding is that uvx does some seriously aggressive caching the first time it's called, which would essentially mean that once it's called the first time, it has slim to no overhead compared to the alternatives.

So you still get all the benefits of uv, but without the headache and friction of having to have that dedicated environment, since uvx is caching all that stuff behind the scenes. Plus, it's incredibly fast (go Rust!).

Either way, worth some experimentation, but I think you will be pleasantly surprised!

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

No branches or pull requests

2 participants