Skip to main content

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


Download files

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

Source Distribution

backyard-0.1.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

backyard-0.1.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

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

Hashes for backyard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e6687745bd8be397ea92b7b7a05f5951c19fa521f26791b0b42a74afc566e1a
MD5 f47d6eb96a9fe33370b638a0c3b2a162
BLAKE2b-256 2dfef6b02814034294c20f27d431a2ffc897a9cbe14c5beb458ba10aad2754b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for backyard-0.1.0.tar.gz:

Publisher: publish.yml on rparkr/backyard

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

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

Hashes for backyard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46faf0e45bea2c83762c6efe8ff5fbbfd67bac24c47535363530ac0ee7302d64
MD5 5a9aa3d4058433c5b27037dc633785b5
BLAKE2b-256 c4a9eec5209ac070a689a86c76b992b3c3e04893ddec136ec54b7308e2fd26f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for backyard-0.1.0-py3-none-any.whl:

Publisher: publish.yml on rparkr/backyard

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