The Buildfunctions SDK for AI Agents - Hardware-isolated CPU and GPU Sandboxes for untrusted AI actions.
# TypeScript / JavaScript
npm install buildfunctions
# or
yarn add buildfunctions
# or
pnpm add buildfunctions
# Python
pip install buildfunctionsUses Claude to generate a sorting function, then executes and scores it inside an isolated CPU sandbox with a reward function that checks correctness and edge case handling.
Files:
python/anthropic/agent-sandbox-reward-function/main.py- Main example: generate code with Claude, evaluate in a sandboxpython/anthropic/agent-sandbox-reward-function/reward_handler.py- Reward function template that scores generated codepython/anthropic/agent-sandbox-reward-function/requirements.txt- Python dependencies
How it works:
- Authenticate with Buildfunctions
- Generate a sorting function using Claude Sonnet
- Create a CPU Sandbox with a reward handler that tests the generated code
- Run the sandbox and get a reward score
- Clean up the sandbox
git clone https://github.com/buildfunctions/examples.git
cd examples/python/anthropic/agent-sandbox-reward-functionpip install -r requirements.txt# Create an API token at https://www.buildfunctions.com/settings
cp .env.example .env.env requires:
BUILDFUNCTIONS_API_TOKEN=""
ANTHROPIC_KEY=""
python main.py