airabox 0.1.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.
airabox-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: airabox
3
+ Version: 0.1.2
4
+ Summary: Python SDK for oasis agenthive E2B-compatible sandboxes
5
+ Author: Oasis Aira
6
+ Project-URL: Homepage, https://github.com/oasis-aira/airabox
7
+ Project-URL: Repository, https://github.com/oasis-aira/airabox
8
+ Project-URL: Issues, https://github.com/oasis-aira/airabox/issues
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: e2b<3.0.0,>=2.44.0
18
+ Requires-Dist: httpx<1.0.0,>=0.27.0
19
+ Requires-Dist: e2b-code-interpreter<3.0.0,>=2.9.0
20
+
21
+ # Airabox Python SDK
22
+
23
+ Python SDK for Airabox E2B-compatible desktop and mobile sandboxes.
24
+
25
+ ## Installation
26
+
27
+ Install the released package from PyPI:
28
+
29
+ ```bash
30
+ python -m pip install airabox
31
+ ```
32
+
33
+
34
+ ## Usage
35
+
36
+ Set your API key when creating a client. When `domain` is omitted, the SDK
37
+ uses its configured default domain:
38
+
39
+ ```python
40
+ from airabox import E2B
41
+
42
+ client = E2B(
43
+ api_key="your-api-key",
44
+ )
45
+ ```
46
+
47
+ `E2B` exposes four sandbox families. Use the synchronous resources in regular
48
+ Python code and the `Async*` resources inside an async event loop.
49
+
50
+ ## Base Sandbox
51
+
52
+ Base sandboxes provide the standard E2B filesystem, process, and command APIs.
53
+ Use `Sandbox` for general-purpose workloads that do not need a graphical
54
+ desktop or a code-interpreter runtime.
55
+
56
+ ### Synchronous
57
+
58
+ ```python
59
+ from airabox import E2B
60
+
61
+ client = E2B(api_key="your-api-key")
62
+ sandbox = client.Sandbox.create(timeout=300)
63
+
64
+ result = sandbox.commands.run("printf 'hello from Airabox\\n'")
65
+ print(result.stdout)
66
+
67
+ # Reuse an existing sandbox when its ID is known.
68
+ same_sandbox = client.Sandbox.connect(sandbox.sandbox_id)
69
+ print(same_sandbox.commands.run("pwd").stdout)
70
+
71
+ sandbox.kill()
72
+ ```
73
+
74
+ ### Asynchronous
75
+
76
+ ```python
77
+ from airabox import E2B
78
+
79
+ client = E2B(api_key="your-api-key")
80
+ sandbox = await client.AsyncSandbox.create(timeout=300)
81
+
82
+ result = await sandbox.commands.run("printf 'hello from Airabox\\n'")
83
+ print(result.stdout)
84
+
85
+ same_sandbox = await client.AsyncSandbox.connect(sandbox.sandbox_id)
86
+ print((await same_sandbox.commands.run("pwd")).stdout)
87
+
88
+ await sandbox.kill()
89
+ ```
90
+
91
+ ## Code Interpreter Sandbox
92
+
93
+ Code Interpreter sandboxes add `run_code`, which executes Python or another
94
+ supported language while preserving state between executions.
95
+
96
+ ### Synchronous
97
+
98
+ ```python
99
+ from airabox import E2B
100
+
101
+ client = E2B(api_key="your-api-key")
102
+ sandbox = client.CodeInterpreter.create(timeout=300)
103
+
104
+ sandbox.run_code("x = 1")
105
+ execution = sandbox.run_code("x += 1; x")
106
+ print(execution.text)
107
+
108
+ sandbox.kill()
109
+ ```
110
+
111
+ ### Asynchronous
112
+
113
+ ```python
114
+ from airabox import E2B
115
+
116
+ client = E2B(api_key="your-api-key")
117
+ sandbox = await client.AsyncCodeInterpreter.create(timeout=300)
118
+
119
+ await sandbox.run_code("x = 1")
120
+ execution = await sandbox.run_code("x += 1; x")
121
+ print(execution.text)
122
+
123
+ await sandbox.kill()
124
+ ```
125
+
126
+ Use `client.CodeInterpreter.connect(sandbox_id)` or
127
+ `await client.AsyncCodeInterpreter.connect(sandbox_id)` to continue an
128
+ existing code session.
129
+
130
+ ## Desktop Sandbox
131
+
132
+ Desktop sandboxes provide an XFCE desktop, mouse and keyboard controls, a
133
+ preview stream, and screenshots. The desktop helpers start the graphical
134
+ services when the sandbox is created or connected.
135
+
136
+ ### Synchronous
137
+
138
+ ```python
139
+ from pathlib import Path
140
+
141
+ from airabox import E2B
142
+
143
+ client = E2B(api_key="your-api-key")
144
+ desktop = client.Desktop.create(timeout=300)
145
+
146
+ print(f"sandbox_id={desktop.sandbox_id}")
147
+ print(f"screen_size={desktop.get_screen_size()}")
148
+ print(f"preview_url={desktop.stream.get_url()}")
149
+ desktop.stream.start()
150
+
151
+ desktop.left_click(640, 360)
152
+ Path("desktop.png").write_bytes(desktop.screenshot())
153
+
154
+ desktop.stream.stop()
155
+ desktop.kill()
156
+ ```
157
+
158
+ ### Asynchronous
159
+
160
+ ```python
161
+ from pathlib import Path
162
+
163
+ from airabox import E2B
164
+
165
+ client = E2B(api_key="your-api-key")
166
+ desktop = await client.AsyncDesktopSandbox.create(timeout=300)
167
+
168
+ print(f"sandbox_id={desktop.sandbox_id}")
169
+ print(f"screen_size={await desktop.get_screen_size()}")
170
+ print(f"preview_url={desktop.stream.get_url()}")
171
+ await desktop.stream.start()
172
+
173
+ await desktop.left_click(640, 360)
174
+ Path("desktop.png").write_bytes(await desktop.screenshot())
175
+
176
+ await desktop.stream.stop()
177
+ await desktop.kill()
178
+ ```
179
+
180
+ To reconnect, use `client.Desktop.connect(sandbox_id)` or
181
+ `await client.AsyncDesktopSandbox.connect(sandbox_id)`. Desktop click
182
+ coordinates are absolute screen coordinates.
183
+
184
+ ## Mobile Sandbox
185
+
186
+ Mobile sandboxes provide Android controls such as tapping, swiping, key events,
187
+ app launching, preview streaming, and screenshots.
188
+
189
+ ### Synchronous
190
+
191
+ ```python
192
+ from pathlib import Path
193
+
194
+ from airabox import E2B
195
+
196
+ client = E2B(api_key="your-api-key")
197
+ mobile = client.Mobile.create(timeout=300, request_timeout=300)
198
+
199
+ print(f"sandbox_id={mobile.sandbox_id}")
200
+ print(f"screen_size={mobile.get_screen_size()}")
201
+ print(f"preview_url={mobile.stream.get_url()}")
202
+ mobile.stream.start()
203
+
204
+ mobile.click(540, 960)
205
+ Path("mobile.png").write_bytes(mobile.screenshot())
206
+
207
+ mobile.stream.stop()
208
+ mobile.kill()
209
+ ```
210
+
211
+ ### Asynchronous
212
+
213
+ ```python
214
+ from pathlib import Path
215
+
216
+ from airabox import E2B
217
+
218
+ client = E2B(api_key="your-api-key")
219
+ mobile = await client.AsyncMobileSandbox.create(timeout=300)
220
+
221
+ print(f"sandbox_id={mobile.sandbox_id}")
222
+ print(f"screen_size={await mobile.get_screen_size()}")
223
+ print(f"preview_url={await mobile.stream.get_url()}")
224
+ await mobile.stream.start()
225
+
226
+ await mobile.click(540, 960)
227
+ Path("mobile.png").write_bytes(await mobile.screenshot())
228
+
229
+ await mobile.stream.stop()
230
+ await mobile.kill()
231
+ ```
232
+
233
+ To reconnect, use `client.Mobile.connect(sandbox_id)` or
234
+ `await client.AsyncMobileSandbox.connect(sandbox_id)`. Mobile click and swipe
235
+ coordinates are absolute screen coordinates.
236
+
237
+ ## Shared Resources
238
+
239
+ The client also exposes the standard E2B resources, including `Volume`,
240
+ `AsyncVolume`, `Template`, `AsyncTemplate`, `Secret`, and `AsyncSecret`:
241
+
242
+ ```python
243
+ volume = client.Volume.create("my-volume")
244
+ template_exists = client.Template.exists("my-template")
245
+ secret = client.Secret.create("example-key", "example-value")
246
+ ```
247
+
248
+ ## Lifecycle
249
+
250
+ These snippets create sandboxes directly and explicitly call `kill()` when
251
+ finished. For long-lived workflows, save the sandbox ID and reconnect with the
252
+ matching `connect()` method shown above.
253
+
254
+ For more runnable Python examples, see [`examples/python/`](../../examples/python/).
@@ -0,0 +1,234 @@
1
+ # Airabox Python SDK
2
+
3
+ Python SDK for Airabox E2B-compatible desktop and mobile sandboxes.
4
+
5
+ ## Installation
6
+
7
+ Install the released package from PyPI:
8
+
9
+ ```bash
10
+ python -m pip install airabox
11
+ ```
12
+
13
+
14
+ ## Usage
15
+
16
+ Set your API key when creating a client. When `domain` is omitted, the SDK
17
+ uses its configured default domain:
18
+
19
+ ```python
20
+ from airabox import E2B
21
+
22
+ client = E2B(
23
+ api_key="your-api-key",
24
+ )
25
+ ```
26
+
27
+ `E2B` exposes four sandbox families. Use the synchronous resources in regular
28
+ Python code and the `Async*` resources inside an async event loop.
29
+
30
+ ## Base Sandbox
31
+
32
+ Base sandboxes provide the standard E2B filesystem, process, and command APIs.
33
+ Use `Sandbox` for general-purpose workloads that do not need a graphical
34
+ desktop or a code-interpreter runtime.
35
+
36
+ ### Synchronous
37
+
38
+ ```python
39
+ from airabox import E2B
40
+
41
+ client = E2B(api_key="your-api-key")
42
+ sandbox = client.Sandbox.create(timeout=300)
43
+
44
+ result = sandbox.commands.run("printf 'hello from Airabox\\n'")
45
+ print(result.stdout)
46
+
47
+ # Reuse an existing sandbox when its ID is known.
48
+ same_sandbox = client.Sandbox.connect(sandbox.sandbox_id)
49
+ print(same_sandbox.commands.run("pwd").stdout)
50
+
51
+ sandbox.kill()
52
+ ```
53
+
54
+ ### Asynchronous
55
+
56
+ ```python
57
+ from airabox import E2B
58
+
59
+ client = E2B(api_key="your-api-key")
60
+ sandbox = await client.AsyncSandbox.create(timeout=300)
61
+
62
+ result = await sandbox.commands.run("printf 'hello from Airabox\\n'")
63
+ print(result.stdout)
64
+
65
+ same_sandbox = await client.AsyncSandbox.connect(sandbox.sandbox_id)
66
+ print((await same_sandbox.commands.run("pwd")).stdout)
67
+
68
+ await sandbox.kill()
69
+ ```
70
+
71
+ ## Code Interpreter Sandbox
72
+
73
+ Code Interpreter sandboxes add `run_code`, which executes Python or another
74
+ supported language while preserving state between executions.
75
+
76
+ ### Synchronous
77
+
78
+ ```python
79
+ from airabox import E2B
80
+
81
+ client = E2B(api_key="your-api-key")
82
+ sandbox = client.CodeInterpreter.create(timeout=300)
83
+
84
+ sandbox.run_code("x = 1")
85
+ execution = sandbox.run_code("x += 1; x")
86
+ print(execution.text)
87
+
88
+ sandbox.kill()
89
+ ```
90
+
91
+ ### Asynchronous
92
+
93
+ ```python
94
+ from airabox import E2B
95
+
96
+ client = E2B(api_key="your-api-key")
97
+ sandbox = await client.AsyncCodeInterpreter.create(timeout=300)
98
+
99
+ await sandbox.run_code("x = 1")
100
+ execution = await sandbox.run_code("x += 1; x")
101
+ print(execution.text)
102
+
103
+ await sandbox.kill()
104
+ ```
105
+
106
+ Use `client.CodeInterpreter.connect(sandbox_id)` or
107
+ `await client.AsyncCodeInterpreter.connect(sandbox_id)` to continue an
108
+ existing code session.
109
+
110
+ ## Desktop Sandbox
111
+
112
+ Desktop sandboxes provide an XFCE desktop, mouse and keyboard controls, a
113
+ preview stream, and screenshots. The desktop helpers start the graphical
114
+ services when the sandbox is created or connected.
115
+
116
+ ### Synchronous
117
+
118
+ ```python
119
+ from pathlib import Path
120
+
121
+ from airabox import E2B
122
+
123
+ client = E2B(api_key="your-api-key")
124
+ desktop = client.Desktop.create(timeout=300)
125
+
126
+ print(f"sandbox_id={desktop.sandbox_id}")
127
+ print(f"screen_size={desktop.get_screen_size()}")
128
+ print(f"preview_url={desktop.stream.get_url()}")
129
+ desktop.stream.start()
130
+
131
+ desktop.left_click(640, 360)
132
+ Path("desktop.png").write_bytes(desktop.screenshot())
133
+
134
+ desktop.stream.stop()
135
+ desktop.kill()
136
+ ```
137
+
138
+ ### Asynchronous
139
+
140
+ ```python
141
+ from pathlib import Path
142
+
143
+ from airabox import E2B
144
+
145
+ client = E2B(api_key="your-api-key")
146
+ desktop = await client.AsyncDesktopSandbox.create(timeout=300)
147
+
148
+ print(f"sandbox_id={desktop.sandbox_id}")
149
+ print(f"screen_size={await desktop.get_screen_size()}")
150
+ print(f"preview_url={desktop.stream.get_url()}")
151
+ await desktop.stream.start()
152
+
153
+ await desktop.left_click(640, 360)
154
+ Path("desktop.png").write_bytes(await desktop.screenshot())
155
+
156
+ await desktop.stream.stop()
157
+ await desktop.kill()
158
+ ```
159
+
160
+ To reconnect, use `client.Desktop.connect(sandbox_id)` or
161
+ `await client.AsyncDesktopSandbox.connect(sandbox_id)`. Desktop click
162
+ coordinates are absolute screen coordinates.
163
+
164
+ ## Mobile Sandbox
165
+
166
+ Mobile sandboxes provide Android controls such as tapping, swiping, key events,
167
+ app launching, preview streaming, and screenshots.
168
+
169
+ ### Synchronous
170
+
171
+ ```python
172
+ from pathlib import Path
173
+
174
+ from airabox import E2B
175
+
176
+ client = E2B(api_key="your-api-key")
177
+ mobile = client.Mobile.create(timeout=300, request_timeout=300)
178
+
179
+ print(f"sandbox_id={mobile.sandbox_id}")
180
+ print(f"screen_size={mobile.get_screen_size()}")
181
+ print(f"preview_url={mobile.stream.get_url()}")
182
+ mobile.stream.start()
183
+
184
+ mobile.click(540, 960)
185
+ Path("mobile.png").write_bytes(mobile.screenshot())
186
+
187
+ mobile.stream.stop()
188
+ mobile.kill()
189
+ ```
190
+
191
+ ### Asynchronous
192
+
193
+ ```python
194
+ from pathlib import Path
195
+
196
+ from airabox import E2B
197
+
198
+ client = E2B(api_key="your-api-key")
199
+ mobile = await client.AsyncMobileSandbox.create(timeout=300)
200
+
201
+ print(f"sandbox_id={mobile.sandbox_id}")
202
+ print(f"screen_size={await mobile.get_screen_size()}")
203
+ print(f"preview_url={await mobile.stream.get_url()}")
204
+ await mobile.stream.start()
205
+
206
+ await mobile.click(540, 960)
207
+ Path("mobile.png").write_bytes(await mobile.screenshot())
208
+
209
+ await mobile.stream.stop()
210
+ await mobile.kill()
211
+ ```
212
+
213
+ To reconnect, use `client.Mobile.connect(sandbox_id)` or
214
+ `await client.AsyncMobileSandbox.connect(sandbox_id)`. Mobile click and swipe
215
+ coordinates are absolute screen coordinates.
216
+
217
+ ## Shared Resources
218
+
219
+ The client also exposes the standard E2B resources, including `Volume`,
220
+ `AsyncVolume`, `Template`, `AsyncTemplate`, `Secret`, and `AsyncSecret`:
221
+
222
+ ```python
223
+ volume = client.Volume.create("my-volume")
224
+ template_exists = client.Template.exists("my-template")
225
+ secret = client.Secret.create("example-key", "example-value")
226
+ ```
227
+
228
+ ## Lifecycle
229
+
230
+ These snippets create sandboxes directly and explicitly call `kill()` when
231
+ finished. For long-lived workflows, save the sandbox ID and reconnect with the
232
+ matching `connect()` method shown above.
233
+
234
+ For more runnable Python examples, see [`examples/python/`](../../examples/python/).
@@ -0,0 +1,33 @@
1
+ """Airabox Python SDK."""
2
+
3
+ import os
4
+
5
+ from e2b import * # noqa: F401,F403
6
+ from e2b import __all__ as _E2B_EXPORTS
7
+
8
+ from e2b_code_interpreter import AsyncSandbox as AsyncCodeInterpreter
9
+ from e2b_code_interpreter import Sandbox as CodeInterpreter
10
+ from e2b_code_interpreter import models as CodeInterpreterModels
11
+
12
+ from .client import AiraBox, E2B, E2BClientParams
13
+
14
+ from .desktop import AsyncDesktopSandbox, AsyncVNCStream, DesktopSandbox, VNCStream
15
+ from .mobile import AsyncMobileSandbox, MobileSandbox
16
+
17
+
18
+ __all__ = [
19
+ "E2B",
20
+ "E2BClientParams",
21
+ "AiraBox",
22
+ "DesktopSandbox",
23
+ "VNCStream",
24
+ "AsyncDesktopSandbox",
25
+ "AsyncVNCStream",
26
+ "MobileSandbox",
27
+ "AsyncMobileSandbox",
28
+ "CodeInterpreter",
29
+ "AsyncCodeInterpreter",
30
+ "CodeInterpreterModels",
31
+ ]
32
+
33
+ __all__ = [*_E2B_EXPORTS, *__all__]