e2b-dev / e2b-dev/E2B

Feature Request: Add metadata parameter to volume creation (similar to sandbox create)

Open
#1,643 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature sdk
Dominant language
Python
Stars
13.9k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
70

Description

Is your feature request related to a problem? Please describe.

We need to associate custom metadata (e.g. underlying storage backend info, region, cluster, disk type, project/owner tags) with volumes at creation time. Currently Volume.create() only accepts a name parameter — there is no way to attach arbitrary key-value pairs to a volume. This makes it difficult to tag and organize volumes in multi-tenant environments and prevents storing operational metadata alongside the volume resource itself.

Describe the solution you'd like

Add a metadata: Optional[Dict[str, str]] parameter to volume creation, following the exact same pattern already used for sandboxes. This includes:

  1. OpenAPI spec — Add VolumeMetadata schema (additionalProperties: {type: string}), and add metadata fields to NewVolume, Volume, ListedVolume schemas and the GET /volumes query parameters (for filtering).
  2. API client model — Add metadata: Union[Unset, Dict[str, str]] to NewVolume in api/client/models/new_volume.py.
  3. Python SDK — Add metadata: Optional[Dict[str, str]] to both Volume.create() and AsyncVolume.create(), pass it through to the API model, and surface it in VolumeAndToken/VolumeInfo types so it's available after creation.
  4. Equivalent changes to JS SDK and CLI for consistency.

Example usage:

volume = Volume.create(
    name="my-data",
    metadata={
        "region": "us-east-1",
        "storage_class": "ssd",
        "project": "my-project",
    }
)

info = volume.get_info(volume.volume_id)
print(info.metadata)  # {"region": "us-east-1", ...}

Describe alternatives you've considered

  • Encoding metadata in the volume name — fragile, limited, and not searchable via the API.
  • Maintaining a separate metadata mapping service — adds unnecessary operational complexity for a feature that should be natively supported.

Additional context

Sandbox creation already supports this exact pattern end-to-end:

  • Sandbox.create() accepts metadata: Optional[Dict[str, str]] (sandbox_sync/main.py:160)
  • NewSandbox API model carries a metadata field (api/client/models/new_sandbox.py)
  • SandboxMetadata is defined in the OpenAPI spec as additionalProperties: {type: string} (spec/openapi.yml:258-261)
  • SandboxInfo.metadata surfaces it after creation (sandbox/sandbox_api.py:483)
  • SandboxQuery.metadata supports filtering sandboxes by metadata when listing (sandbox/sandbox_api.py:565)

This request mirrors that same pattern for volumes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the volume paths with the existing sandbox pattern in sandbox_sync/main.py:160, api/client/models/new_sandbox.py, sandbox/sandbox_api.py, and spec/openapi.yml:258-261. Then trace volume creation and info types across the Python SDK, JS SDK, CLI, and api/client/models/new_volume.py. Done means metadata is accepted, persisted, returned, and filterable consistently across the OpenAPI schemas and all clients.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi, python, typescript
Domain
api, backend, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.