Skip to content

feat(sdk,cli): sandbox TTL support#74

Merged
MDzaja merged 5 commits into
mainfrom
feat/sandbox-ttl
Jul 17, 2026
Merged

feat(sdk,cli): sandbox TTL support#74
MDzaja merged 5 commits into
mainfrom
feat/sandbox-ttl

Conversation

@MDzaja

@MDzaja MDzaja commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Client-side support for the new sandbox TTL (maximum time to live) feature.

What TTL is

A wall-clock deadline after which a sandbox is destroyed regardless of its state (started, stopped, paused, archived). Class-agnostic and orthogonal to the idle-based intervals — no mutual exclusivity, no ephemeral/class gating.

API surface (all SDKs + CLI + MCP)

  • ttlMinutes — input-only create parameter (minutes; 0 = disabled). Client-side validated as a non-negative integer. Never stored or returned on the sandbox object.
  • expiresAt — read-only field on the sandbox object, mapped from the DTO. Only set when a TTL is configured.
  • setTtl(minutes) — re-anchors the deadline from the current time (sliding, so it can extend or shorten the remaining lifetime); 0 disables.
  • CLI: daytona sandbox create --ttl <minutes>; MCP: ttlMinutes arg on the create_sandbox tool.

Setter semantics

  • The setter returns void and does not mutate local state — the server computes the deadline.
  • Read the updated deadline via refreshData() / refresh_data(), which populates expiresAt.

Per-language surface:

SDK Create param Read field Setter
TypeScript ttlMinutes sandbox.expiresAt sandbox.setTtl()
Python (sync + async) ttl_minutes sandbox.expires_at sandbox.set_ttl()
Go TtlMinutes Sandbox.ExpiresAt — (mirrors existing convention: no interval setters)
Java ttlMinutes getExpiresAt() setTtl(int)
Ruby ttl_minutes #expires_at #ttl_minutes=

Generated clients

openapi-specs/api.json synced with the new API surface; all api-client* regenerated (setTtl operation, CreateSandbox.ttlMinutes, Sandbox.expiresAt). Regeneration is byte-stable against the committed spec.


Summary by cubic

Add sandbox TTL across SDKs and CLI. Users can set a wall-clock expiration that destroys a sandbox when it elapses; the deadline is exposed as autoDestroyAt.

  • New Features

    • API: POST /sandbox/{sandboxIdOrName}/ttl/{ttlMinutes} (setTtl). openapi-specs/api.json updated; all api-client* regenerated.
    • SDKs: Add create param ttlMinutes and read-only autoDestroyAt in sdk-typescript, sdk-python (sync/async), sdk-java, sdk-ruby, sdk-go. Setters: TypeScript sandbox.setTtl(minutes), Python sandbox.set_ttl(minutes) / async_sandbox.set_ttl(minutes), Java sandbox.setTtl(int), Ruby sandbox.ttl_minutes = minutes; Go exposes AutoDestroyAt and accepts TtlMinutes on create.
    • Behavior: 0 disables TTL. Setter re-anchors from now; server computes the deadline. Call refreshData() / refresh_data() / #refresh to read updated autoDestroyAt.
    • Validation: All SDKs and CLI reject negative TTL with clear errors.
    • CLI/MCP: daytona sandbox create --ttl <minutes>; MCP create_sandbox supports ttlMinutes.
    • Docs: SDK docs updated to cover TTL and autoDestroyAt.
  • Refactors

    • Rename expiresAt to autoDestroyAt across SDKs, API clients, and docs.
    • Go: refresh now populates AutoDestroyAt; minor cleanup.
    • Java: Sandbox.setTtl validates non-negative input and delegates to the API without mutating local state; Java SDK docs fixed/clarified for TTL and getAutoDestroyAt().

Written for commit 340ee6b. Summary will update on new commits.

Review in cubic

MDzaja added 2 commits July 17, 2026 09:49
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
@MDzaja
MDzaja force-pushed the feat/sandbox-ttl branch from 9240d68 to 11745d9 Compare July 17, 2026 09:56
…ebase

Signed-off-by: MDzaja <mirkodzaja0@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 71 files

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread sdk-python/src/daytona/_sync/sandbox.py
Comment thread sdk-ruby/lib/daytona/sandbox.rb
Comment thread sdk-java/src/main/java/io/daytona/sdk/Sandbox.java
Comment thread sdk-python/src/daytona/_async/sandbox.py
Comment thread artifacts/sdk-docs/python-sdk/sync/sandbox.mdx
Comment thread openapi-specs/api.json
Comment thread sdk-ruby/lib/daytona/sandbox.rb
Comment thread artifacts/sdk-docs/java-sdk/sandbox.mdx Outdated
Comment thread artifacts/sdk-docs/ruby-sdk/sandbox.mdx
Comment thread sdk-ruby/lib/daytona/sandbox.rb Outdated
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread artifacts/sdk-docs/java-sdk/sandbox.mdx Outdated
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
@MDzaja
MDzaja merged commit a1ed5aa into main Jul 17, 2026
20 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant