skillfed

bashkit

A sandboxed bash interpreter for AI agents

bashkit v0.16.0 272.1K downloads/30d#8,211 on PyPI236
Permissive license MIT Active released

What it is and what it does

Bashkit embeds a bash interpreter directly into Python via Rust native bindings, letting you execute bash scripts and commands in-process without spawning subprocesses or containers. It maintains persistent state (variables, working directory, virtual filesystem) across calls and includes 164 built-in commands like grep, sed, awk, jq, curl, and find. The package is designed for AI agents and automation workflows where you need fast, controlled bash execution with a virtual filesystem layer.

The interpreter supports full bash syntax—pipelines, redirects, loops, functions, arrays—and offers both synchronous and asynchronous execution modes. You can mount real filesystem paths (read-only or writable), pre-populate virtual files, stream output via callbacks, and control network access through an explicit allowlist. Credentials can be injected transparently or via environment variable placeholders. It integrates with LangChain, PydanticAI, and Deep Agents for agent-based workflows.

Use it for:

  • Run bash scripts inside AI agents without subprocess overhead or container orchestration.
  • Execute untrusted bash code in a sandboxed environment with controlled filesystem and network access.
  • Maintain bash interpreter state (variables, cwd, mounted files) across multiple Python function calls.
  • Stream live bash output during execution via callbacks for real-time monitoring or logging.
  • Inject secrets and credentials into bash scripts transparently without exposing them to the script itself.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Bashkit is a sandboxed bash interpreter for Python that runs bash scripts in-process with native bindings to a Rust core, providing full bash syntax support and 164 built-in commands without containers or subprocess overhead.

Yes, if you need in-process bash execution for AI agents or automation. The active maintenance, zero runtime dependencies, permissive MIT license, and no known vulnerabilities make it low-risk. Medium install friction (compiled wheels) is typical for Rust-backed packages and not a blocker. Verify performance and sandboxing guarantees match your threat model before deploying to production.

Install

bashkit on PyPI

pip

pip install bashkit

uv

uv add bashkit

poetry

poetry add bashkit

Installing bashkit

Before you install

Medium install friction due to compiled wheels (cp39-abi3 bindings across multiple platforms). Active maintenance with a release 7 days ago and 236 repository stars. Supports Python 3.9 through 3.14 with no runtime dependencies, making it straightforward to add once installed.

License in practice

MIT license (permissive) means you can use, modify, and distribute bashkit freely in commercial or proprietary projects with minimal restrictions—only attribution is required.

Quickstart

from bashkit import Bash

bash = Bash()
result = bash.execute_sync("echo 'Hello, World!'")
print(result.stdout)  # Hello, World!

Requires Python 3.9 or later; compiled wheels are provided for macOS (x86_64, arm64), Linux (x86_64, aarch64, musl), and Windows (x86_64).

Verify before relying

  • Performance characteristics and memory overhead compared to subprocess-based bash execution.
  • Completeness of the 164 built-in commands and edge cases in bash syntax compatibility.
  • Security audit status and threat model documentation for the sandboxing guarantees.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 7 days since the last release
Last repo commit
First released
Downloads 272,145/month — #8,211 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: bashkit-0.16.0-cp39-abi3-macosx_10_12_x86_64.whl; bashkit-0.16.0-cp39-abi3-macosx_11_0_arm64.whl; bashkit-0.16.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; bashkit-0.16.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; bashkit-0.16.0-cp39-abi3-musllinux_1_1_aarch64.whl; bashkit-0.16.0-cp39-abi3-musllinux_1_1_x86_64.whl; bashkit-0.16.0-cp39-abi3-pyemscripten_2025_0_wasm32.whl; bashkit-0.16.0-cp39-abi3-win_amd64.whl

Keywords: bash, sandbox, ai, agent, shell, interpreter

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: RustTopic :: SecurityTopic :: Software Development :: Interpreters

Tags

sandboxed bash interpreter pythonin-process bash executionbash sandbox for ai agentsvirtual filesystem bashbash scripting without subprocess
bash-sandboxai-agentsrust-bindings

More Security packages