Fystash lets you create multi-agent sandbox rooms from Convex actions: spawn agents, write a shared drive, exec commands, and destroy rooms programmatically.
npm install @fystash_ai/convexFystash provides a Convex component that lets you call fystash.runFleet from a Convex action, spawning named agents like 'scout' and 'drafter' into an isolated room. You pass agentIds, a shared drive path and content, an exec command, and optionally set destroyAfter to clean up automatically. The entire multi-agent lifecycle is handled from within the action handler.
The Fystash Convex component includes a driveWrite step that writes content to a path on the room's shared drive before agents execute. All agents spawned into the same room can access this shared drive, so you can pre-populate files like configuration or prompts that multiple agents read during exec.
Install @fystash_ai/convex and @fystash_ai/sdk, then register the component in convex/convex.config.ts using app.use(fystash, { env: { FYSTASH_API, FYSTASH_API_KEY } }). Set FYSTASH_API and FYSTASH_API_KEY in the Convex dashboard or .env.local, and pass them explicitly through app.use because Convex components are isolated from the app environment.
When using fystash.runFleet from the Fystash Convex component, you can pass destroyAfter: true to automatically tear down the room after the exec step completes. If you are composing steps manually, call fystash.destroy at the end of your action handler after exec returns.
The @fystash_ai/convex component wraps the Fystash multi-agent sandbox API and exposes it as a Convex component callable from Convex actions. It lets you create isolated rooms, spawn one or more named agents, write files to a shared drive, execute commands inside the room, and destroy the room when done. All of this happens inside a Convex action handler using the Fystash class.
Convex components are isolated from the parent app's environment, so you cannot rely on process.env directly inside the component. You must pass FYSTASH_API and FYSTASH_API_KEY through the app.use call in convex.config.ts using app.env references. Set the actual values in the Convex dashboard under environment variables, or in .env.local when running convex dev locally.
Yes. The Fystash Convex component exposes individual methods: createRoom, spawn, spawnMany, driveWrite, exec, and destroy. You can call these in sequence from a Convex action if you need finer control over the agent lifecycle, such as conditionally spawning agents or handling exec results before deciding whether to destroy the room.
You need both @fystash_ai/convex and @fystash_ai/sdk. The SDK provides the shared FystashSession used internally by the component. Install both with npm i @fystash_ai/convex @fystash_ai/sdk, then register the component in convex/convex.config.ts.
Fystash operations involve calling the external Fystash API, which requires network access. In Convex, only actions can call third-party services and external APIs. Fystash component methods must be called from within a Convex action handler, not from queries or mutations.