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. If you encounter any issues or have specific syntax requirements, please reach out and contact us at team@buildfunctions.com, and we’ll work to address them.

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.3.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.3-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: buildfunctions-0.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 e830ba45fca3bd1300d400fd6996ce6cb2201d635a8941d374d5a81f787a7f1a
MD5 561a7f9d8c926fc7fc2288528f74e221
BLAKE2b-256 2b7d858286508563ffdfa606c5a33fb6d6291fb0d3dfa9663d7d21a539fa5a59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: buildfunctions-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 31.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 abdbe444665160b132dfd554458e65469d8cd3953a17a51d0fc55c88230b9836
MD5 ae1eb57d727fdd324fbae4e2fcfb4447
BLAKE2b-256 df7be0cc8d441ff2ab8327ff96b83b2ba27d7cf642ef53d5ed90bed95202b63d

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