Add filesystem tools for AI agents#651
Open
pushpak1300 wants to merge 1 commit into
Open
Conversation
|
Makes a lot of sense to give agents (bounded) file system access. Also rounds out the previously confusing difference between giving agents: |
bdc788c to
a8a35aa
Compare
|
I kinda liked and it would replace a few agents which I build myself. But I also would like to see some concrete usage examples in the docs. In the future, would be good to have another page in Laravel Docs with explicit tools and how to use it, like we have to Arr/Helpers etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently there's no built-in way to give an agent access to a Laravel filesystem disk. If you want an agent that can browse, read, or manage files on a
Storagedisk, you have to hand-roll aToolfor every operation.This PR adds a set of
Storage-backed tools (modeled on files-sdk) and aFileStorageToolsfactory, so you can hand a set to an agent:Both return a
Collection, so you can narrow further:Every tool takes a disk name or
Filesysteminstance (default disk if omitted), so you can sandbox an agent to a folder with Laravel'sscopeddriver and it cannot escape it. Tools are#[Strict], descriptions are written for tool-calling, and there are end to end tests (agent prompt to real disk side effect) usingStorage::fake().