Skip to main content

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

Project description

logo

The Buildfunctions SDK for Agents

 

logo

Hardware-isolated execution environments for AI agents

Installation

pip install buildfunctions

Quick Start

1. Create an API Token

Get your API token at buildfunctions.com/settings

2. CPU Function

from buildfunctions import Buildfunctions, CPUFunction

client = await Buildfunctions({"apiToken": API_TOKEN})

deployed_function = await CPUFunction.create({
    "name": "my-cpu-function",
    "code": "./cpu_function_code.py",
    "language": "python",
    "memory": 128,
    "timeout": 30,
})

print(f"Endpoint: {deployed_function.endpoint}")

await deployed_function.delete()

3. CPU Sandbox

from buildfunctions import Buildfunctions, CPUSandbox

client = await Buildfunctions({"apiToken": API_TOKEN})

sandbox = await CPUSandbox.create({
    "name": "my-cpu-sandbox",
    "language": "python",
    "code": "/path/to/code/cpu_sandbox_code.py",
    "memory": 128,
    "timeout": 30,
})

result = await sandbox.run()
print(f"Result: {result}")

await sandbox.delete()

4. GPU Function

from buildfunctions import Buildfunctions, GPUFunction

client = await Buildfunctions({"apiToken": API_TOKEN})

deployed_function = await GPUFunction.create({
    "name": "my-gpu-function",
    "code": "/path/to/code/gpu_function_code.py",
    "language": "python",
    "gpu": "T4",
    "vcpus": 30,
    "memory": "50000MB",
    "timeout": 300,
    "requirements": ["transformers==4.47.1", "torch", "accelerate"],
})

print(f"Endpoint: {deployed_function.endpoint}")

await deployed_function.delete()

5. GPU Sandbox with Local Model

from buildfunctions import Buildfunctions, GPUSandbox

client = await Buildfunctions({"apiToken": API_TOKEN})

sandbox = await GPUSandbox.create({
    "name": "my-gpu-sandbox",
    "language": "python",
    "memory": 10000,
    "timeout": 300,
    "vcpus": 6,
    "code": "./gpu_sandbox_code.py",
    "model": "/path/to/models/Qwen/Qwen3-8B",
    "requirements": "torch",
})

result = await sandbox.run()
print(f"Response: {result}")

await sandbox.delete()

The SDK is currently in beta.

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

buildfunctions-0.2.2.tar.gz (4.9 MB view details)

Uploaded Source

Built Distribution

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

buildfunctions-0.2.2-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file buildfunctions-0.2.2.tar.gz.

File metadata

  • Download URL: buildfunctions-0.2.2.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for buildfunctions-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e3b08fd2d812b525a296e94ee1cc62a715dd1e38d185d27f51a76a1b848890c2
MD5 a0f62596a897e6355afc02ff364e644d
BLAKE2b-256 df82a461d0f5600292a55a46b881bcde5f4120848e029732838aef0495c82bb8

See more details on using hashes here.

File details

Details for the file buildfunctions-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: buildfunctions-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for buildfunctions-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf3e4d52b04e37394c596044cf5f7c4082acbed503fc21e348ebc83a919618e9
MD5 ff9849335b3d1295c7a09e3961ef7949
BLAKE2b-256 dab30883f8f816ed8d8eb0cb9ec82e2b89d54d529e1fe6e63453a12f5a895300

See more details on using hashes here.

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