Hardware-isolated execution environments for AI agents
pip install buildfunctionsGet your API token at buildfunctions.com/settings
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()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()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()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.