Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions apps/web/src/app/(docs)/docs/sandbox/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,16 @@ const sandbox = await Sandbox.create({ timeoutMs: 60_000 })
// Retrieve sandbox information.
const info = await sandbox.getInfo()

// Retrieve sandbox expiration date.
const expirationDate = info.endAt
console.log(expirationDate)
console.log(info)

// {
// "sandboxId": "iiny0783cype8gmoawzmx-ce30bc46",
// "templateId": "rki5dems9wqfm4r03t7g",
// "name": "base",
// "metadata": {},
// "startedAt": "2025-03-24T15:37:58.076Z",
// "endAt": "2025-03-24T15:42:58.076Z"
// }
```

```python
Expand All @@ -81,9 +88,18 @@ from e2b_code_interpreter import Sandbox
# Create sandbox with and keep it running for 60 seconds.
sandbox = Sandbox(timeout=60)

# Retrieve sandbox expiration date.
expiration_date = sandbox.get_info().end_at
print(expiration_date)
# Retrieve sandbox information.
info = sandbox.get_info()

print(info)

# SandboxInfo(sandbox_id='ig6f1yt6idvxkxl562scj-419ff533',
# template_id='u7nqkmpn3jjf1tvftlsu',
# name='base',
# metadata={},
# started_at=datetime.datetime(2025, 3, 24, 15, 42, 59, 255612, tzinfo=tzutc()),
# end_at=datetime.datetime(2025, 3, 24, 15, 47, 59, 255612, tzinfo=tzutc())
# )
```
</CodeGroup>

Expand Down
9 changes: 9 additions & 0 deletions packages/js-sdk/tests/api/info.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect } from 'vitest'

import { sandboxTest, isDebug } from '../setup.js'

sandboxTest.skipIf(isDebug)('get sandbox info', async ({ sandbox }) => {
const info = await sandbox.getInfo()
expect(info).toBeDefined()
expect(info.sandboxId).toBe(sandbox.sandboxId)
})
9 changes: 9 additions & 0 deletions packages/python-sdk/tests/async/api_async/test_sbx_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

from e2b import AsyncSandbox


@pytest.mark.skip_debug()
async def test_get_info(async_sandbox: AsyncSandbox):
info = await async_sandbox.get_info()
assert info.sandbox_id == async_sandbox.sandbox_id
9 changes: 9 additions & 0 deletions packages/python-sdk/tests/sync/api_sync/test_sbx_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

from e2b import Sandbox


@pytest.mark.skip_debug()
def test_get_info(sandbox: Sandbox):
info = sandbox.get_info()
assert info.sandbox_id == sandbox.sandbox_id
Loading