Skip to main content

Tools for your AI agents

Project description

Spadebox   crates.io version NPM version

The Spadebox logo

Spadebox is a set of common tools for AI agents, written in Rust with JavaScript and Python bindings.

Currently, Spadebox includes the following tools:

  • read_file
  • write_file
  • edit_file
  • move
  • grep
  • glob
  • fetch
  • js_repl
  • js_exec

Spadebox uses the cap-std crate for file system sandboxing, and domain whitelisting for HTTP requests. The JS engine is based on boa, and use the same sandboxing policies.

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.4.0-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.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

spadebox-0.4.0-cp39-abi3-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for spadebox-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0176fa4760a19067c74d710dc9875494e0a63cb5522e74353affe220c35957fc
MD5 3da842390fea6d774d3ac144ef954664
BLAKE2b-256 5faf58f1b8cdbe4f8326e2fa2bd8cac1e7146930c9eb675d8e527f7ca2615065

See more details on using hashes here.

Provenance

The following attestation bundles were made for spadebox-0.4.0-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.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spadebox-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d6cd31cf19021f35d3ba0122843a442aa797b1c3c6287c31653b2f2f96627efb
MD5 e5dfb61593bed5dfa115ab8aa480a754
BLAKE2b-256 5a23ca4b968c1e6e4eda3d01c1f28e23e6c37949c3c1e86476491d1688adaf2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for spadebox-0.4.0-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.4.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spadebox-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca239b6c406bee50e9e918242f575e6a9ccce359835e26a38b40fc8653cbe49a
MD5 9b4fc7d291f0a9ae8c79ef849097dabf
BLAKE2b-256 5280ee91a128ce5c28980792d7547b55f26df12390cec1651596ca56fb30d7df

See more details on using hashes here.

Provenance

The following attestation bundles were made for spadebox-0.4.0-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