You are not logged in.

#1 2025-07-08 22:45:29

Succulent of your garden
Member
From: Majestic kingdom of pot plants
Registered: 2024-02-29
Posts: 871

writing python with Rust integration

So I'm doing this:  https://paste.ofcode.org/tLtKTWtAsfFj8M2wAMEr7t

It's still a "prototype", since I need to fix the scrolling with the mouse of the text output, but apart from that, and adding the tool for letting the LLM to surf the internet, I'm creating this agent in python so I can use it daily to do basic web search stuff, and also to  learning how to do agents.

Probably someone could say why you  just use the web browser? And you are probably right, in many cases I will use a web browser and the search engine directly to do my searching, but I must say that this project probably I'm going to use it to search for news. Like creating a fast resume of international news for example, to not be so disconnected from the world, but also not watching mainstream media news, which is annoying and unpleasant for me, and only watching it when the news I think requires it.

So after creating the agent I need to transform that code from python and probably create a Rust GUI or TUI  interface. I can't avoid python since most of the LLM agent stuff is in python or javascript, but it seems something like maturin in Rust could work.  I would like to compile this program [with the python script also] to have my binary and install it in my system, so when I want to check the world or check something like if there is a tornado somewhere, I can just open a terminal quickly and use the agent, to know more about it, without touching the browser and doing the manual searching. So while the agent is searching I can focus in working or doing other stuff.

The problem is that I don't know how to create a single binary in this scenario, since the python code will be like the backend of the software, and Rust will be used to create the user interface. There are many GUI and TUI libraries in Rust, which I don't know which one could be useful for me, any help in that will be very much appreciated.

Not necessarily need to be 100% compiled, for example I can launch a script with a hotkey in my window manager if that's seems possible, but I think if I just compile the whole project would be far more better.

So by any advice and orientation in this, many thanks in advance smile

EDIT: if you are interested in trying the code, you just need to create a virt env and install pydantic ai. Curses come by default in Linux and not in windows, but I believe that here nobody is going to try it in windows tongue

Last edited by Succulent of your garden (2025-07-08 22:56:16)


str( @soyg ) == str( @potplant ) btw!

Online

Board footer

Powered by FluxBB