Spin Framework¶
Spin is a WebAssembly framework for building serverless applications. DeepFabric uses Spin to run tool execution in isolated sandboxes.
Installation¶
macOS¶
Linux¶
Verify¶
Building Components¶
Navigate to the tools-sdk directory and build:
This compiles all Rust components to WebAssembly. Build output:
- components/vfs/target/wasm32-wasip1/release/vfs.wasm
- components/mock/target/wasm32-wasip1/release/mock.wasm
Running the Service¶
The service starts at http://localhost:3000.
Custom Port¶
Background Mode¶
Endpoints¶
| Endpoint | Method | Description |
|---|---|---|
/vfs/execute |
POST | Execute VFS tool |
/vfs/health |
GET | Health check |
/vfs/components |
GET | List VFS tools |
/vfs/session/{id} |
DELETE | Clean up session |
/mock/load-schema |
POST | Load tool definitions |
/mock/execute |
POST | Execute mock tool |
/mock/list-tools |
GET | List loaded tools |
Testing¶
Verify the service is running:
Execute a tool:
curl -X POST http://localhost:3000/vfs/execute \
-H "Content-Type: application/json" \
-d '{
"session_id": "test-123",
"tool": "write_file",
"args": {"file_path": "hello.txt", "content": "Hello, World!"}
}'
# {"success":true,"result":"Successfully wrote 13 bytes to hello.txt"}
Configuration¶
The spin.toml file defines components and routes:
spin_manifest_version = 2
[application]
name = "deepfabric-tools"
version = "0.1.0"
[[trigger.http]]
route = "/vfs/..."
component = "vfs"
[component.vfs]
source = "components/vfs/target/wasm32-wasip1/release/vfs.wasm"
key_value_stores = ["default"]
Troubleshooting¶
Port already in use
Build failures
Permission errors