buildfunctions 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/.gitignore +3 -1
  2. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/PKG-INFO +49 -69
  3. buildfunctions-0.2.2/README.md +136 -0
  4. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/pyproject.toml +1 -1
  5. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/cpu_sandbox.py +2 -3
  6. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/types.py +4 -2
  7. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/auth.py +3 -0
  8. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/test_cpu_function.py +4 -1
  9. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/test_cpu_sandbox.py +4 -1
  10. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/test_gpu_function.py +3 -0
  11. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/test_gpu_sandbox_with_local_model.py +4 -1
  12. buildfunctions-0.2.1/README.md +0 -156
  13. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/.env.example +0 -0
  14. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/MANIFEST.in +0 -0
  15. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/__init__.py +0 -0
  16. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/client.py +0 -0
  17. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/cpu_function.py +0 -0
  18. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/dotdict.py +0 -0
  19. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/errors.py +0 -0
  20. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/framework.py +0 -0
  21. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/gpu_function.py +0 -0
  22. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/gpu_sandbox.py +0 -0
  23. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/http_client.py +0 -0
  24. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/memory.py +0 -0
  25. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/py.typed +0 -0
  26. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/resolve_code.py +0 -0
  27. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/src/buildfunctions/uploader.py +0 -0
  28. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/static/readme/buildfunctions-header.svg +0 -0
  29. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/static/readme/buildfunctions-logo-and-servers-dark.svg +0 -0
  30. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/static/readme/discord-button.png +0 -0
  31. {buildfunctions-0.2.1 → buildfunctions-0.2.2}/static/readme/read-the-docs-button.png +0 -0
  32. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/cpu_function_code.py +0 -0
  33. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/cpu_sandbox_code.py +0 -0
  34. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/gpu_function_code.py +0 -0
  35. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/gpu_function_code_streaming.py +0 -0
  36. {buildfunctions-0.2.1/tests → buildfunctions-0.2.2/tests/examples}/gpu_sandbox_code.py +0 -0
@@ -15,4 +15,6 @@ build/
15
15
  *.log
16
16
  .DS_Store
17
17
  .claude*
18
- .pytest_cache*
18
+ .pytest_cache*
19
+ tests/live*
20
+ tests/dist*
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: buildfunctions
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: The Buildfunctions SDK for Agents: Hardware-isolated CPU and GPU Sandboxes for untrusted AI actions
5
5
  Project-URL: Homepage, https://www.buildfunctions.com
6
6
  Project-URL: Documentation, https://www.buildfunctions.com/docs/sdk/quickstart
@@ -68,109 +68,89 @@ Get your API token at [buildfunctions.com/settings](https://www.buildfunctions.c
68
68
  ### 2. CPU Function
69
69
 
70
70
  ```python
71
- import asyncio
72
- import os
73
71
  from buildfunctions import Buildfunctions, CPUFunction
74
72
 
75
- async def main():
76
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
73
+ client = await Buildfunctions({"apiToken": API_TOKEN})
77
74
 
78
- deployed_function = await CPUFunction.create({
79
- "name": "my-cpu-function",
80
- "code": "./cpu_function_code.py",
81
- "language": "python",
82
- "memory": 128,
83
- "timeout": 30,
84
- })
75
+ deployed_function = await CPUFunction.create({
76
+ "name": "my-cpu-function",
77
+ "code": "./cpu_function_code.py",
78
+ "language": "python",
79
+ "memory": 128,
80
+ "timeout": 30,
81
+ })
85
82
 
86
- print(f"Endpoint: {deployed_function.endpoint}")
83
+ print(f"Endpoint: {deployed_function.endpoint}")
87
84
 
88
- await deployed_function.delete()
89
-
90
- asyncio.run(main())
85
+ await deployed_function.delete()
91
86
  ```
92
87
 
93
88
  ### 3. CPU Sandbox
94
89
 
95
90
  ```python
96
- import asyncio
97
- import os
98
91
  from buildfunctions import Buildfunctions, CPUSandbox
99
92
 
100
- async def main():
101
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
102
-
103
- sandbox = await CPUSandbox.create({
104
- "name": "my-cpu-sandbox",
105
- "language": "python",
106
- "code": "/path/to/code/cpu_sandbox_code.py",
107
- "memory": 128,
108
- "timeout": 30,
109
- })
93
+ client = await Buildfunctions({"apiToken": API_TOKEN})
110
94
 
111
- result = await sandbox.run()
112
- print(f"Result: {result}")
95
+ sandbox = await CPUSandbox.create({
96
+ "name": "my-cpu-sandbox",
97
+ "language": "python",
98
+ "code": "/path/to/code/cpu_sandbox_code.py",
99
+ "memory": 128,
100
+ "timeout": 30,
101
+ })
113
102
 
114
- await sandbox.delete()
103
+ result = await sandbox.run()
104
+ print(f"Result: {result}")
115
105
 
116
- asyncio.run(main())
106
+ await sandbox.delete()
117
107
  ```
118
108
 
119
109
  ### 4. GPU Function
120
110
 
121
111
  ```python
122
- import asyncio
123
- import os
124
112
  from buildfunctions import Buildfunctions, GPUFunction
125
113
 
126
- async def main():
127
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
114
+ client = await Buildfunctions({"apiToken": API_TOKEN})
128
115
 
129
- deployed_function = await GPUFunction.create({
130
- "name": "my-gpu-function",
131
- "code": "/path/to/code/gpu_function_code.py",
132
- "language": "python",
133
- "gpu": "T4",
134
- "vcpus": 30,
135
- "memory": "50000MB",
136
- "timeout": 300,
137
- "requirements": ["transformers==4.47.1", "torch", "accelerate"],
138
- })
116
+ deployed_function = await GPUFunction.create({
117
+ "name": "my-gpu-function",
118
+ "code": "/path/to/code/gpu_function_code.py",
119
+ "language": "python",
120
+ "gpu": "T4",
121
+ "vcpus": 30,
122
+ "memory": "50000MB",
123
+ "timeout": 300,
124
+ "requirements": ["transformers==4.47.1", "torch", "accelerate"],
125
+ })
139
126
 
140
- print(f"Endpoint: {deployed_function.endpoint}")
127
+ print(f"Endpoint: {deployed_function.endpoint}")
141
128
 
142
- await deployed_function.delete()
143
-
144
- asyncio.run(main())
129
+ await deployed_function.delete()
145
130
  ```
146
131
 
147
132
  ### 5. GPU Sandbox with Local Model
148
133
 
149
134
  ```python
150
- import asyncio
151
- import os
152
135
  from buildfunctions import Buildfunctions, GPUSandbox
153
136
 
154
- async def main():
155
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
156
-
157
- sandbox = await GPUSandbox.create({
158
- "name": "my-gpu-sandbox",
159
- "language": "python",
160
- "memory": 10000,
161
- "timeout": 300,
162
- "vcpus": 6,
163
- "code": "./gpu_sandbox_code.py",
164
- "model": "/path/to/models/Qwen/Qwen3-8B",
165
- "requirements": "torch",
166
- })
137
+ client = await Buildfunctions({"apiToken": API_TOKEN})
167
138
 
168
- result = await sandbox.run()
169
- print(f"Response: {result}")
139
+ sandbox = await GPUSandbox.create({
140
+ "name": "my-gpu-sandbox",
141
+ "language": "python",
142
+ "memory": 10000,
143
+ "timeout": 300,
144
+ "vcpus": 6,
145
+ "code": "./gpu_sandbox_code.py",
146
+ "model": "/path/to/models/Qwen/Qwen3-8B",
147
+ "requirements": "torch",
148
+ })
170
149
 
171
- await sandbox.delete()
150
+ result = await sandbox.run()
151
+ print(f"Response: {result}")
172
152
 
173
- asyncio.run(main())
153
+ await sandbox.delete()
174
154
  ```
175
155
 
176
156
  The SDK is currently in beta.
@@ -0,0 +1,136 @@
1
+ <p align="center">
2
+ <h1 align="center">
3
+ <a href="https://www.buildfunctions.com" target="_blank">
4
+ <img src="./static/readme/buildfunctions-header.svg" alt="logo" width="900">
5
+ </a>
6
+ </h1>
7
+ </p>
8
+
9
+ <h1 align="center">The Buildfunctions SDK for Agents</h1>
10
+
11
+ <p align="center">
12
+ <!-- <a href="https://discord.com/users/buildfunctions" target="_blank">
13
+ <img src="./static/readme/discord-button.png" height="32" />
14
+ </a>&nbsp; -->
15
+ <a href="https://www.buildfunctions.com/docs/sdk/quickstart" target="_blank">
16
+ <img src="./static/readme/read-the-docs-button.png" height="32" />
17
+ </a>&nbsp;
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="https://pypi.org/project/buildfunctions" target="_blank">
22
+ <img src="https://img.shields.io/badge/pypi-buildfunctions-green">
23
+ </a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ <h1 align="center">
28
+ <a href="https://www.buildfunctions.com" target="_blank">
29
+ <img src="./static/readme/buildfunctions-logo-and-servers-dark.svg" alt="logo" width="900">
30
+ </a>
31
+ </h1>
32
+ </p>
33
+
34
+ > Hardware-isolated execution environments for AI agents
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install buildfunctions
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ### 1. Create an API Token
45
+
46
+ Get your API token at [buildfunctions.com/settings](https://www.buildfunctions.com/settings)
47
+
48
+ ### 2. CPU Function
49
+
50
+ ```python
51
+ from buildfunctions import Buildfunctions, CPUFunction
52
+
53
+ client = await Buildfunctions({"apiToken": API_TOKEN})
54
+
55
+ deployed_function = await CPUFunction.create({
56
+ "name": "my-cpu-function",
57
+ "code": "./cpu_function_code.py",
58
+ "language": "python",
59
+ "memory": 128,
60
+ "timeout": 30,
61
+ })
62
+
63
+ print(f"Endpoint: {deployed_function.endpoint}")
64
+
65
+ await deployed_function.delete()
66
+ ```
67
+
68
+ ### 3. CPU Sandbox
69
+
70
+ ```python
71
+ from buildfunctions import Buildfunctions, CPUSandbox
72
+
73
+ client = await Buildfunctions({"apiToken": API_TOKEN})
74
+
75
+ sandbox = await CPUSandbox.create({
76
+ "name": "my-cpu-sandbox",
77
+ "language": "python",
78
+ "code": "/path/to/code/cpu_sandbox_code.py",
79
+ "memory": 128,
80
+ "timeout": 30,
81
+ })
82
+
83
+ result = await sandbox.run()
84
+ print(f"Result: {result}")
85
+
86
+ await sandbox.delete()
87
+ ```
88
+
89
+ ### 4. GPU Function
90
+
91
+ ```python
92
+ from buildfunctions import Buildfunctions, GPUFunction
93
+
94
+ client = await Buildfunctions({"apiToken": API_TOKEN})
95
+
96
+ deployed_function = await GPUFunction.create({
97
+ "name": "my-gpu-function",
98
+ "code": "/path/to/code/gpu_function_code.py",
99
+ "language": "python",
100
+ "gpu": "T4",
101
+ "vcpus": 30,
102
+ "memory": "50000MB",
103
+ "timeout": 300,
104
+ "requirements": ["transformers==4.47.1", "torch", "accelerate"],
105
+ })
106
+
107
+ print(f"Endpoint: {deployed_function.endpoint}")
108
+
109
+ await deployed_function.delete()
110
+ ```
111
+
112
+ ### 5. GPU Sandbox with Local Model
113
+
114
+ ```python
115
+ from buildfunctions import Buildfunctions, GPUSandbox
116
+
117
+ client = await Buildfunctions({"apiToken": API_TOKEN})
118
+
119
+ sandbox = await GPUSandbox.create({
120
+ "name": "my-gpu-sandbox",
121
+ "language": "python",
122
+ "memory": 10000,
123
+ "timeout": 300,
124
+ "vcpus": 6,
125
+ "code": "./gpu_sandbox_code.py",
126
+ "model": "/path/to/models/Qwen/Qwen3-8B",
127
+ "requirements": "torch",
128
+ })
129
+
130
+ result = await sandbox.run()
131
+ print(f"Response: {result}")
132
+
133
+ await sandbox.delete()
134
+ ```
135
+
136
+ The SDK is currently in beta.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "buildfunctions"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "The Buildfunctions SDK for Agents: Hardware-isolated CPU and GPU Sandboxes for untrusted AI actions"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -183,9 +183,8 @@ async def _wait_for_endpoint(endpoint: str, max_attempts: int = 60, delay_ms: in
183
183
  result = await _https_get_with_ip(ip, hostname, path)
184
184
  if 200 <= result["status"] < 500:
185
185
  return
186
- except Exception as e:
187
- if attempt == 1 or attempt % 10 == 0:
188
- print(f" Waiting... (attempt {attempt}/{max_attempts})")
186
+ except Exception:
187
+ pass
189
188
 
190
189
  await asyncio.sleep(delay_ms / 1000.0)
191
190
 
@@ -4,6 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any, Awaitable, Callable, Literal, TypedDict
6
6
 
7
+ from buildfunctions.dotdict import DotDict
8
+
7
9
 
8
10
  # Scalar types
9
11
  Language = Literal["javascript", "typescript", "python", "go", "shell"]
@@ -150,8 +152,8 @@ class GPUSandboxConfig(TypedDict, total=False):
150
152
  model: str | dict[str, str]
151
153
 
152
154
 
153
- # Run result
154
- class RunResult(TypedDict):
155
+ # Run result - uses DotDict so both result["response"] and result.response work
156
+ class RunResult(DotDict):
155
157
  response: Any # The response (parsed JSON object, or raw string if not JSON)
156
158
  status: int # HTTP status code
157
159
 
@@ -2,6 +2,9 @@ import os
2
2
  import sys
3
3
  from pathlib import Path
4
4
 
5
+ # Import from local source instead of installed package
6
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
7
+
5
8
  import pytest
6
9
  from dotenv import load_dotenv
7
10
 
@@ -4,6 +4,9 @@ import sys
4
4
  import time
5
5
  from pathlib import Path
6
6
 
7
+ # Import from local source instead of installed package
8
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
9
+
7
10
  import httpx
8
11
  import pytest
9
12
  from dotenv import load_dotenv
@@ -38,7 +41,7 @@ async def test_cpu_function():
38
41
  "name": f"sdk-cpu-function-{int(time.time())}",
39
42
  "code": "./cpu_function_code.py",
40
43
  "language": "python",
41
- "memory": 128,
44
+ "memory": "128MB",
42
45
  "timeout": 30,
43
46
  })
44
47
 
@@ -4,6 +4,9 @@ import sys
4
4
  import time
5
5
  from pathlib import Path
6
6
 
7
+ # Import from local source instead of installed package
8
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
9
+
7
10
  import pytest
8
11
  from dotenv import load_dotenv
9
12
 
@@ -37,7 +40,7 @@ async def test_cpu_sandbox():
37
40
  "name": f"sdk-cpu-sandbox-{int(time.time())}",
38
41
  "language": "python",
39
42
  "code": "/path/to/code/cpu_sandbox_code.py",
40
- "memory": 128,
43
+ "memory": "128MB",
41
44
  "timeout": 30,
42
45
  })
43
46
  print(" CPU Sandbox created")
@@ -4,6 +4,9 @@ import sys
4
4
  import time
5
5
  from pathlib import Path
6
6
 
7
+ # Import from local source instead of installed package
8
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
9
+
7
10
  import httpx
8
11
  import pytest
9
12
  from dotenv import load_dotenv
@@ -4,6 +4,9 @@ import sys
4
4
  import time
5
5
  from pathlib import Path
6
6
 
7
+ # Import from local source instead of installed package
8
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
9
+
7
10
  import pytest
8
11
  from dotenv import load_dotenv
9
12
 
@@ -36,7 +39,7 @@ async def test_gpu_sandbox_with_model():
36
39
  sandbox = await GPUSandbox.create({
37
40
  "name": f"sdk-gpu-sandbox-model-{int(time.time())}",
38
41
  "language": "python",
39
- "memory": 10000,
42
+ "memory": "10000MB",
40
43
  "timeout": 300,
41
44
  "vcpus": 6,
42
45
  "code": "./gpu_sandbox_code.py",
@@ -1,156 +0,0 @@
1
- <p align="center">
2
- <h1 align="center">
3
- <a href="https://www.buildfunctions.com" target="_blank">
4
- <img src="./static/readme/buildfunctions-header.svg" alt="logo" width="900">
5
- </a>
6
- </h1>
7
- </p>
8
-
9
- <h1 align="center">The Buildfunctions SDK for Agents</h1>
10
-
11
- <p align="center">
12
- <!-- <a href="https://discord.com/users/buildfunctions" target="_blank">
13
- <img src="./static/readme/discord-button.png" height="32" />
14
- </a>&nbsp; -->
15
- <a href="https://www.buildfunctions.com/docs/sdk/quickstart" target="_blank">
16
- <img src="./static/readme/read-the-docs-button.png" height="32" />
17
- </a>&nbsp;
18
- </p>
19
-
20
- <p align="center">
21
- <a href="https://pypi.org/project/buildfunctions" target="_blank">
22
- <img src="https://img.shields.io/badge/pypi-buildfunctions-green">
23
- </a>
24
- </p>
25
-
26
- <p align="center">
27
- <h1 align="center">
28
- <a href="https://www.buildfunctions.com" target="_blank">
29
- <img src="./static/readme/buildfunctions-logo-and-servers-dark.svg" alt="logo" width="900">
30
- </a>
31
- </h1>
32
- </p>
33
-
34
- > Hardware-isolated execution environments for AI agents
35
-
36
- ## Installation
37
-
38
- ```bash
39
- pip install buildfunctions
40
- ```
41
-
42
- ## Quick Start
43
-
44
- ### 1. Create an API Token
45
-
46
- Get your API token at [buildfunctions.com/settings](https://www.buildfunctions.com/settings)
47
-
48
- ### 2. CPU Function
49
-
50
- ```python
51
- import asyncio
52
- import os
53
- from buildfunctions import Buildfunctions, CPUFunction
54
-
55
- async def main():
56
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
57
-
58
- deployed_function = await CPUFunction.create({
59
- "name": "my-cpu-function",
60
- "code": "./cpu_function_code.py",
61
- "language": "python",
62
- "memory": 128,
63
- "timeout": 30,
64
- })
65
-
66
- print(f"Endpoint: {deployed_function.endpoint}")
67
-
68
- await deployed_function.delete()
69
-
70
- asyncio.run(main())
71
- ```
72
-
73
- ### 3. CPU Sandbox
74
-
75
- ```python
76
- import asyncio
77
- import os
78
- from buildfunctions import Buildfunctions, CPUSandbox
79
-
80
- async def main():
81
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
82
-
83
- sandbox = await CPUSandbox.create({
84
- "name": "my-cpu-sandbox",
85
- "language": "python",
86
- "code": "/path/to/code/cpu_sandbox_code.py",
87
- "memory": 128,
88
- "timeout": 30,
89
- })
90
-
91
- result = await sandbox.run()
92
- print(f"Result: {result}")
93
-
94
- await sandbox.delete()
95
-
96
- asyncio.run(main())
97
- ```
98
-
99
- ### 4. GPU Function
100
-
101
- ```python
102
- import asyncio
103
- import os
104
- from buildfunctions import Buildfunctions, GPUFunction
105
-
106
- async def main():
107
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
108
-
109
- deployed_function = await GPUFunction.create({
110
- "name": "my-gpu-function",
111
- "code": "/path/to/code/gpu_function_code.py",
112
- "language": "python",
113
- "gpu": "T4",
114
- "vcpus": 30,
115
- "memory": "50000MB",
116
- "timeout": 300,
117
- "requirements": ["transformers==4.47.1", "torch", "accelerate"],
118
- })
119
-
120
- print(f"Endpoint: {deployed_function.endpoint}")
121
-
122
- await deployed_function.delete()
123
-
124
- asyncio.run(main())
125
- ```
126
-
127
- ### 5. GPU Sandbox with Local Model
128
-
129
- ```python
130
- import asyncio
131
- import os
132
- from buildfunctions import Buildfunctions, GPUSandbox
133
-
134
- async def main():
135
- client = await Buildfunctions({"apiToken": os.environ["BUILDFUNCTIONS_API_TOKEN"]})
136
-
137
- sandbox = await GPUSandbox.create({
138
- "name": "my-gpu-sandbox",
139
- "language": "python",
140
- "memory": 10000,
141
- "timeout": 300,
142
- "vcpus": 6,
143
- "code": "./gpu_sandbox_code.py",
144
- "model": "/path/to/models/Qwen/Qwen3-8B",
145
- "requirements": "torch",
146
- })
147
-
148
- result = await sandbox.run()
149
- print(f"Response: {result}")
150
-
151
- await sandbox.delete()
152
-
153
- asyncio.run(main())
154
- ```
155
-
156
- The SDK is currently in beta.