openai / openai/openai-agents-python
Modal sandbox: evaluate native filesystem APIs and clarify overwrite compatibility
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 29.6k
- Forks
- 4.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 123
Description
Describe the feature
Consider adopting Modal's native sandbox.filesystem API for sandbox file transfers, with an explicit decision on overwrite compatibility. The Modal provider currently transfers files through shell commands. The native API could reduce transfer overhead, but live testing found behavior differences that prevent a straightforward replacement.
Observed compatibility differences
Tests against Modal 1.4.3 and 1.5.4 found:
| Operation | Current shell writes | Native write_bytes |
|---|---|---|
| Write through a symlink | Updates the target | Replaces the symlink; target remains unchanged |
| Overwrite a hard-linked file | Updates contents visible through both links | Replaces the destination inode; other links retain old contents |
Overwrite an existing 0640 file |
Preserves permissions | Resulting permissions were 0644 |
Modal also documents a 5 GB read limit for its filesystem API. That needs consideration before replacing shell-based reads.
The investigation inspected Agents SDK v0.22.3, where shell transfers were still in use. Both tested Modal versions support the native APIs.
Preliminary performance results
Same-container measurements, retaining SDK path validation, with six alternating observations per method:
| Modal version | Median write: shell → native | Median read: shell → native |
|---|---|---|
| 1.4.3 | 0.459s → 0.407s | 0.342s → 0.328s |
| 1.5.4 | 0.690s → 0.528s | 0.584s → 0.511s |
These are small-sample file-operation measurements, not sandbox startup measurements. Binary round trips exceeding 8 MiB also passed.
Decision requested
Would maintainers prefer to preserve the current in-place write semantics, or explicitly adopt replacement semantics for the Modal provider?
Before implementing this, it would help to establish:
- Whether the observed symlink, hard-link, and permission behavior is intentional and supported by Modal.
- Which overwrite semantics the Agents SDK intends to guarantee across providers.
- Whether native reads can be adopted independently without introducing a size-limit regression.
A stat-before-write fallback would need careful treatment: another sandbox process could change the destination between inspection and writing.
Any implementation should retain remote path validation, read-only grants, explicit-user access checks, SDK error categories, cancellation behavior, and avoid retrying ambiguous writes.
Modal's deprecation guidance concerns the older Sandbox.open/FileIO APIs; the SDK's existing shell-based transport is not using those deprecated APIs.
References: Modal filesystem API, migration guidance.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Modal provider's existing shell-based file-transfer entry point and review the reported compatibility measurements for symlinks, hard links, permissions, and the 5 GB read limit. Confirm the intended cross-provider overwrite semantics with maintainers before choosing an implementation. Done means an explicit compatibility decision and a plan that preserves the listed validation, access, error, cancellation, and retry behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100