Repository navigation
Commit 9730e81
authored
feat(e2b): support mounting pre-existing volumes at sandbox creation (#3581)
Closes #3155.
E2B offers persistent volumes that exist independently of sandbox
lifecycles. This PR wires attach-at-create through the E2B backend so
users no longer need TAR persist/hydrate on every turn for cross-sandbox
persistence.
## What is included
- New `E2bVolumeMount` POJO (existing volume name + absolute in-sandbox
path, validation + normalization)
- `E2bSandboxClientOptions.volumeMounts` (fluent adders, distinct-path
check) and `E2bFilesystemSpec.volumeMount/volumeMounts`
- `POST /sandboxes` serializes `volumeMounts: [{name, path}]` (omitted
when empty); platform 400s propagate with the response body
- Mounts threaded through `E2bSandboxClient.create` into
`E2bSandboxState` and across all three creation paths (new,
connect-fallback recreate, native-snapshot restore)
- `workspaceOnVolume` detection (`root.equals(mount) ||
root.startsWith(mount + "/")`): TAR persist/hydrate become no-ops,
destroy skips `rm -rf`; nested mounts get TAR `--exclude` args
- Hardening found via live testing: fail fast on non-absolute
`workspaceRoot`, shell-quote TAR excludes, run workspace `mkdir` from
`/`
- `E2bSandboxState` JSON stays backward compatible; empty
`E2bCloudBucketMountStrategy` placeholder removed
- Docs: E2B volumes section in `filesystem.md` (EN/ZH)1 parent ed80732 commit 9730e81
14 files changed
Lines changed: 1582 additions & 18 deletions
File tree
- agentscope-extensions/agentscope-extensions-sandbox/agentscope-extensions-sandbox-e2b/src
- main/java/io/agentscope/extensions/sandbox/e2b
- mounts
- test/java/io/agentscope/extensions/sandbox/e2b
- agentscope-harness/src
- main/java/io/agentscope/harness/agent/sandbox
- test/java/io/agentscope/harness/agent/sandbox
- docs/v2
- en/docs/harness
- zh/docs/harness
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
113 | 138 | | |
114 | 139 | | |
115 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
69 | 85 | | |
70 | 86 | | |
71 | 87 | | |
72 | 88 | | |
73 | 89 | | |
74 | 90 | | |
75 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
76 | 108 | | |
77 | 109 | | |
78 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
145 | 156 | | |
146 | 157 | | |
147 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
148 | 166 | | |
149 | 167 | | |
150 | 168 | | |
| |||
156 | 174 | | |
157 | 175 | | |
158 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
159 | 184 | | |
160 | 185 | | |
161 | 186 | | |
| |||
183 | 208 | | |
184 | 209 | | |
185 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
186 | 217 | | |
187 | 218 | | |
188 | 219 | | |
| |||
201 | 232 | | |
202 | 233 | | |
203 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
204 | 238 | | |
205 | 239 | | |
206 | | - | |
| 240 | + | |
207 | 241 | | |
208 | 242 | | |
209 | 243 | | |
210 | 244 | | |
211 | 245 | | |
212 | 246 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
222 | 252 | | |
223 | 253 | | |
224 | 254 | | |
| |||
314 | 344 | | |
315 | 345 | | |
316 | 346 | | |
| 347 | + | |
317 | 348 | | |
318 | 349 | | |
319 | 350 | | |
| |||
336 | 367 | | |
337 | 368 | | |
338 | 369 | | |
| 370 | + | |
339 | 371 | | |
340 | 372 | | |
341 | 373 | | |
| |||
349 | 381 | | |
350 | 382 | | |
351 | 383 | | |
352 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
353 | 388 | | |
354 | 389 | | |
355 | 390 | | |
| |||
370 | 405 | | |
371 | 406 | | |
372 | 407 | | |
373 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
374 | 412 | | |
375 | 413 | | |
376 | 414 | | |
| |||
493 | 531 | | |
494 | 532 | | |
495 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
496 | 551 | | |
497 | 552 | | |
498 | 553 | | |
| |||
522 | 577 | | |
523 | 578 | | |
524 | 579 | | |
525 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
526 | 590 | | |
527 | 591 | | |
528 | 592 | | |
| |||
551 | 615 | | |
552 | 616 | | |
553 | 617 | | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
| 618 | + | |
558 | 619 | | |
559 | 620 | | |
560 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
155 | 164 | | |
156 | 165 | | |
157 | 166 | | |
| |||
166 | 175 | | |
167 | 176 | | |
168 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
169 | 213 | | |
170 | 214 | | |
171 | 215 | | |
| |||
179 | 223 | | |
180 | 224 | | |
181 | 225 | | |
| 226 | + | |
182 | 227 | | |
183 | 228 | | |
184 | 229 | | |
| |||
0 commit comments