Fast Python sandboxes for AI agents.
Project description
Backyard
Fast Python Sandbox for AI agent harnesses.
backyard supports transparent execution of Python code using either:
- Pydantic-Monty: an ultra-fast, minimal Python interpreter
- a container engine (Docker or Podman): full-featured Python support
Getting started
Installation
Using uv (recommended):
uv add backyard
Or, with pip:
pip install backyard
Python API
from pprint import pprint
from backyard import Sandbox
sandbox = Sandbox()
code = """
print("hello from the sandbox! 🏖🏰")
"""
result = sandbox.run(code)
pprint(result)
FAQ
Why did you create this?
Originally, I built the dual-engine sandbox for fine-tuning large language models using Reinforcement Learning from Verifiable Rewards (RLVR) with Group Relative Policy Optimization (GRPO). The sandbox provided an environment to safely execute model-generated code and generate rewards for training the model.
I then expanded the sandbox capabilities for use in the my-ai coding agent harness I am building.
Where does the name backyard come from?
The term "sandbox" refers to a controlled environment where untrusted code can be run safely.
In the physical world, a sandbox is a place where children explore and imagine as they create and shape the world around them. 🏖🏰
Where does one place a sandbox? In the backyard.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file backyard-0.1.0.tar.gz.
File metadata
- Download URL: backyard-0.1.0.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e6687745bd8be397ea92b7b7a05f5951c19fa521f26791b0b42a74afc566e1a
|
|
| MD5 |
f47d6eb96a9fe33370b638a0c3b2a162
|
|
| BLAKE2b-256 |
2dfef6b02814034294c20f27d431a2ffc897a9cbe14c5beb458ba10aad2754b0
|
Provenance
The following attestation bundles were made for backyard-0.1.0.tar.gz:
Publisher:
publish.yml on rparkr/backyard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
backyard-0.1.0.tar.gz -
Subject digest:
2e6687745bd8be397ea92b7b7a05f5951c19fa521f26791b0b42a74afc566e1a - Sigstore transparency entry: 2095598028
- Sigstore integration time:
-
Permalink:
rparkr/backyard@11e10553f3cf08ffa374e69306ceb82b45a9a84e -
Branch / Tag:
refs/tags/v0.1.0-alpha - Owner: https://github.com/rparkr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@11e10553f3cf08ffa374e69306ceb82b45a9a84e -
Trigger Event:
release
-
Statement type:
File details
Details for the file backyard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: backyard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46faf0e45bea2c83762c6efe8ff5fbbfd67bac24c47535363530ac0ee7302d64
|
|
| MD5 |
5a9aa3d4058433c5b27037dc633785b5
|
|
| BLAKE2b-256 |
c4a9eec5209ac070a689a86c76b992b3c3e04893ddec136ec54b7308e2fd26f6
|
Provenance
The following attestation bundles were made for backyard-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on rparkr/backyard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
backyard-0.1.0-py3-none-any.whl -
Subject digest:
46faf0e45bea2c83762c6efe8ff5fbbfd67bac24c47535363530ac0ee7302d64 - Sigstore transparency entry: 2095598380
- Sigstore integration time:
-
Permalink:
rparkr/backyard@11e10553f3cf08ffa374e69306ceb82b45a9a84e -
Branch / Tag:
refs/tags/v0.1.0-alpha - Owner: https://github.com/rparkr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@11e10553f3cf08ffa374e69306ceb82b45a9a84e -
Trigger Event:
release
-
Statement type: