Skip to main content

Tools for your AI agents

Project description

SpadeBox

The Spadebox logo
Sandboxed tools and JS runtime for your AI agents

crates.io version NPM version PyPI version


SpadeBox is a set of sandboxed tools and a JS runtime for AI agents, written in Rust with JavaScript and Python bindings. Focus on your domain-specific tools and harness — give your agent SpadeBox for the rest.

Category Tools
Files read_file, write_file, edit_file, move, grep, glob
Network fetch
Code execution js_repl, js_exec

Features

  • Lightweight sandboxing: SpadeBox uses the cap-std crate for file system sandboxing, and domain allowlisting for HTTP requests. The JS engine is based on boa, and uses the same sandboxing policies.
  • Configurable: Pick only the tools you need for your application: files, network, or code execution, or any combination of those.
  • No bash tool: SpadeBox has been designed to work well even without a bash tool. The tools are designed to cover all the basic operations an agent needs without having to shell-out. If you would like your agent to use bash you can provide your own bash tool in addition to SpadeBox.
  • Native function in JS runtime: Expose native functions to the SpadeBox JS runtime to allow your agents to programmatically interact with your application. Compatible with all supported host language bindings.
  • Secret management for HTTP requests: Register credentials for specific HTTP domains and get a token that can be safely shared with your agent. Spadebox replaces the token by the actual secret within HTTP requests to the target domain.
  • Default limits to preserve context: SpadeBox's tools try to safeguard your agent context, with default limits to tool outputs and HTML-to-markdown conversion.

Usage

JavaScript

import { SpadeBox } from "@spadebox/spadebox";

const sb = new SpadeBox()
  .enableFiles("/workspace")
  .enableHttp()
  .allow("api.example.com", ["GET", "POST"])
  .enableJs();

const tools = sb.tools(); // pass to your LLM as available tools

// dispatch a tool call coming from the model
const result = await sb.callTool("read_file", JSON.stringify({ path: "src/main.rs" }));

Rust

use spadebox_core::{Sandbox, DomainRule, HttpVerb, enabled_tools, call_tool};

let mut sandbox = Sandbox::new();
sandbox
    .enable_fs("/workspace")?
    .enable_http()
    .allow(DomainRule::new("api.example.com", vec![HttpVerb::Get, HttpVerb::Post])?)
    .enable_js();

let tools = enabled_tools(&sandbox); // pass to your LLM as available tools

// dispatch a tool call coming from the model
let result = call_tool(&sandbox, "read_file", r#"{"path":"src/main.rs"}"#.into()).await?;

Python

from spadebox import SpadeBox

sb = (SpadeBox()
    .enable_files("/workspace")
    .enable_http()
    .allow("api.example.com", ["GET", "POST"])
    .enable_js())

tools = sb.tools()  # pass to your LLM as available tools

# dispatch a tool call coming from the model
result = sb.call_tool("read_file", '{"path": "src/main.rs"}')

MCP

# filesystem tools only
spadebox-mcp --files /workspace

# HTTP tools only (allow specific domains and verbs)
spadebox-mcp --allow "api.example.com:GET,POST" --allow "*.cdn.example.com:GET"

# JavaScript REPL only
spadebox-mcp --js

# all tools
spadebox-mcp --files /workspace --allow "api.example.com:GET" --js

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spadebox-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

spadebox-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

spadebox-0.5.1-cp39-abi3-macosx_11_0_arm64.whl (5.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file spadebox-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spadebox-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba264864498491fea440d8855e1a5fc9d5ddf9b7baa130efedb2246d9215b7e2
MD5 e34552478b0102929c032215cbcd8448
BLAKE2b-256 4448c396cf921b299bd64925a282970dc63c00a2439984dba77f9d14fe2d64a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for spadebox-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on CharlyCst/spadebox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spadebox-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spadebox-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 772da30258c5ccd49fcf4df199c57b931b5a3b1d601b9d63f94fb61a973590fd
MD5 a2cc57b50ac12647559e3ae5f724c491
BLAKE2b-256 50c9f17729e42c0f46da2c6bfc605e82045b8447374fe0955c94e22da2d0546b

See more details on using hashes here.

Provenance

The following attestation bundles were made for spadebox-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on CharlyCst/spadebox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spadebox-0.5.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spadebox-0.5.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e96b496a58432a3613ab6c2f5e4cf8888c1cad253e01ead1b2f2de199a7e5d5
MD5 e12505ea42743a3e199da81cf11ba389
BLAKE2b-256 8eec16613c0549f1ec031b14d1b507c4bb015870c75bc68d8651e3cad8b4680b

See more details on using hashes here.

Provenance

The following attestation bundles were made for spadebox-0.5.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on CharlyCst/spadebox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page