Skip to content

The Buildfunctions SDK for Agents examples: Hardware-isolated CPU and GPU Sandboxes for untrusted AI actions 🪐 Now in beta, with $100 in free credits!

Notifications You must be signed in to change notification settings

buildfunctions/examples

Repository files navigation

Buildfunctions SDK Examples

Buildfunctions: Serverless functions for AI

   

The Buildfunctions SDK for AI Agents - Hardware-isolated CPU and GPU Sandboxes for untrusted AI actions.

Installation

# TypeScript / JavaScript
npm install buildfunctions
# or
yarn add buildfunctions
# or
pnpm add buildfunctions

# Python
pip install buildfunctions

Example

Anthropic: Code Generation with Reward Scoring

Uses 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:

How it works:

  1. Authenticate with Buildfunctions
  2. Generate a sorting function using Claude Sonnet
  3. Create a CPU Sandbox with a reward handler that tests the generated code
  4. Run the sandbox and get a reward score
  5. Clean up the sandbox

A Python Example

Download

git clone https://github.com/buildfunctions/examples.git
cd examples/python/anthropic/agent-sandbox-reward-function

Install dependencies

pip install -r requirements.txt

Update environment variables

# Create an API token at https://www.buildfunctions.com/settings
cp .env.example .env

.env requires:

BUILDFUNCTIONS_API_TOKEN=""
ANTHROPIC_KEY=""

Run

python main.py

About

The Buildfunctions SDK for Agents examples: Hardware-isolated CPU and GPU Sandboxes for untrusted AI actions 🪐 Now in beta, with $100 in free credits!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages