Persistent Tools registry?
Is there an easy built-in way to persist registered Tools across restarts/exports? From what I see, Tools are added at runtime (@tool / tree.add_tool) and aren’t stored in the backend, which makes it hard to let users add custom tools from the frontend (they need re-registration on startup).
Would Elysia consider supporting:
-
a small persistent registry (DB/Weaviate/JSON) for tool metadata + binding (module:function or remote endpoint), and
-
autoload on startup / export-import with tools?
If I’m missing an existing pattern or API to do this, I’d love a pointer. Thanks!
We currently do have the functionality ready to do this - there is a file inside elysia/api called custom_tools.py which you can use to import tools, and endpoints on the backend which add/remove/change tools on the tree, finding tools in that file. However storing any custom tools that aren't part of the default Elysia install is a challenge which we are looking to solve:
- If we store a
module:functionbinding to the tools location, then if you reinstall or update Elysia and try to access your old conversations with those tools, it won't find the old tools and the tree will be out of sync with what it was originally - We want to keep Elysia completely self contained, so a remote endpoint might be tricky to manage in a similar way
One option would be to implement a remote endpoint, like you suggest, similar to where conversations/configs are being saved (on a Weaviate collection), but it might require storing python code as a string, and retrieving and re-running it to find tool classes on Elysia startup. But this could be a security vulnerability if someone injected arbitrary code into that collection, and it doesn't seem like the most robust/scalable solution.
Happy to hear any ideas or suggestions if you can think of a feasible way to do this!