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
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tensorlake",
"version": "2.8.0",
"version": "2.9.0",
"description": "Tensorlake SDK for agent sandboxes and sandbox-native orchestration. Use when building AI agents that need sandboxed execution environments, isolated tool calls, or durable workflow orchestration.",
"author": "TensorLake",
"homepage": "https://github.com/tensorlakeai/tensorlake-skills",
Expand Down
35 changes: 18 additions & 17 deletions .github/scripts/sources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,27 @@ sandbox_sdk.md:
- https://docs.tensorlake.ai/sandboxes/commands.md
- https://docs.tensorlake.ai/sandboxes/environment-variables.md
- https://docs.tensorlake.ai/sandboxes/file-operations.md
- https://docs.tensorlake.ai/sandboxes/processes.md
- https://docs.tensorlake.ai/sandboxes/networking.md
- https://docs.tensorlake.ai/sandboxes/images.md
- https://docs.tensorlake.ai/sandboxes/pty-sessions.md
- https://docs.tensorlake.ai/sandboxes/docker.md
- https://docs.tensorlake.ai/sandboxes/async.md
- https://docs.tensorlake.ai/sandboxes/tunnels.md
sdk_version: "0.5.17"
last_verified: "2026-05-23"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

computer_use.md:
sources:
- https://docs.tensorlake.ai/sandboxes/computer-use.md
sdk_version: "0.5.17"
last_verified: "2026-05-23"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

sandbox_persistence.md:
sources:
- https://docs.tensorlake.ai/sandboxes/lifecycle.md
- https://docs.tensorlake.ai/sandboxes/snapshots.md
sdk_version: "0.5.17"
last_verified: "2026-05-23"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

applications_sdk.md:
sources:
Expand All @@ -73,8 +72,8 @@ applications_sdk.md:
- https://docs.tensorlake.ai/applications/sandboxes.md
- https://docs.tensorlake.ai/applications/guides/streaming-progress.md
- https://docs.tensorlake.ai/applications/guides/logging.md
sdk_version: "0.5.0"
last_verified: "2026-04-24"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

integrations.md:
sources:
Expand All @@ -84,8 +83,8 @@ integrations.md:
- https://docs.tensorlake.ai/integrations/qdrant.md
- https://docs.tensorlake.ai/integrations/databricks.md
- https://docs.tensorlake.ai/integrations/motherduck.md
sdk_version: "0.5.0"
last_verified: "2026-04-24"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

platform.md:
sources:
Expand All @@ -103,30 +102,32 @@ platform.md:
- https://docs.tensorlake.ai/platform/playground/sample-documents.md
- https://docs.tensorlake.ai/platform/security.md
- https://docs.tensorlake.ai/platform/sso.md
sdk_version: "0.5.0"
last_verified: "2026-04-24"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

sandbox_usecases.md:
sources:
- https://docs.tensorlake.ai/sandboxes/skills-in-sandboxes.md
- https://docs.tensorlake.ai/sandboxes/tool-calls.md
- https://docs.tensorlake.ai/sandboxes/claude-managed-agents.md
- https://docs.tensorlake.ai/sandboxes/data-analysis.md
- https://docs.tensorlake.ai/sandboxes/cicd-build.md
- https://docs.tensorlake.ai/sandboxes/agentic-autoresearch.md
- https://docs.tensorlake.ai/sandboxes/agentic-rl-reproducible-env.md
- https://docs.tensorlake.ai/sandboxes/agentic-swarm-intelligence.md
- https://docs.tensorlake.ai/sandboxes/agentic-d&g.md
- https://docs.tensorlake.ai/sandboxes/gspo-agentic-rl.md
- https://docs.tensorlake.ai/sandboxes/chrome-cdp.md
- https://docs.tensorlake.ai/sandboxes/harbor.md
- https://docs.tensorlake.ai/sandboxes/remote-dev.md
sdk_version: "0.5.17"
last_verified: "2026-05-23"
sdk_version: "0.5.44"
last_verified: "2026-06-16"

troubleshooting.md:
sources:
- https://docs.tensorlake.ai/applications/overview.md
- https://docs.tensorlake.ai/applications/production/troubleshooting.md
- https://docs.tensorlake.ai/document-ingestion/production/integration.md
- https://docs.tensorlake.ai/document-ingestion/production/benchmarks.md
sdk_version: "0.5.0"
last_verified: "2026-04-24"
sdk_version: "0.5.44"
last_verified: "2026-06-16"
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tensorlake SDK
<!-- version: 2.8.0 -->
<!-- version: 2.9.0 -->

Tensorlake SDK — sandboxes for AI agents and applications. Use when the user mentions tensorlake or sandboxes, or asks about Tensorlake APIs/docs/capabilities. Also use when building an application, coding agent, or agentic system that needs a sandbox to run code — e.g., executing LLM-generated or untrusted code, persistence via suspend/resume, snapshots/checkpoints for forking parallel workers, custom images, exposing ports, egress allowlists, PTY/interactive shells, computer-use / desktop automation, browser automation (Chrome CDP, Playwright), local tunnels for non-HTTP protocols, async parallel sandboxes, Harbor evals or RL rollouts, file transfer, SSH access, remote-dev (VS Code Remote-SSH), or OCI base images. Also covers Tensorlake's sandbox-native durable workflow orchestration. Works alongside any LLM provider (OpenAI, Anthropic), agent framework (Claude/OpenAI agents SDK, LangChain), database, or API. When this skill applies, ALWAYS WebFetch https://docs.tensorlake.ai/llms.txt first.

Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to the TensorLake skill are documented here.

## [2.9.0] — SDK 0.5.44 — 2026-06-16

### Added
- **`references/sandbox_sdk.md`** — new "Managed Processes" section: supervised background processes via `start_process(..., name=, restart=RestartPolicyConfig(...), health_check=ProcessHealthCheck(...), user=)`, plus `get_process` / `restart_process` (TS `getProcess` / `restartProcess`), the new imports (`ProcessHealthCheck`, `ProcessHealthCheckType`, `RestartPolicy`, `RestartPolicyConfig`), restart policies (`never` / `on_failure` / `always`), HTTP/TCP health checks, default process user `tl-user`, and CLI `--detach` / `tl sbx ps|restart|kill`. New "Import an Image from a Registry" section (`tl sbx image import`, `import_sandbox_image()`, `importSandboxImage()`) and "Public Images" section (`--public` / `is_public` / `isPublic` for cross-namespace resolvable names).
- **`references/sandbox_usecases.md`** — new "Claude Managed Agents" section (run the Claude Agent SDK / managed agents on sandboxes: brain-vs-hands model, three orchestrator modes, recreate-vs-resume for long sessions, per-command env injection, common failure modes) and a concise "Agentic Dungeons & Dragons" section (branch→map→reduce multi-agent demo running untrusted dice scripts in isolated sandboxes). Added `claude-managed-agents.md` and `agentic-d&g.md` to the source list.
- **`references/feature_lookup.md`** — new entries for Claude managed agents and Agentic Dungeons & Dragons.

### Changed
- **`references/sandbox_sdk.md`** — bumped SDK version 0.5.17 → 0.5.44 and `Last verified:` to 2026-06-16. Removed `sandboxes/processes.md` from the source list (it now redirects into `sandboxes/commands.md`, "Commands & Processes"). Image build API now uses `image.build(registered_name=...)` / `registeredName` (was bare `build()`), with `context_dir` / `contextDir`, `builder_disk_mb` / `builderDiskMb`, corrected build defaults, and fully-qualified base names; added `tl sbx image register` / `tl sbx image ls`. `SandboxInfo` corrected: lowercase `SandboxStatus` enum, added `ingress_endpoint` / `sandbox_url` / `network`, nullable `image` / `timeout_secs` / `exposed_ports` / `entrypoint`, dropped undocumented `secret_names` and `resources.disk_mb`. "Supported Build Operations" rewritten to the live Dockerfile limitations. Expanded SSH (tmux/screen persistent shells, auth-failure messages, `tl sbx ls -r`, `IdentitiesOnly`). File ops use `bytes(read_file(...))` and `list_directory(...).entries`.
- **`references/applications_sdk.md`** — bumped SDK version 0.5.0 → 0.5.44 and `Last verified:` to 2026-06-16. CLI corrected to `tl app deploy` / `tl app new`; `@application` defaults clarified (no retries by default, any-region); class-method applications callable by name string; `progress.update()` corrected to positional `current, total, message=None, attributes=None`; `File` raw-bytes / 5 TB note; scaling rate-limit formula (`max_containers × concurrency`); Cron Scheduler expanded (per-minute granularity, `schedule_id`, List/Delete endpoints, 1 MiB input limit); Secrets corrected to envelope encryption (per-project DEK wrapped by KMS KEK, mTLS); Observability/Logging corrected to structlog-style `Logger` usage, log levels TRACE–ERROR, 7-day retention, and the `GET /logs` query API.
- **`references/sandbox_persistence.md`** — bumped SDK version 0.5.17 → 0.5.44 and `Last verified:` to 2026-06-16. Corrected the memory-snapshot restore lock: only image, resources (CPUs, memory), and entrypoint are inherited/immutable — `secrets` removed from that list (fixed in the TL;DR, Snapshot Types table, restore bullet, and Limitations). Clarified omitted snapshot type is a server-side default (currently `filesystem`).
- **`references/computer_use.md`** — bumped SDK version 0.5.17 → 0.5.44 and `Last verified:` to 2026-06-16 (content already matched the live doc; no material changes).
- **`.github/scripts/sources.yaml`** — bumped `sdk_version` / `last_verified` to `0.5.44` / `2026-06-16` for `sandbox_sdk.md`, `computer_use.md`, `sandbox_persistence.md`, `applications_sdk.md`, and `sandbox_usecases.md`. Removed `processes.md` from `sandbox_sdk.md` sources; added `claude-managed-agents.md` and `agentic-d&g.md` to `sandbox_usecases.md` sources.
- **`README.md`** — illustrative source-header example bumped to `tensorlake 0.5.44` / `2026-06-16`.

## [2.8.0] — SDK 0.5.17 — 2026-05-23

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ Each reference file has a source header that tracks which doc pages it was built
Source:
- https://docs.tensorlake.ai/sandboxes/lifecycle.md
- https://docs.tensorlake.ai/sandboxes/commands.md
SDK version: tensorlake 0.5.17
Last verified: 2026-05-23
SDK version: tensorlake 0.5.44
Last verified: 2026-06-16
-->
```

Expand Down
2 changes: 1 addition & 1 deletion SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ description: >
https://docs.tensorlake.ai/llms.txt first.
metadata:
author: tensorlake
version: 2.8.0
version: 2.9.0
---

# What can you do with Tensorlake SDK
Expand Down
76 changes: 58 additions & 18 deletions references/applications_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Source:
- https://docs.tensorlake.ai/applications/sandboxes.md
- https://docs.tensorlake.ai/applications/guides/streaming-progress.md
- https://docs.tensorlake.ai/applications/guides/logging.md
SDK version: tensorlake 0.5.0
Last verified: 2026-04-24
SDK version: tensorlake 0.5.44
Last verified: 2026-06-16
-->

# TensorLake Applications SDK Reference
Expand Down Expand Up @@ -59,7 +59,7 @@ from tensorlake.applications import (
get_remote_request,
Future, RETURN_WHEN,
RequestContext, Request, File, Image, Retries,
ReplayMode, RequestError,
ReplayMode, RequestError, Logger,
)
```

Expand All @@ -72,8 +72,8 @@ Entry point decorator. Must wrap a function also decorated with `@function()`.
```python
@application(
tags: dict[str, str] = {},
retries: Retries | None = None,
region: str | None = None, # "us-east-1" or "eu-west-1"
retries: Retries | None = None, # Default for all functions; no retries by default
region: str | None = None, # "us-east-1" or "eu-west-1"; default any region
)
```

Expand Down Expand Up @@ -116,6 +116,9 @@ class MyProcessor:
@function(gpu="T4")
def process(self, data: str) -> str:
return self.model.predict(data)

# Call a class-method application by name:
# run_remote_application("MyProcessor.process", data="...")
```

## Calling Functions
Expand Down Expand Up @@ -228,8 +231,11 @@ output = request.output()
```

```bash
# Scaffold a new application (creates hello_world/hello_world.py)
tl app new hello_world

# Deploy before running remotely
tl deploy path/to/app.py
tl app deploy path/to/app.py
```

## Durable Execution
Expand Down Expand Up @@ -266,13 +272,20 @@ ctx.state.set(key, value)
ctx.state.get(key, default=None)

# Metrics
ctx.metrics.timer(name, value)
ctx.metrics.counter(name, value)
ctx.metrics.timer(name, value) # duration in seconds
ctx.metrics.counter(name, value=1) # counters start at 0

# Progress reporting (also resets timeout)
ctx.progress.update(current=10, total=100, message="Processing...")
ctx.progress.update(
current, # int | float (step or percentage)
total, # int | float (total steps, or 100 for percent)
message=None, # optional str
attributes=None, # optional dict[str, str] metadata
)
```

Poll progress at `GET /applications/{app}/requests/{request_id}/progress`.

## Image Builder

Build custom container images for functions.
Expand Down Expand Up @@ -303,6 +316,10 @@ file.content # bytes
file.content_type # str
```

A `File` arg/return bypasses JSON/pickle and is passed as raw bytes. As an application
input/output, the HTTP body is the raw bytes and content type. Files up to 5 TB are
supported (loaded fully into memory; no lazy loading yet).

## Retries

```python
Expand All @@ -328,29 +345,44 @@ def agent(prompt: str) -> str: ...
```

- `warm_containers`: Pre-warmed containers for zero cold-start latency
- `max_containers`: Upper limit; excess requests queued FIFO
- `max_containers`: Upper limit; excess requests queued FIFO (no separate queue infra needed)
- `concurrency`: Concurrent requests per container
- Default (no params): scales dynamically from zero, no upper limit
- **Rate-limit external APIs**: total concurrent calls = `max_containers` × `concurrency`

## Cron Scheduler

Schedule periodic application runs via REST API:
Schedule recurring invocations of a deployed application via REST API (or the UI).
Schedule starts immediately on creation.

```python
import requests, base64, json

payload = {"cron_expression": "0 * * * *"}
payload = {"cron_expression": "0 * * * *"} # 5-field cron; "* * * * *" = every minute
input_data = json.dumps({"report_type": "daily"}).encode()
payload["input_base64"] = base64.b64encode(input_data).decode()
payload["input_base64"] = base64.b64encode(input_data).decode() # optional, max 1 MiB decoded

response = requests.post(
# Create
resp = requests.post(
f"https://api.tensorlake.ai/applications/{application}/cron-schedules",
json=payload,
headers={"Authorization": "Bearer TENSORLAKE_API_KEY"},
)
schedule_id = resp.json()["schedule_id"] # save it; needed to delete

# List -> {"schedules": [{id, application_name, cron_expression, next_fire_time_ms,
# last_fired_at_ms, created_at, enabled}, ...]}
requests.get(f"https://api.tensorlake.ai/applications/{application}/cron-schedules", headers=...)

# Delete (permanent; to modify, delete + recreate)
requests.delete(
f"https://api.tensorlake.ai/applications/{application}/cron-schedules/{schedule_id}",
headers=...,
)
```

Minimum interval: 60 seconds. Max 100 schedules per application.
Minimum interval: 60 seconds (sub-minute expressions rejected with 400). Max 100 schedules
per application. Max input payload 1 MiB decoded.

## Exceptions

Expand All @@ -374,15 +406,23 @@ def my_func() -> str:
key = os.environ["OPENAI_API_KEY"]
```

Redeploy applications after updating secrets. AES-256-GCM encryption, in-memory decryption only during execution.
Redeploy applications after adding/updating a secret for new values to take effect.
Envelope encryption (AES-256-GCM): a per-project DEK wrapped by a KEK in AWS KMS;
decrypted in-memory only on dataplane machines running the function, over mTLS.

## Observability

Every `@function()` call is automatically traced. The dashboard shows function call sequence, timing (including cold starts), dependency visualization, and status. Use standard Python `logging` module; logs are captured automatically.
Every `@function()` call is automatically traced. The dashboard shows function call sequence, timing (including cold starts), dependency visualization, and status. Use standard Python `print()`/`logging` (captured automatically, default level INFO), or the built-in structured logger:

```python
from tensorlake.applications import Logger

logger = Logger.get_logger(module="my_app")
logger.info("starting run", log_attributes={"request_id": "req-123"})
logger.info("User logged in", user_id=123) # structlog-style kwargs
logger.error("An error occurred", exc_info=True)
logger = logger.bind(request_id="req-123") # bind context to all subsequent logs
```

Levels TRACE(1)..ERROR(5). `structlog` (JSON renderer) also supported. Logs retained 7 days
(extendable to 30 days / 1 year). Query via `GET /applications/{app}/logs` with filters
(`requestId`, `function`, `level`, `gate=and|or`, `head`/`tail`, `nextToken`).
4 changes: 2 additions & 2 deletions references/computer_use.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--
Source:
- https://docs.tensorlake.ai/sandboxes/computer-use.md
SDK version: tensorlake 0.5.17
Last verified: 2026-05-23
SDK version: tensorlake 0.5.44
Last verified: 2026-06-16
-->

# Computer Use (Desktop Automation)
Expand Down
2 changes: 2 additions & 0 deletions references/feature_lookup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Bundled offline equivalent of [docs.tensorlake.ai/llms.txt](https://docs.tensorl
- [Computer use / desktop automation](computer_use.md) — XFCE + Firefox, screenshots, mouse/keyboard, noVNC live view
- [Drive Chrome over CDP](sandbox_usecases.md#drive-chrome-over-cdp) — sandboxed Google Chrome with `--remote-debugging-port`, Playwright `connect_over_cdp`, raw CDP WebSocket, `chrome-devtools-mcp` for Claude Code / Codex
- [Skills in sandboxes](sandbox_usecases.md) — bundling Claude Code, Codex, Cursor, Cline, Windsurf, GitHub Copilot, Google ADK skills inside images
- [Claude managed agents](sandbox_usecases.md#claude-managed-agents) — run Claude Agent SDK / managed agents on sandboxes; orchestrator modes, recreate-vs-resume for long sessions, per-command env injection
- [SSH access](sandbox_sdk.md#ssh) — connect with `ssh`/`scp`/`sftp`/`rsync`, port forwarding (`-L` / `-D` / `-R`), VS Code Remote-SSH and JetBrains Gateway
- [Sandbox as a dev environment](sandbox_usecases.md#sandbox-as-a-dev-environment) — portable cloud workstation with idle-suspend, resume-by-name, and persistent `~/.vscode-server`
- [OCI base images](sandbox_sdk.md#base-images) — build from any standard OCI reference (`python:3.12-slim`, `node:22-alpine`, `ghcr.io/...`) plus `tensorlake/*` bases; private-registry auth via `~/.docker/config.json`
Expand All @@ -30,6 +31,7 @@ Bundled offline equivalent of [docs.tensorlake.ai/llms.txt](https://docs.tensorl

- [Tool calls / sandbox-as-tool](sandbox_usecases.md#ai-code-execution) — LLM code-execution tool, executing untrusted/LLM-generated code with network policy
- [Agentic swarm intelligence](sandbox_usecases.md) — fan-out parallel specialist agents
- [Agentic Dungeons & Dragons](sandbox_usecases.md#agentic-dungeons--dragons) — branch→map→reduce multi-agent demo running untrusted dice scripts in isolated sandboxes
- [RL training (GSPO)](sandbox_usecases.md) — fine-tune on code generation with sandbox reward oracle
- [RL reproducible environments](sandbox_usecases.md) — deterministic isolated rollouts
- [Agentic autoresearch loop](sandbox_usecases.md) — overnight ML script self-improvement with parallel sandbox races
Expand Down
Loading
Loading