How to use with Vercel AI SDK and sandbox?

main
8b8f888Add FAQ entry for `git worktrees` (#193)
This post might have stale content, as main is 301 commits ahead.

how can i use this with the vercel ai sdk and within a vercel sandbox?

use case: i'm building a "chat with a github repo" product in which posts/threads can be done to a different git ref, but will use the same sandbox (we'll clone the repo at that ref and place it in a specific worktree). then i want the agent's edits to live in a specific agentfs database. the database should be persisted to the sandbox itself (that's done automatically by vercel sandbox, or will be done soon). help me build this.

Avatar of julianbenegas
Julian Benegas
commented

nice! why do we need just-bash with this setup? vs creating our own bash tool?

Avatar of julianbenegas
Julian Benegas
commented

i'm confused: so the overaly aspect is not an agentfs feature? like if i run agentfs run --session <> -- rm -rf: what will happen? and i mean without just-bash.

Avatar of julianbenegas
Julian Benegas
commented

nice. yeah aligned that just cli is the best! cool, that's clear. one other thing i'm confused about: can i run many concurrent "sessions" at the same time? which target the same worktree? will they conflict?

Avatar of julianbenegas
Julian Benegas
commented

brilliant! really noice. ok, outline a simple plan for implementing this myself. assume the whole setup is there (except for the Bash tool (i don't wanna use just-bash btw) and the agentfs setup). in fact, see what's there https://forums.basehub.com/basehub-ai/forums/1

Avatar of julianbenegas
Julian Benegas
commented

what about Linux OverlayFS? can i just use that if i have the sandbox to myself?


REPLY IN THREAD
Avatar of julianbenegas
Julian Benegas
commented

the permission is the most compelling thing IMO. agentfs run ensures all mutations go to the db, even if the agent was prompt injected and CDs into another dir


REPLY IN THREAD
Avatar of julianbenegas
Julian Benegas
commented

if i do agentfs run -- <complex command to go to root and rm -rf>, what protects root from not being deleted?


REPLY IN THREAD
Avatar of julianbenegas
Julian Benegas
commented

does bubblewrap achieve the same security guarantees?


REPLY IN THREAD

END OF POST

How to use with Vercel AI SDK and sandbox? — tursodatabase/agentfs