bashkit

Get started in Python#

Embed the Bashkit sandbox in a Python application or agent. The package ships as pre-built binary wheels on PyPI — install and go, no Rust toolchain needed.

Install#

pip install bashkit

First script#

from bashkit import Bash

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

Persistent state#

A Bash instance keeps its environment and virtual filesystem across calls:

from bashkit import Bash

bash = Bash()
bash.execute_sync("export APP_ENV=dev")
print(bash.execute_sync("echo $APP_ENV").stdout)  # dev

Sync vs async#

execute_sync() runs scripts that complete without suspending — plain bash and jq. If you register an async custom builtin (e.g. one that issues an HTTP request), use the awaitable execute() instead:

result = await bash.execute("echo hi | my_async_tool")

Embedded Python#

Bashkit can also run Python inside the shell via the embedded Monty runtime — enable it with Bash(python=True). That is a different feature from embedding Bashkit in your Python app; see the Python builtin guide.

Examples#

Runnable Python examples in the repo:

Next steps#