Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
feat: add template versioning with tags support for JS and Python SDKs (#1080)
Jakub Dobry10abab8e9669
diff --git a/.changeset/cli-template-build-format.md b/.changeset/cli-template-build-format.mdnew file mode 100644index 000000000..fe83a10dd--- /dev/null+++ b/.changeset/cli-template-build-format.md@@ -0,0 +1,5 @@+---+'@e2b/cli': patch+---++Update templates to use new `Template.build()` formatdiff --git a/.changeset/template-versioning-tags.md b/.changeset/template-versioning-tags.mdnew file mode 100644index 000000000..c0513a6b8--- /dev/null+++ b/.changeset/template-versioning-tags.md@@ -0,0 +1,10 @@+---+'e2b': minor+'@e2b/python-sdk': minor+---++Add template versioning with tags support++- `Template.build()` now accepts names in `name:tag` format (e.g., `"my-template:v1.0"`)+- New `Template.assignTags()` / `Template.assign_tags()` to assign tags to existing builds+- New `Template.removeTags()` / `Template.remove_tags()` to remove tagsdiff --git a/packages/cli/src/templates/python-build-async.hbs b/packages/cli/src/templates/python-build-async.hbsindex 733f81f27..ca29d434d 100644--- a/packages/cli/src/templates/python-build-async.hbs+++ b/packages/cli/src/templates/python-build-async.hbs@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="{{alias}}",+ "{{alias}}",{{#if cpuCount}}cpu_count={{cpuCount}},{{/if}}diff --git a/packages/cli/src/templates/python-build-sync.hbs b/packages/cli/src/templates/python-build-sync.hbsindex 0e14e25ac..59cd6e092 100644--- a/packages/cli/src/templates/python-build-sync.hbs+++ b/packages/cli/src/templates/python-build-sync.hbs@@ -5,7 +5,7 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="{{alias}}",+ "{{alias}}",{{#if cpuCount}}cpu_count={{cpuCount}},{{/if}}diff --git a/packages/cli/src/templates/typescript-build.hbs b/packages/cli/src/templates/typescript-build.hbsindex 345e4a3a9..f1f15b6c6 100644--- a/packages/cli/src/templates/typescript-build.hbs+++ b/packages/cli/src/templates/typescript-build.hbs@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: '{{alias}}',+ await Template.build(template, '{{alias}}', {{{#if cpuCount}}cpuCount: {{cpuCount}},{{/if}}diff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.pyindex 12403ca40..e9831b18b 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="complex-python-app-dev",+ "complex-python-app-dev",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.pyindex 5632e7cf0..18aa5b660 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="complex-python-app",+ "complex-python-app",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.pyindex 0bd7efb39..8c884a5f6 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_dev.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="complex-python-app-dev",+ "complex-python-app-dev",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.pyindex 4fee27afd..082f75c42 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/python-sync/build_prod.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="complex-python-app",+ "complex-python-app",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.tsindex 6ee102d29..56881180b 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'complex-python-app-dev',+ await Template.build(template, 'complex-python-app-dev', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.tsindex 9989c4544..8fe6d9a55 100644--- a/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/complex-python/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'complex-python-app',+ await Template.build(template, 'complex-python-app', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.pyindex 6d6f9b795..d998b5a94 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="copy-test-dev",+ "copy-test-dev",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.pyindex 7da8d12f0..f18d3c9b5 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="copy-test",+ "copy-test",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.pyindex 8670f90ef..570303273 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_dev.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="copy-test-dev",+ "copy-test-dev",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.pyindex e59627f40..c8e6ac40a 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/python-sync/build_prod.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="copy-test",+ "copy-test",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.tsindex 6cc5a2f7b..b50a094f4 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'copy-test-dev',+ await Template.build(template, 'copy-test-dev', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.tsindex 57d99a181..bef2b3e21 100644--- a/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/copy-variations/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'copy-test',+ await Template.build(template, 'copy-test', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.pyindex a7a8d0c17..33c1e1d6b 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="custom-app-dev",+ "custom-app-dev",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.pyindex 8832ab77a..7f0db5b05 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="custom-app",+ "custom-app",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.pyindex 5bfe31df0..3ceaf7f5d 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_dev.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="custom-app-dev",+ "custom-app-dev",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.pyindex 5d9539dd6..b8131505b 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/python-sync/build_prod.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="custom-app",+ "custom-app",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.tsindex 5eab3397b..fcd8a60ae 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'custom-app-dev',+ await Template.build(template, 'custom-app-dev', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.tsindex 4f3085568..00ac2231a 100644--- a/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/custom-commands/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'custom-app',+ await Template.build(template, 'custom-app', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.pyindex ef52970bf..d63430b19 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="minimal-template-dev",+ "minimal-template-dev",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.pyindex 9c1309763..499c26251 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="minimal-template",+ "minimal-template",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.pyindex 7d1a9dec0..9d7aa78cc 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_dev.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="minimal-template-dev",+ "minimal-template-dev",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.pyindex 0adb0fad1..62ccb29ee 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/python-sync/build_prod.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="minimal-template",+ "minimal-template",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.tsindex cfba1c003..8cd195a47 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'minimal-template-dev',+ await Template.build(template, 'minimal-template-dev', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.tsindex 4c6eacaf3..fdc463aad 100644--- a/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/minimal-dockerfile/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'minimal-template',+ await Template.build(template, 'minimal-template', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.pyindex 360b30855..4cf9bfa48 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="multi-stage-dev",+ "multi-stage-dev",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.pyindex 96c32b12b..23d29ef82 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="multi-stage",+ "multi-stage",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.pyindex 0078c2dcb..ff50bda88 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_dev.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="multi-stage-dev",+ "multi-stage-dev",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.pyindex e28ec6d30..0482afd92 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/python-sync/build_prod.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="multi-stage",+ "multi-stage",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.tsindex 7992e5d0f..e11abe5ad 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'multi-stage-dev',+ await Template.build(template, 'multi-stage-dev', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.tsindex 133492953..9f7b84cef 100644--- a/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/multi-stage/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'multi-stage',+ await Template.build(template, 'multi-stage', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.pyindex f9f4d349e..e412fea8c 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="env-test-dev",+ "env-test-dev",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.pyindex a4b1b3c53..429b2bef0 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="env-test",+ "env-test",on_build_logs=default_build_logger(),)diff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.pyindex 2435d88ea..109806c79 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_dev.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="env-test-dev",+ "env-test-dev",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.pyindex bea6a34c0..c4920362e 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/python-sync/build_prod.py@@ -5,6 +5,6 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="env-test",+ "env-test",on_build_logs=default_build_logger(),)\ No newline at end of filediff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.tsindex 2fab51c19..d1256a333 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'env-test-dev',+ await Template.build(template, 'env-test-dev', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.tsindex f2e148103..8f1dedc6c 100644--- a/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/multiple-env/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'env-test',+ await Template.build(template, 'env-test', {onBuildLogs: defaultBuildLogger(),});}diff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.pyindex 5cb5d9e0f..01db35dbf 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_dev.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="start-cmd-dev",+ "start-cmd-dev",cpu_count=2,memory_mb=1024,on_build_logs=default_build_logger(),diff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.pyindex 5e7bcc9f3..d80427426 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-async/build_prod.py@@ -6,7 +6,7 @@ from .template import templateasync def main():await AsyncTemplate.build(template,- alias="start-cmd",+ "start-cmd",cpu_count=2,memory_mb=1024,on_build_logs=default_build_logger(),diff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.pyindex 4698963e3..bd7bf61ca 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_dev.py@@ -5,7 +5,7 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="start-cmd-dev",+ "start-cmd-dev",cpu_count=2,memory_mb=1024,on_build_logs=default_build_logger(),diff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.py b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.pyindex 3e75fadbf..24a98cce3 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.py+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/python-sync/build_prod.py@@ -5,7 +5,7 @@ from .template import templateif __name__ == "__main__":Template.build(template,- alias="start-cmd",+ "start-cmd",cpu_count=2,memory_mb=1024,on_build_logs=default_build_logger(),diff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.ts b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.tsindex 8c13375f4..1fd055316 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.ts+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.dev.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'start-cmd-dev',+ await Template.build(template, 'start-cmd-dev', {cpuCount: 2,memoryMB: 1024,onBuildLogs: defaultBuildLogger(),diff --git a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.ts b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.tsindex 74677ba71..1e39efa99 100644--- a/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.ts+++ b/packages/cli/tests/commands/template/fixtures/start-cmd/expected/typescript/build.prod.ts@@ -2,8 +2,7 @@ import { Template, defaultBuildLogger } from 'e2b'import { template } from './template'async function main() {- await Template.build(template, {- alias: 'start-cmd',+ await Template.build(template, 'start-cmd', {cpuCount: 2,memoryMB: 1024,onBuildLogs: defaultBuildLogger(),diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.jsonindex ebe350757..ea47132da 100644--- a/packages/js-sdk/package.json+++ b/packages/js-sdk/package.json@@ -29,7 +29,7 @@"example": "tsx example.mts","test": "vitest run","generate": "npm-run-all generate:* && pnpm run format",- "generate:api": "python ./../../spec/remove_extra_tags.py sandboxes templates auth && openapi-typescript ../../spec/openapi_generated.yml -x api_key --array-length --alphabetize --default-non-nullable false --output src/api/schema.gen.ts",+ "generate:api": "python ./../../spec/remove_extra_tags.py sandboxes templates tags auth && openapi-typescript ../../spec/openapi_generated.yml -x api_key --array-length --alphabetize --default-non-nullable false --output src/api/schema.gen.ts","generate:envd": "cd ../../spec/envd && buf generate --template buf-js.gen.yaml\n","generate:envd-api": "openapi-typescript ../../spec/envd/envd.yaml -x api_key --array-length --alphabetize --output src/envd/schema.gen.ts","generate:mcp": "json2ts -i ./../../spec/mcp-server.json -o src/sandbox/mcp.d.ts --unreachableDefinitions --style.singleQuote --no-style.semi",diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.tsindex d11fb8874..f735216ce 100644--- a/packages/js-sdk/src/api/schema.gen.ts+++ b/packages/js-sdk/src/api/schema.gen.ts@@ -15,7 +15,7 @@ export interface paths {get: {parameters: {query?: {- /** @description Metadata query used to filter the sandboxes (e.g. 'user=abc&app=prod'). Each key and values must be URL encoded. */+ /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */metadata?: string;};header?: never;@@ -1062,6 +1062,76 @@ export interface paths {patch?: never;trace?: never;};+ "/templates/tags": {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ get?: never;+ put?: never;+ /** @description Assign tag(s) to a template build */+ post: {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["AssignTemplateTagsRequest"];+ };+ };+ responses: {+ /** @description Tag assigned successfully */+ 201: {+ headers: {+ [name: string]: unknown;+ };+ content: {+ "application/json": components["schemas"]["AssignedTemplateTags"];+ };+ };+ 400: components["responses"]["400"];+ 401: components["responses"]["401"];+ 404: components["responses"]["404"];+ 500: components["responses"]["500"];+ };+ };+ /** @description Delete multiple tags from templates */+ delete: {+ parameters: {+ query?: never;+ header?: never;+ path?: never;+ cookie?: never;+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["DeleteTemplateTagsRequest"];+ };+ };+ responses: {+ /** @description Tags deleted successfully */+ 204: {+ headers: {+ [name: string]: unknown;+ };+ content?: never;+ };+ 400: components["responses"]["400"];+ 401: components["responses"]["401"];+ 404: components["responses"]["404"];+ 500: components["responses"]["500"];+ };+ };+ options?: never;+ head?: never;+ patch?: never;+ trace?: never;+ };"/v2/sandboxes": {parameters: {query?: never;@@ -1075,7 +1145,7 @@ export interface paths {query?: {/** @description Maximum number of items to return per page */limit?: components["parameters"]["paginationLimit"];- /** @description Metadata query used to filter the sandboxes (e.g. 'user=abc&app=prod'). Each key and values must be URL encoded. */+ /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */metadata?: string;/** @description Cursor to start the list from */nextToken?: components["parameters"]["paginationNextToken"];@@ -1252,10 +1322,19 @@ export interface components {/** @description Number of sandboxes successfully killed */killedCount: number;};- AssignTemplateTagRequest: {- /** @description Names of the template */- names: string[];- /** @description Target template name in 'alias:tag' format */+ AssignedTemplateTags: {+ /**+ * Format: uuid+ * @description Identifier of the build associated with these tags+ */+ buildID: string;+ /** @description Assigned tags of the template */+ tags: string[];+ };+ AssignTemplateTagsRequest: {+ /** @description Tags to assign to the template */+ tags: string[];+ /** @description Target template in "name:tag" format */target: string;};AWSRegistry: {@@ -1346,6 +1425,12 @@ export interface components {/** @description Name of the API key */name: string;};+ DeleteTemplateTagsRequest: {+ /** @description Name of the template */+ name: string;+ /** @description Tags to delete */+ tags: string[];+ };DiskMetrics: {/** @description Device name */device: string;@@ -1999,20 +2084,28 @@ export interface components {alias: string;cpuCount?: components["schemas"]["CPUCount"];memoryMB?: components["schemas"]["MemoryMB"];- /** @description Identifier of the team */+ /**+ * @deprecated+ * @description Identifier of the team+ */teamID?: string;};TemplateBuildRequestV3: {/*** @deprecated- * @description Alias of the template. Deprecated, use names instead.+ * @description Alias of the template. Deprecated, use name instead.*/alias?: string;cpuCount?: components["schemas"]["CPUCount"];memoryMB?: components["schemas"]["MemoryMB"];- /** @description Names of the template */- names?: string[];- /** @description Identifier of the team */+ /** @description Name of the template. Can include a tag with colon separator (e.g. "my-template" or "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array. */+ name?: string;+ /** @description Tags to assign to the template build */+ tags?: string[];+ /**+ * @deprecated+ * @description Identifier of the team+ */teamID?: string;};TemplateBuildStartV2: {@@ -2082,12 +2175,19 @@ export interface components {updatedAt: string;};TemplateRequestResponseV3: {- /** @description Aliases of the template */+ /**+ * @deprecated+ * @description Aliases of the template+ */aliases: string[];/** @description Identifier of the last successful build for given template */buildID: string;+ /** @description Names of the template */+ names: string[];/** @description Whether the template is public or only accessible by the team */public: boolean;+ /** @description Tags assigned to the template build */+ tags: string[];/** @description Identifier of the template */templateID: string;};@@ -2108,15 +2208,6 @@ export interface components {/** @description Type of the step */type: string;};- TemplateTag: {- /**- * Format: uuid- * @description Identifier of the build associated with this tag- */- buildID: string;- /** @description Tags of the template */- tags: string[];- };TemplateUpdateRequest: {/** @description Whether the template is public or only accessible by the team */public?: boolean;diff --git a/packages/js-sdk/src/template/buildApi.ts b/packages/js-sdk/src/template/buildApi.tsindex c5e8ebbbb..ffffe1e50 100644--- a/packages/js-sdk/src/template/buildApi.ts+++ b/packages/js-sdk/src/template/buildApi.ts@@ -3,9 +3,16 @@ import { stripAnsi } from '../utils'import { BuildError, FileUploadError, TemplateError } from '../errors'import { LogEntry } from './logger'import { getBuildStepIndex, tarFileStreamUpload } from './utils'+import {+ BuildStatusReason,+ TemplateBuildStatus,+ TemplateBuildStatusResponse,+ TemplateTagInfo,+} from './types'type RequestBuildInput = {- alias: string+ name: string+ tags?: string[]cpuCount: numbermemoryMB: number}@@ -31,7 +38,7 @@ type CheckAliasExistsInput = {alias: string}-export type GetBuildStatusResponse =+type ApiBuildStatusResponse =paths['/templates/{templateID}/builds/{buildID}/status']['get']['responses']['200']['content']['application/json']export type TriggerBuildTemplate =@@ -39,11 +46,12 @@ export type TriggerBuildTemplate =export async function requestBuild(client: ApiClient,- { alias, cpuCount, memoryMB }: RequestBuildInput+ { name, tags, cpuCount, memoryMB }: RequestBuildInput) {const requestBuildRes = await client.api.POST('/v3/templates', {body: {- alias,+ name,+ tags,cpuCount,memoryMB,},@@ -158,10 +166,29 @@ export async function triggerBuild(}}+function mapLogEntry(+ entry: ApiBuildStatusResponse['logEntries'][number]+): LogEntry {+ return new LogEntry(new Date(entry.timestamp), entry.level, entry.message)+}++function mapBuildStatusReason(+ reason: ApiBuildStatusResponse['reason']+): BuildStatusReason | undefined {+ if (!reason) {+ return undefined+ }+ return {+ message: reason.message,+ step: reason.step,+ logEntries: (reason.logEntries ?? []).map(mapLogEntry),+ }+}+export async function getBuildStatus(client: ApiClient,{ templateID, buildID, logsOffset }: GetBuildStatusInput-): Promise<GetBuildStatusResponse> {+): Promise<TemplateBuildStatusResponse> {const buildStatusRes = await client.api.GET('/templates/{templateID}/builds/{buildID}/status',{@@ -186,7 +213,14 @@ export async function getBuildStatus(throw new BuildError('Failed to get build status')}- return buildStatusRes.data+ return {+ buildID: buildStatusRes.data.buildID,+ templateID: buildStatusRes.data.templateID,+ status: buildStatusRes.data.status,+ logEntries: buildStatusRes.data.logEntries.map(mapLogEntry),+ logs: buildStatusRes.data.logs,+ reason: mapBuildStatusReason(buildStatusRes.data.reason),+ }}export async function checkAliasExists(@@ -238,7 +272,7 @@ export async function waitForBuildFinish(}): Promise<void> {let logsOffset = 0- let status: GetBuildStatusResponse['status'] = 'building'+ let status: TemplateBuildStatus = 'building'while (status === 'building' || status === 'waiting') {const buildStatus = await getBuildStatus(client, {@@ -249,15 +283,14 @@ export async function waitForBuildFinish(logsOffset += buildStatus.logEntries.length- buildStatus.logEntries.forEach(- (logEntry: GetBuildStatusResponse['logEntries'][number]) =>- onBuildLogs?.(- new LogEntry(- new Date(logEntry.timestamp),- logEntry.level,- stripAnsi(logEntry.message)- )+ buildStatus.logEntries.forEach((logEntry) =>+ onBuildLogs?.(+ new LogEntry(+ logEntry.timestamp,+ logEntry.level,+ stripAnsi(logEntry.message))+ ))status = buildStatus.status@@ -291,3 +324,40 @@ export async function waitForBuildFinish(throw new BuildError('Unknown build error occurred.')}++export async function assignTags(+ client: ApiClient,+ { targetName, tags }: { targetName: string; tags: string[] }+): Promise<TemplateTagInfo> {+ const res = await client.api.POST('/templates/tags', {+ body: { target: targetName, tags },+ })++ const error = handleApiError(res, TemplateError)+ if (error) {+ throw error+ }++ if (!res.data) {+ throw new TemplateError('Failed to assign tags')+ }++ return {+ buildId: res.data.buildID,+ tags: res.data.tags,+ }+}++export async function removeTags(+ client: ApiClient,+ { name, tags }: { name: string; tags: string[] }+): Promise<void> {+ const res = await client.api.DELETE('/templates/tags', {+ body: { name, tags },+ })++ const error = handleApiError(res, TemplateError)+ if (error) {+ throw error+ }+}diff --git a/packages/js-sdk/src/template/index.ts b/packages/js-sdk/src/template/index.tsindex 6f202c100..0712b1810 100644--- a/packages/js-sdk/src/template/index.ts+++ b/packages/js-sdk/src/template/index.ts@@ -1,12 +1,13 @@import type { PathLike } from 'node:fs'import { ApiClient } from '../api'-import { ConnectionConfig } from '../connectionConfig'+import { ConnectionConfig, ConnectionOpts } from '../connectionConfig'import { BuildError } from '../errors'import { runtime } from '../utils'import {+ assignTags,checkAliasExists,+ removeTags,getBuildStatus,- GetBuildStatusResponse,getFileUploadLink,requestBuild,triggerBuild,@@ -29,15 +30,18 @@ import {McpServerName,RegistryConfig,TemplateBuilder,+ TemplateBuildStatusResponse,TemplateClass,TemplateFinal,TemplateFromImage,TemplateOptions,+ TemplateTagInfo,} from './types'import {calculateFilesHash,getCallerDirectory,getCallerFrame,+ normalizeBuildArguments,padOctal,readDockerignore,readGCPServiceAccountJSON,@@ -104,73 +108,139 @@ export class TemplateBase* Build and deploy a template to E2B infrastructure.** @param template The template to build- * @param options Build configuration options+ * @param name Template name in 'name' or 'name:tag' format+ * @param options Optional build configuration options** @example* ```ts* const template = Template().fromPythonImage('3')- * await Template.build(template, {- * alias: 'my-python-env',- * cpuCount: 2,- * memoryMB: 1024- * })+ *+ * // Build with single tag in name+ * await Template.build(template, 'my-python-env:v1.0')+ *+ * // Build with multiple tags+ * await Template.build(template, 'my-python-env', { tags: ['v1.0', 'stable'] })+ * ```+ */+ static async build(+ template: TemplateClass,+ name: string,+ options?: Omit<BuildOptions, 'alias'>+ ): Promise<BuildInfo>+ /**+ * Build and deploy a template to E2B infrastructure.+ *+ * @param template The template to build+ * @param options Build configuration options with alias (deprecated)+ *+ * @deprecated Use the overload with `name` parameter instead.+ * @example+ * ```ts+ * // Deprecated:+ * await Template.build(template, { alias: 'my-python-env' })+ *+ * // Use instead:+ * await Template.build(template, 'my-python-env:v1.0')* ```*/static async build(template: TemplateClass,options: BuildOptions+ ): Promise<BuildInfo>+ static async build(+ template: TemplateClass,+ nameOrOptions: string | BuildOptions,+ options?: Omit<BuildOptions, 'alias'>): Promise<BuildInfo> {+ const { name, buildOptions } = normalizeBuildArguments(+ nameOrOptions,+ options+ )+try {- options.onBuildLogs?.(new LogEntryStart(new Date(), 'Build started'))+ buildOptions.onBuildLogs?.(new LogEntryStart(new Date(), 'Build started'))const baseTemplate = template as TemplateBase- const config = new ConnectionConfig(options)+ const config = new ConnectionConfig(buildOptions)const client = new ApiClient(config)- const data = await baseTemplate.build(client, options)+ const data = await baseTemplate.build(client, name, buildOptions)- options.onBuildLogs?.(+ buildOptions.onBuildLogs?.(new LogEntry(new Date(), 'info', 'Waiting for logs...'))await waitForBuildFinish(client, {templateID: data.templateId,buildID: data.buildId,- onBuildLogs: options.onBuildLogs,+ onBuildLogs: buildOptions.onBuildLogs,logsRefreshFrequency: baseTemplate.logsRefreshFrequency,stackTraces: baseTemplate.stackTraces,})return data} finally {- options.onBuildLogs?.(new LogEntryEnd(new Date(), 'Build finished'))+ buildOptions.onBuildLogs?.(new LogEntryEnd(new Date(), 'Build finished'))}}/**- * Build and deploy a template to E2B infrastructure.+ * Build and deploy a template to E2B infrastructure without waiting for completion.** @param template The template to build- * @param options Build configuration options+ * @param name Template name in 'name' or 'name:tag' format+ * @param options Optional build configuration options** @example* ```ts* const template = Template().fromPythonImage('3')- * const data = await Template.buildInBackground(template, {- * alias: 'my-python-env',- * cpuCount: 2,- * memoryMB: 1024- * })+ *+ * // Build with single tag in name+ * const data = await Template.buildInBackground(template, 'my-python-env:v1.0')+ *+ * // Build with multiple tags+ * const data = await Template.buildInBackground(template, 'my-python-env', { tags: ['v1.0', 'stable'] })+ * ```+ */+ static async buildInBackground(+ template: TemplateClass,+ name: string,+ options?: Omit<BuildOptions, 'alias'>+ ): Promise<BuildInfo>+ /**+ * Build and deploy a template to E2B infrastructure without waiting for completion.+ *+ * @param template The template to build+ * @param options Build configuration options with alias (deprecated)+ *+ * @deprecated Use the overload with `name` parameter instead.+ * @example+ * ```ts+ * // Deprecated:+ * await Template.buildInBackground(template, { alias: 'my-python-env' })+ *+ * // Use instead:+ * await Template.buildInBackground(template, 'my-python-env:v1.0')* ```*/static async buildInBackground(template: TemplateClass,options: BuildOptions+ ): Promise<BuildInfo>+ static async buildInBackground(+ template: TemplateClass,+ nameOrOptions: string | BuildOptions,+ options?: Omit<BuildOptions, 'alias'>): Promise<BuildInfo> {- const config = new ConnectionConfig(options)+ const { name, buildOptions } = normalizeBuildArguments(+ nameOrOptions,+ options+ )++ const config = new ConnectionConfig(buildOptions)const client = new ApiClient(config)- return await (template as TemplateBase).build(client, options)+ return (template as TemplateBase).build(client, name, buildOptions)}/**@@ -187,7 +257,7 @@ export class TemplateBasestatic async getBuildStatus(data: Pick<BuildInfo, 'templateId' | 'buildId'>,options?: GetBuildStatusOptions- ): Promise<GetBuildStatusResponse> {+ ): Promise<TemplateBuildStatusResponse> {const config = new ConnectionConfig(options)const client = new ApiClient(config)@@ -223,6 +293,61 @@ export class TemplateBasereturn checkAliasExists(client, { alias })}+ /**+ * Assign tag(s) to an existing template build.+ *+ * @param targetName Template name in 'name:tag' format (the source build to tag from)+ * @param tags Tag or tags to assign+ * @param options Authentication options+ * @returns Tag info with buildId and assigned tags+ *+ * @example+ * ```ts+ * // Assign a single tag+ * await Template.assignTags('my-template:v1.0', 'production')+ *+ * // Assign multiple tags+ * await Template.assignTags('my-template:v1.0', ['production', 'stable'])+ * ```+ */+ static async assignTags(+ targetName: string,+ tags: string | string[],+ options?: ConnectionOpts+ ): Promise<TemplateTagInfo> {+ const config = new ConnectionConfig(options)+ const client = new ApiClient(config)+ const normalizedTags = Array.isArray(tags) ? tags : [tags]+ return assignTags(client, { targetName, tags: normalizedTags })+ }++ /**+ * Remove tag(s) from a template.+ *+ * @param name Template name+ * @param tags Tag or tags to remove+ * @param options Authentication options+ *+ * @example+ * ```ts+ * // Remove a single tag+ * await Template.removeTags('my-template', 'production')+ *+ * // Remove multiple tags from a template+ * await Template.removeTags('my-template', ['production', 'staging'])+ * ```+ */+ static async removeTags(+ name: string,+ tags: string | string[],+ options?: ConnectionOpts+ ): Promise<void> {+ const config = new ConnectionConfig(options)+ const client = new ApiClient(config)+ const normalizedTags = Array.isArray(tags) ? tags : [tags]+ return removeTags(client, { name, tags: normalizedTags })+ }+fromDebianImage(variant: string = 'stable'): TemplateBuilder {return this.fromImage(`debian:${variant}`)}@@ -870,12 +995,15 @@ export class TemplateBase* Internal implementation of the template build process.** @param client API client for communicating with E2B backend+ * @param name Template name in 'name' or 'name:tag' format+ * @param tags Additional tags to assign to the build* @param options Build configuration options* @throws BuildError if the build fails*/private async build(client: ApiClient,- options: BuildOptions+ name: string,+ options: Omit<BuildOptions, 'alias'>): Promise<BuildInfo> {if (options.skipCache) {this.force = true@@ -886,12 +1014,17 @@ export class TemplateBasenew LogEntry(new Date(),'info',- `Requesting build for template: ${options.alias}`+ `Requesting build for template: ${name}${options.tags && options.tags.length > 0 ? ` with tags ${options.tags.join(', ')}` : ''}`))- const { templateID, buildID } = await requestBuild(client, {- alias: options.alias,+ const {+ templateID,+ buildID,+ tags: responseTags,+ } = await requestBuild(client, {+ name,+ tags: options.tags,cpuCount: options.cpuCount ?? 2,memoryMB: options.memoryMB ?? 1024,})@@ -984,7 +1117,9 @@ export class TemplateBase})return {- alias: options.alias,+ alias: name,+ name: name,+ tags: responseTags,templateId: templateID,buildId: buildID,}@@ -1078,7 +1213,7 @@ export class TemplateBase* .copy('requirements.txt', '/app/')* .pipInstall()*- * await Template.build(template, { alias: 'my-python-app' })+ * await Template.build(template, 'my-python-app:v1.0')* ```*/export function Template(options?: TemplateOptions): TemplateFromImage {@@ -1089,6 +1224,8 @@ Template.build = TemplateBase.buildTemplate.buildInBackground = TemplateBase.buildInBackgroundTemplate.getBuildStatus = TemplateBase.getBuildStatusTemplate.aliasExists = TemplateBase.aliasExists+Template.assignTags = TemplateBase.assignTags+Template.removeTags = TemplateBase.removeTagsTemplate.toJSON = TemplateBase.toJSONTemplate.toDockerfile = TemplateBase.toDockerfile@@ -1096,9 +1233,13 @@ export type {AliasExistsOptions,BuildInfo,BuildOptions,+ BuildStatusReason,CopyItem,GetBuildStatusOptions,McpServerName,TemplateBuilder,+ TemplateBuildStatus,+ TemplateBuildStatusResponse,TemplateClass,+ TemplateTagInfo,} from './types'diff --git a/packages/js-sdk/src/template/types.ts b/packages/js-sdk/src/template/types.tsindex bfba96e49..5d0feabdf 100644--- a/packages/js-sdk/src/template/types.ts+++ b/packages/js-sdk/src/template/types.ts@@ -25,8 +25,13 @@ export type TemplateOptions = {export type BasicBuildOptions = {/*** Alias name for the template.+ * @deprecated Use the `name` parameter of `Template.build()` instead.*/alias: string+ /**+ * Tags to assign to the template build.+ */+ tags?: string[]/*** Number of CPUs allocated to the sandbox.* @default 2@@ -57,16 +62,102 @@ export type BuildOptions = ConnectionOpts & BasicBuildOptions* Information about a built template.*/export type BuildInfo = {+ /**+ * First alias from the build (for backward compatibility).+ * @deprecated Use `name` instead.+ */alias: string+ /**+ * Name of the template.+ */+ name: string+ /**+ * Tags assigned to this build.+ */+ tags: string[]+ /**+ * Template identifier.+ */templateId: string+ /**+ * Build identifier.+ */buildId: string}/**- * Response from getting build status.+ * Options for getting build status.*/export type GetBuildStatusOptions = ConnectionOpts & { logsOffset?: number }+/**+ * Status of a template build.+ */+export type TemplateBuildStatus = 'building' | 'waiting' | 'ready' | 'error'++/**+ * Reason for the current build status (typically for errors).+ */+export type BuildStatusReason = {+ /**+ * Message with the status reason.+ */+ message: string+ /**+ * Step that failed.+ */+ step?: string+ /**+ * Log entries related to the status reason.+ */+ logEntries: LogEntry[]+}++/**+ * Response from getting build status.+ */+export type TemplateBuildStatusResponse = {+ /**+ * Build identifier.+ */+ buildID: string+ /**+ * Template identifier.+ */+ templateID: string+ /**+ * Current status of the build.+ */+ status: TemplateBuildStatus+ /**+ * Build log entries.+ */+ logEntries: LogEntry[]+ /**+ * Build logs (raw strings).+ * @deprecated Use `logEntries` instead.+ */+ logs: string[]+ /**+ * Reason for the current status (typically for errors).+ */+ reason?: BuildStatusReason+}++/**+ * Information about assigned template tags.+ */+export type TemplateTagInfo = {+ /**+ * Build identifier associated with this tag.+ */+ buildId: string+ /**+ * Assigned tags of the template.+ */+ tags: string[]+}+/*** Options for checking if a template alias exists.*/diff --git a/packages/js-sdk/src/template/utils.ts b/packages/js-sdk/src/template/utils.tsindex 0a2c70624..34670767c 100644--- a/packages/js-sdk/src/template/utils.ts+++ b/packages/js-sdk/src/template/utils.ts@@ -2,8 +2,46 @@ import crypto from 'node:crypto'import fs from 'node:fs'import path from 'node:path'import { dynamicImport, dynamicRequire } from '../utils'+import { TemplateError } from '../errors'import { BASE_STEP_NAME, FINALIZE_STEP_NAME } from './consts'import type { Path } from 'glob'+import type { BuildOptions } from './types'++/**+ * Normalize build arguments from different overload signatures.+ * Handles string name or legacy options object with alias.+ *+ * @param nameOrOptions Name or legacy options with alias+ * @param options Optional build options (when first arg is name)+ * @returns Object with normalized name, tags, and build options+ * @throws TemplateError if no template name is provided+ */+export function normalizeBuildArguments(+ nameOrOptions: string | BuildOptions,+ options?: Omit<BuildOptions, 'alias'>+): {+ name: string+ buildOptions: Omit<BuildOptions, 'alias'>+} {+ let name: string+ let buildOptions: Omit<BuildOptions, 'alias'>++ if (typeof nameOrOptions === 'string') {+ name = nameOrOptions+ buildOptions = options ?? {}+ } else {+ // Legacy: options object with alias+ const { alias, ...restOpts } = nameOrOptions+ name = alias+ buildOptions = restOpts+ }++ if (!name || name.length === 0) {+ throw new TemplateError('Name must be provided')+ }++ return { name, buildOptions }+}/*** Read and parse a .dockerignore file.diff --git a/packages/js-sdk/tests/connectionConfig.test.ts b/packages/js-sdk/tests/connectionConfig.test.tsindex a5356e0b6..cfaafc77f 100644--- a/packages/js-sdk/tests/connectionConfig.test.ts+++ b/packages/js-sdk/tests/connectionConfig.test.ts@@ -7,6 +7,7 @@ let originalEnv: { [key: string]: string | undefined }beforeEach(() => {originalEnv = {E2B_API_URL: process.env.E2B_API_URL,+ E2B_DOMAIN: process.env.E2B_DOMAIN,E2B_DEBUG: process.env.E2B_DEBUG,}})@@ -25,6 +26,7 @@ afterEach(() => {test('api_url defaults correctly', () => {// Ensure no env vars interferedelete process.env.E2B_API_URL+ delete process.env.E2B_DOMAINdelete process.env.E2B_DEBUGconst config = new ConnectionConfig()diff --git a/packages/js-sdk/tests/setup.ts b/packages/js-sdk/tests/setup.tsindex 5d6766440..27b8f5dc3 100644--- a/packages/js-sdk/tests/setup.ts+++ b/packages/js-sdk/tests/setup.ts@@ -20,23 +20,47 @@ interface SandboxFixture {interface BuildTemplateFixture {buildTemplate: (template: TemplateClass,- options?: { alias?: string; skipCache?: boolean },+ options?: { name?: string; skipCache?: boolean },onBuildLogs?: (logEntry: LogEntry) => void) => Promise<BuildInfo>}-function buildTemplate(+async function buildTemplate(template: TemplateClass,- options?: { alias?: string; skipCache?: boolean },+ options?: { name?: string; skipCache?: boolean },onBuildLogs?: (logEntry: LogEntry) => void-) {- return Template.build(template, {- alias: options?.alias || `e2b-test-${randomUUID()}`,- cpuCount: 1,- memoryMB: 1024,- skipCache: options?.skipCache,- onBuildLogs: onBuildLogs,- })+): Promise<BuildInfo> {+ const buildName = options?.name || `e2b-test-${randomUUID()}`+ const buildInfo: { templateId?: string; buildId?: string } = {}++ const captureLogs = (log: LogEntry) => {+ if (log.message.includes('Template created with ID:')) {+ const match = log.message.match(+ /Template created with ID: ([^,]+), Build ID: (.+)/+ )+ if (match) {+ buildInfo.templateId = match[1]+ buildInfo.buildId = match[2]+ }+ }+ onBuildLogs?.(log)+ }++ try {+ return await Template.build(template, buildName, {+ cpuCount: 1,+ memoryMB: 1024,+ skipCache: options?.skipCache,+ onBuildLogs: captureLogs,+ })+ } catch (e) {+ console.error(+ `\n[BUILD FAILED] name=${buildName}, ` ++ `template_id=${buildInfo.templateId}, ` ++ `build_id=${buildInfo.buildId}, error=${e}`+ )+ throw e+ }}export const sandboxTest = base.extend<SandboxFixture>({@@ -97,4 +121,13 @@ export async function wait(ms: number) {return new Promise((resolve) => setTimeout(resolve, ms))}+/**+ * Returns the API URL for the given path, using E2B_DOMAIN env var.+ * Supports msw path parameters like :templateID+ */+export function apiUrl(path: string): string {+ const domain = process.env.E2B_DOMAIN || 'e2b.app'+ return `https://api.${domain}${path}`+}+export { template }diff --git a/packages/js-sdk/tests/template/backgroundBuild.test.ts b/packages/js-sdk/tests/template/backgroundBuild.test.tsindex 8684f04c3..cba2a28e5 100644--- a/packages/js-sdk/tests/template/backgroundBuild.test.ts+++ b/packages/js-sdk/tests/template/backgroundBuild.test.ts@@ -9,10 +9,9 @@ test('build template in background', async () => {.runCmd('sleep 5') // Add a delay to ensure build takes time.setStartCmd('echo "Hello"', waitForTimeout(10_000))- const alias = `e2b-test-${randomUUID()}`+ const name = `e2b-test-${randomUUID()}`- const buildInfo = await Template.buildInBackground(template, {- alias,+ const buildInfo = await Template.buildInBackground(template, name, {cpuCount: 1,memoryMB: 1024,})diff --git a/packages/js-sdk/tests/template/stacktrace.test.ts b/packages/js-sdk/tests/template/stacktrace.test.tsindex fc707bf68..7a401f980 100644--- a/packages/js-sdk/tests/template/stacktrace.test.ts+++ b/packages/js-sdk/tests/template/stacktrace.test.ts@@ -5,7 +5,7 @@ import { http, HttpResponse } from 'msw'import { setupServer } from 'msw/node'import { Template, waitForTimeout } from '../../src'-import { buildTemplateTest } from '../setup'+import { apiUrl, buildTemplateTest } from '../setup'import { randomUUID } from 'node:crypto'const __fileContent = fs.readFileSync(__filename, 'utf8') // read current file content@@ -39,21 +39,19 @@ const failureMap: Record<string, number | undefined> = {}export const restHandlers = [- http.post('https://api.e2b.app/v3/templates', async ({ request }) => {- const { alias } = (await request.clone().json()) as { alias: string }+ http.post(apiUrl('/v3/templates'), async ({ request }) => {+ const { name } = (await request.clone().json()) as { name: string }return HttpResponse.json({buildID: randomUUID(),- templateID: alias,+ templateID: name,+ tags: [],})}),- http.post(- 'https://api.e2b.app/v2/templates/:templateID/builds/:buildID',- () => {- return HttpResponse.json({})- }- ),+ http.post(apiUrl('/v2/templates/:templateID/builds/:buildID'), () => {+ return HttpResponse.json({})+ }),http.get<{ templateID: string; buildID: string }>(- 'https://api.e2b.app/templates/:templateID/builds/:buildID/status',+ apiUrl('/templates/:templateID/builds/:buildID/status'),({ params }) => {const { templateID } = paramsreturn HttpResponse.json({@@ -135,14 +133,14 @@ async function expectToThrowAndCheckTrace(buildTemplateTest('traces on fromImage', async ({ buildTemplate }) => {const template = Template().fromImage('e2b.dev/this-image-does-not-exist')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'fromImage', skipCache: true })+ await buildTemplate(template, { name: 'fromImage', skipCache: true })}, 'fromImage')})buildTemplateTest('traces on fromTemplate', async ({ buildTemplate }) => {const template = Template().fromTemplate('this-template-does-not-exist')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'fromTemplate', skipCache: true })+ await buildTemplate(template, { name: 'fromTemplate', skipCache: true })}, 'fromTemplate')})@@ -151,7 +149,7 @@ buildTemplateTest('traces on fromDockerfile', async ({ buildTemplate }) => {'FROM ubuntu:22.04\nRUN nonexistent')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'fromDockerfile', skipCache: true })+ await buildTemplate(template, { name: 'fromDockerfile', skipCache: true })}, 'fromDockerfile')})@@ -165,7 +163,7 @@ buildTemplateTest('traces on fromImage registry', async ({ buildTemplate }) => {)await expectToThrowAndCheckTrace(async () => {await buildTemplate(template, {- alias: 'fromImageRegistry',+ name: 'fromImageRegistry',})}, 'fromImage')})@@ -180,7 +178,7 @@ buildTemplateTest('traces on fromAWSRegistry', async ({ buildTemplate }) => {})await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'fromAWSRegistry' })+ await buildTemplate(template, { name: 'fromAWSRegistry' })}, 'fromAWSRegistry')})@@ -192,7 +190,7 @@ buildTemplateTest('traces on fromGCPRegistry', async ({ buildTemplate }) => {})await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'fromGCPRegistry' })+ await buildTemplate(template, { name: 'fromGCPRegistry' })}, 'fromGCPRegistry')})@@ -200,7 +198,7 @@ buildTemplateTest('traces on copy', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().copy(nonExistentPath, nonExistentPath)await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'copy' })+ await buildTemplate(template, { name: 'copy' })}, 'copy')})@@ -210,7 +208,7 @@ buildTemplateTest('traces on copyItems', async ({ buildTemplate }) => {.skipCache().copyItems([{ src: nonExistentPath, dest: nonExistentPath }])await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'copyItems' })+ await buildTemplate(template, { name: 'copyItems' })}, 'copyItems')})@@ -218,7 +216,7 @@ buildTemplateTest('traces on remove', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().remove(nonExistentPath)await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'remove' })+ await buildTemplate(template, { name: 'remove' })}, 'remove')})@@ -226,7 +224,7 @@ buildTemplateTest('traces on rename', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().rename(nonExistentPath, '/tmp/dest.txt')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'rename' })+ await buildTemplate(template, { name: 'rename' })}, 'rename')})@@ -234,7 +232,7 @@ buildTemplateTest('traces on makeDir', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().makeDir('.bashrc')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'makeDir' })+ await buildTemplate(template, { name: 'makeDir' })}, 'makeDir')})@@ -242,7 +240,7 @@ buildTemplateTest('traces on makeSymlink', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().makeSymlink('.bashrc', '.bashrc')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'makeSymlink' })+ await buildTemplate(template, { name: 'makeSymlink' })}, 'makeSymlink')})@@ -250,7 +248,7 @@ buildTemplateTest('traces on runCmd', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().runCmd(`./${nonExistentPath}`)await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'runCmd' })+ await buildTemplate(template, { name: 'runCmd' })}, 'runCmd')})@@ -258,7 +256,7 @@ buildTemplateTest('traces on setWorkdir', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().setWorkdir('/root/.bashrc')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'setWorkdir' })+ await buildTemplate(template, { name: 'setWorkdir' })}, 'setWorkdir')})@@ -266,7 +264,7 @@ buildTemplateTest('traces on setUser', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().setUser('; exit 1')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'setUser' })+ await buildTemplate(template, { name: 'setUser' })}, 'setUser')})@@ -274,7 +272,7 @@ buildTemplateTest('traces on pipInstall', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().pipInstall('nonexistent-package')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'pipInstall' })+ await buildTemplate(template, { name: 'pipInstall' })}, 'pipInstall')})@@ -282,7 +280,7 @@ buildTemplateTest('traces on npmInstall', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().npmInstall('nonexistent-package')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'npmInstall' })+ await buildTemplate(template, { name: 'npmInstall' })}, 'npmInstall')})@@ -290,7 +288,7 @@ buildTemplateTest('traces on aptInstall', async ({ buildTemplate }) => {let template = Template().fromBaseImage()template = template.skipCache().aptInstall('nonexistent-package')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'aptInstall' })+ await buildTemplate(template, { name: 'aptInstall' })}, 'aptInstall')})@@ -300,7 +298,7 @@ buildTemplateTest('traces on gitClone', async ({ buildTemplate }) => {.skipCache().gitClone('https://github.com/nonexistent/repo.git')await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'gitClone' })+ await buildTemplate(template, { name: 'gitClone' })}, 'gitClone')})@@ -311,7 +309,7 @@ buildTemplateTest('traces on setStartCmd', async ({ buildTemplate }) => {waitForTimeout(10_000))await expectToThrowAndCheckTrace(async () => {- await buildTemplate(template, { alias: 'setStartCmd' })+ await buildTemplate(template, { name: 'setStartCmd' })}, 'setStartCmd')})@@ -331,7 +329,7 @@ buildTemplateTest(.betaDevContainerPrebuild(nonExistentPath)await expectToThrowAndCheckTrace(async () => {await buildTemplate(template, {- alias: 'betaDevContainerPrebuild',+ name: 'betaDevContainerPrebuild',})}, 'betaDevContainerPrebuild')}@@ -345,7 +343,7 @@ buildTemplateTest(.betaSetDevContainerStart(nonExistentPath)await expectToThrowAndCheckTrace(async () => {await buildTemplate(template, {- alias: 'betaSetDevContainerStart',+ name: 'betaSetDevContainerStart',})}, 'betaSetDevContainerStart')}diff --git a/packages/js-sdk/tests/template/tags.test.ts b/packages/js-sdk/tests/template/tags.test.tsnew file mode 100644index 000000000..04767457b--- /dev/null+++ b/packages/js-sdk/tests/template/tags.test.ts@@ -0,0 +1,163 @@+import { randomUUID } from 'node:crypto'+import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'++import { http, HttpResponse } from 'msw'+import { setupServer } from 'msw/node'++import { Template } from '../../src'+import { apiUrl, buildTemplateTest, isDebug } from '../setup'++// Mock handlers for tag API endpoints+const mockHandlers = [+ http.post(apiUrl('/templates/tags'), async ({ request }) => {+ const { tags } = (await request.clone().json()) as {+ tags: string[]+ }+ return HttpResponse.json({+ buildID: '00000000-0000-0000-0000-000000000000',+ tags: tags,+ })+ }),+ // Bulk delete endpoint+ http.delete(apiUrl('/templates/tags'), async ({ request }) => {+ const { name } = (await request.clone().json()) as {+ name: string+ tags: string[]+ }+ if (name === 'nonexistent') {+ return HttpResponse.json(+ { message: 'Template not found' },+ { status: 404 }+ )+ }+ return new HttpResponse(null, { status: 204 })+ }),+]++const server = setupServer(...mockHandlers)++// Unit tests with mock server+describe('Template tags unit tests', () => {+ beforeAll(() => server.listen({ onUnhandledRequest: 'error' }))+ afterAll(() => server.close())+ afterEach(() => server.resetHandlers())++ describe('Template.assignTags', () => {+ test('assigns a single tag', async () => {+ const result = await Template.assignTags('my-template:v1.0', 'production')+ expect(result.buildId).toBe('00000000-0000-0000-0000-000000000000')+ expect(result.tags).toContain('production')+ })++ test('assigns multiple tags', async () => {+ const result = await Template.assignTags('my-template:v1.0', [+ 'production',+ 'stable',+ ])+ expect(result.buildId).toBe('00000000-0000-0000-0000-000000000000')+ expect(result.tags).toContain('production')+ expect(result.tags).toContain('stable')+ })+ })++ describe('Template.removeTags', () => {+ test('deletes a single tag', async () => {+ // Should not throw+ await expect(+ Template.removeTags('my-template', 'production')+ ).resolves.toBeUndefined()+ })++ test('deletes multiple tags', async () => {+ // Should not throw+ await expect(+ Template.removeTags('my-template', ['production', 'staging'])+ ).resolves.toBeUndefined()+ })++ test('handles 404 error for nonexistent template', async () => {+ await expect(+ Template.removeTags('nonexistent', ['tag'])+ ).rejects.toThrow()+ })+ })+})++// Integration tests+buildTemplateTest.skipIf(isDebug)(+ 'build template with tags, assign and delete',+ async ({ buildTemplate }) => {+ const templateAlias = `e2b-js-tags-test-${randomUUID()}`+ const initialTag = `${templateAlias}:v1.0`++ // Build a template with initial tag+ const template = Template().fromBaseImage()+ const buildInfo = await buildTemplate(template, { name: initialTag })++ expect(buildInfo.buildId).toBeTruthy()+ expect(buildInfo.templateId).toBeTruthy()++ // Assign additional tags (just tag names, not full alias:tag format)+ const tagInfo = await Template.assignTags(initialTag, [+ 'production',+ 'latest',+ ])++ expect(tagInfo.buildId).toBeTruthy()+ expect(tagInfo.tags).toContain('production')+ expect(tagInfo.tags).toContain('latest')+ },+ { timeout: 300_000 }+)++buildTemplateTest.skipIf(isDebug)(+ 'assign single tag to existing template',+ async ({ buildTemplate }) => {+ const templateAlias = `e2b-js-single-tag-${randomUUID()}`+ const initialTag = `${templateAlias}:v1.0`++ const template = Template().fromBaseImage()+ await buildTemplate(template, { name: initialTag })++ // Assign single tag (just tag name, not full alias:tag format)+ const tagInfo = await Template.assignTags(initialTag, 'stable')++ expect(tagInfo.buildId).toBeTruthy()+ expect(tagInfo.tags).toContain('stable')+ },+ { timeout: 300_000 }+)++buildTemplateTest.skipIf(isDebug)(+ 'rejects invalid tag format - missing alias',+ async ({ buildTemplate }) => {+ const templateAlias = `e2b-js-invalid-tag-${randomUUID()}`+ const initialTag = `${templateAlias}:v1.0`++ const template = Template().fromBaseImage()+ await buildTemplate(template, { name: initialTag })++ // Tag without alias (starts with colon) should be rejected+ await expect(+ Template.assignTags(initialTag, ':invalid-tag')+ ).rejects.toThrow()+ },+ { timeout: 300_000 }+)++buildTemplateTest.skipIf(isDebug)(+ 'rejects invalid tag format - missing tag',+ async ({ buildTemplate }) => {+ const templateAlias = `e2b-js-invalid-tag2-${randomUUID()}`+ const initialTag = `${templateAlias}:v1.0`++ const template = Template().fromBaseImage()+ await buildTemplate(template, { name: initialTag })++ // Tag without tag portion (ends with colon) should be rejected+ await expect(+ Template.assignTags(initialTag, `${templateAlias}:`)+ ).rejects.toThrow()+ },+ { timeout: 300_000 }+)diff --git a/packages/js-sdk/tests/template/utils/normalizeBuildArguments.test.ts b/packages/js-sdk/tests/template/utils/normalizeBuildArguments.test.tsnew file mode 100644index 000000000..294ee45bc--- /dev/null+++ b/packages/js-sdk/tests/template/utils/normalizeBuildArguments.test.ts@@ -0,0 +1,39 @@+import { describe, expect, test } from 'vitest'+import { normalizeBuildArguments } from '../../../src/template/utils'+import { TemplateError } from '../../../src/errors'++describe('normalizeBuildArguments', () => {+ test('handles string name', () => {+ const result = normalizeBuildArguments('my-template:v1.0')+ expect(result.name).toBe('my-template:v1.0')+ })++ test('handles string name with options', () => {+ const result = normalizeBuildArguments('my-template:v1.0', { cpuCount: 4 })+ expect(result.name).toBe('my-template:v1.0')+ expect(result.buildOptions).toEqual({ cpuCount: 4 })+ })++ test('handles legacy options with alias', () => {+ const result = normalizeBuildArguments({ alias: 'my-template' })+ expect(result.name).toBe('my-template')+ })++ test('removes alias from build options', () => {+ const result = normalizeBuildArguments({+ alias: 'my-template',+ cpuCount: 4,+ })+ expect(result.name).toBe('my-template')+ expect(result.buildOptions).toEqual({ cpuCount: 4 })+ expect(result.buildOptions).not.toHaveProperty('alias')+ })++ test('throws for empty name', () => {+ expect(() => normalizeBuildArguments({ alias: '' })).toThrow(TemplateError)+ })++ test('throws for missing name', () => {+ expect(() => normalizeBuildArguments({} as any)).toThrow(TemplateError)+ })+})diff --git a/packages/python-sdk/Makefile b/packages/python-sdk/Makefileindex 0ab5db43d..271b0887a 100644--- a/packages/python-sdk/Makefile+++ b/packages/python-sdk/Makefile@@ -1,7 +1,7 @@ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)generate-api:- python $(ROOT_DIR)/spec/remove_extra_tags.py sandboxes templates+ python $(ROOT_DIR)/spec/remove_extra_tags.py sandboxes templates tagsopenapi-python-client generate --output-path $(ROOT_DIR)/packages/python-sdk/e2b/api/api --overwrite --path $(ROOT_DIR)/spec/openapi_generated.ymlrm -rf e2b/api/clientmv e2b/api/api/e2b_api_client e2b/api/client@@ -25,6 +25,7 @@ init:lint:ruff check .+ ruff format --check .format:ruff format .diff --git a/packages/python-sdk/e2b/__init__.py b/packages/python-sdk/e2b/__init__.pyindex 0890278b3..a95877c67 100644--- a/packages/python-sdk/e2b/__init__.py+++ b/packages/python-sdk/e2b/__init__.py@@ -94,7 +94,14 @@ from .template.readycmd import (wait_for_timeout,wait_for_url,)-from .template.types import BuildInfo, CopyItem+from .template.types import (+ BuildInfo,+ BuildStatusReason,+ CopyItem,+ TemplateBuildStatus,+ TemplateBuildStatusResponse,+ TemplateTagInfo,+)from .template_async.main import AsyncTemplatefrom .template_sync.main import Template@@ -156,6 +163,10 @@ __all__ = ["TemplateClass","CopyItem","BuildInfo",+ "BuildStatusReason",+ "TemplateBuildStatus",+ "TemplateBuildStatusResponse",+ "TemplateTagInfo","ReadyCmd","wait_for_file","wait_for_url",diff --git a/packages/python-sdk/e2b/api/client/api/tags/__init__.py b/packages/python-sdk/e2b/api/client/api/tags/__init__.pynew file mode 100644index 000000000..2d7c0b23d--- /dev/null+++ b/packages/python-sdk/e2b/api/client/api/tags/__init__.py@@ -0,0 +1 @@+"""Contains endpoint functions for accessing the API"""diff --git a/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py b/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.pynew file mode 100644index 000000000..16a764aa1--- /dev/null+++ b/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py@@ -0,0 +1,174 @@+from http import HTTPStatus+from typing import Any, Optional, Union, cast++import httpx++from ... import errors+from ...client import AuthenticatedClient, Client+from ...models.delete_template_tags_request import DeleteTemplateTagsRequest+from ...models.error import Error+from ...types import Response+++def _get_kwargs(+ *,+ body: DeleteTemplateTagsRequest,+) -> dict[str, Any]:+ headers: dict[str, Any] = {}++ _kwargs: dict[str, Any] = {+ "method": "delete",+ "url": "/templates/tags",+ }++ _kwargs["json"] = body.to_dict()++ headers["Content-Type"] = "application/json"++ _kwargs["headers"] = headers+ return _kwargs+++def _parse_response(+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response+) -> Optional[Union[Any, Error]]:+ if response.status_code == 204:+ response_204 = cast(Any, None)+ return response_204+ if response.status_code == 400:+ response_400 = Error.from_dict(response.json())++ return response_400+ if response.status_code == 401:+ response_401 = Error.from_dict(response.json())++ return response_401+ if response.status_code == 404:+ response_404 = Error.from_dict(response.json())++ return response_404+ if response.status_code == 500:+ response_500 = Error.from_dict(response.json())++ return response_500+ if client.raise_on_unexpected_status:+ raise errors.UnexpectedStatus(response.status_code, response.content)+ else:+ return None+++def _build_response(+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response+) -> Response[Union[Any, Error]]:+ return Response(+ status_code=HTTPStatus(response.status_code),+ content=response.content,+ headers=response.headers,+ parsed=_parse_response(client=client, response=response),+ )+++def sync_detailed(+ *,+ client: AuthenticatedClient,+ body: DeleteTemplateTagsRequest,+) -> Response[Union[Any, Error]]:+ """Delete multiple tags from templates++ Args:+ body (DeleteTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Response[Union[Any, Error]]+ """++ kwargs = _get_kwargs(+ body=body,+ )++ response = client.get_httpx_client().request(+ **kwargs,+ )++ return _build_response(client=client, response=response)+++def sync(+ *,+ client: AuthenticatedClient,+ body: DeleteTemplateTagsRequest,+) -> Optional[Union[Any, Error]]:+ """Delete multiple tags from templates++ Args:+ body (DeleteTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Union[Any, Error]+ """++ return sync_detailed(+ client=client,+ body=body,+ ).parsed+++async def asyncio_detailed(+ *,+ client: AuthenticatedClient,+ body: DeleteTemplateTagsRequest,+) -> Response[Union[Any, Error]]:+ """Delete multiple tags from templates++ Args:+ body (DeleteTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Response[Union[Any, Error]]+ """++ kwargs = _get_kwargs(+ body=body,+ )++ response = await client.get_async_httpx_client().request(**kwargs)++ return _build_response(client=client, response=response)+++async def asyncio(+ *,+ client: AuthenticatedClient,+ body: DeleteTemplateTagsRequest,+) -> Optional[Union[Any, Error]]:+ """Delete multiple tags from templates++ Args:+ body (DeleteTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Union[Any, Error]+ """++ return (+ await asyncio_detailed(+ client=client,+ body=body,+ )+ ).parseddiff --git a/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py b/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.pynew file mode 100644index 000000000..fbc0ab49e--- /dev/null+++ b/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py@@ -0,0 +1,176 @@+from http import HTTPStatus+from typing import Any, Optional, Union++import httpx++from ... import errors+from ...client import AuthenticatedClient, Client+from ...models.assign_template_tags_request import AssignTemplateTagsRequest+from ...models.assigned_template_tags import AssignedTemplateTags+from ...models.error import Error+from ...types import Response+++def _get_kwargs(+ *,+ body: AssignTemplateTagsRequest,+) -> dict[str, Any]:+ headers: dict[str, Any] = {}++ _kwargs: dict[str, Any] = {+ "method": "post",+ "url": "/templates/tags",+ }++ _kwargs["json"] = body.to_dict()++ headers["Content-Type"] = "application/json"++ _kwargs["headers"] = headers+ return _kwargs+++def _parse_response(+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response+) -> Optional[Union[AssignedTemplateTags, Error]]:+ if response.status_code == 201:+ response_201 = AssignedTemplateTags.from_dict(response.json())++ return response_201+ if response.status_code == 400:+ response_400 = Error.from_dict(response.json())++ return response_400+ if response.status_code == 401:+ response_401 = Error.from_dict(response.json())++ return response_401+ if response.status_code == 404:+ response_404 = Error.from_dict(response.json())++ return response_404+ if response.status_code == 500:+ response_500 = Error.from_dict(response.json())++ return response_500+ if client.raise_on_unexpected_status:+ raise errors.UnexpectedStatus(response.status_code, response.content)+ else:+ return None+++def _build_response(+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response+) -> Response[Union[AssignedTemplateTags, Error]]:+ return Response(+ status_code=HTTPStatus(response.status_code),+ content=response.content,+ headers=response.headers,+ parsed=_parse_response(client=client, response=response),+ )+++def sync_detailed(+ *,+ client: AuthenticatedClient,+ body: AssignTemplateTagsRequest,+) -> Response[Union[AssignedTemplateTags, Error]]:+ """Assign tag(s) to a template build++ Args:+ body (AssignTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Response[Union[AssignedTemplateTags, Error]]+ """++ kwargs = _get_kwargs(+ body=body,+ )++ response = client.get_httpx_client().request(+ **kwargs,+ )++ return _build_response(client=client, response=response)+++def sync(+ *,+ client: AuthenticatedClient,+ body: AssignTemplateTagsRequest,+) -> Optional[Union[AssignedTemplateTags, Error]]:+ """Assign tag(s) to a template build++ Args:+ body (AssignTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Union[AssignedTemplateTags, Error]+ """++ return sync_detailed(+ client=client,+ body=body,+ ).parsed+++async def asyncio_detailed(+ *,+ client: AuthenticatedClient,+ body: AssignTemplateTagsRequest,+) -> Response[Union[AssignedTemplateTags, Error]]:+ """Assign tag(s) to a template build++ Args:+ body (AssignTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Response[Union[AssignedTemplateTags, Error]]+ """++ kwargs = _get_kwargs(+ body=body,+ )++ response = await client.get_async_httpx_client().request(**kwargs)++ return _build_response(client=client, response=response)+++async def asyncio(+ *,+ client: AuthenticatedClient,+ body: AssignTemplateTagsRequest,+) -> Optional[Union[AssignedTemplateTags, Error]]:+ """Assign tag(s) to a template build++ Args:+ body (AssignTemplateTagsRequest):++ Raises:+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.+ httpx.TimeoutException: If the request takes longer than Client.timeout.++ Returns:+ Union[AssignedTemplateTags, Error]+ """++ return (+ await asyncio_detailed(+ client=client,+ body=body,+ )+ ).parseddiff --git a/packages/python-sdk/e2b/api/client/models/__init__.py b/packages/python-sdk/e2b/api/client/models/__init__.pyindex 68ca7c004..49391c3a3 100644--- a/packages/python-sdk/e2b/api/client/models/__init__.py+++ b/packages/python-sdk/e2b/api/client/models/__init__.py@@ -1,7 +1,8 @@"""Contains all the data models used in inputs/outputs"""from .admin_sandbox_kill_result import AdminSandboxKillResult-from .assign_template_tag_request import AssignTemplateTagRequest+from .assign_template_tags_request import AssignTemplateTagsRequest+from .assigned_template_tags import AssignedTemplateTagsfrom .aws_registry import AWSRegistryfrom .aws_registry_type import AWSRegistryTypefrom .build_log_entry import BuildLogEntry@@ -9,6 +10,7 @@ from .build_status_reason import BuildStatusReasonfrom .connect_sandbox import ConnectSandboxfrom .created_access_token import CreatedAccessTokenfrom .created_team_api_key import CreatedTeamAPIKey+from .delete_template_tags_request import DeleteTemplateTagsRequestfrom .disk_metrics import DiskMetricsfrom .error import Errorfrom .gcp_registry import GCPRegistry@@ -64,14 +66,14 @@ from .template_build_status import TemplateBuildStatusfrom .template_legacy import TemplateLegacyfrom .template_request_response_v3 import TemplateRequestResponseV3from .template_step import TemplateStep-from .template_tag import TemplateTagfrom .template_update_request import TemplateUpdateRequestfrom .template_with_builds import TemplateWithBuildsfrom .update_team_api_key import UpdateTeamAPIKey__all__ = ("AdminSandboxKillResult",- "AssignTemplateTagRequest",+ "AssignedTemplateTags",+ "AssignTemplateTagsRequest","AWSRegistry","AWSRegistryType","BuildLogEntry",@@ -79,6 +81,7 @@ __all__ = ("ConnectSandbox","CreatedAccessToken","CreatedTeamAPIKey",+ "DeleteTemplateTagsRequest","DiskMetrics","Error","GCPRegistry",@@ -132,7 +135,6 @@ __all__ = ("TemplateLegacy","TemplateRequestResponseV3","TemplateStep",- "TemplateTag","TemplateUpdateRequest","TemplateWithBuilds","UpdateTeamAPIKey",diff --git a/packages/python-sdk/e2b/api/client/models/assign_template_tag_request.py b/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.pysimilarity index 72%rename from packages/python-sdk/e2b/api/client/models/assign_template_tag_request.pyrename to packages/python-sdk/e2b/api/client/models/assign_template_tags_request.pyindex 10d6fee99..3fb10a069 100644--- a/packages/python-sdk/e2b/api/client/models/assign_template_tag_request.py+++ b/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py@@ -4,23 +4,23 @@ from typing import Any, TypeVar, castfrom attrs import define as _attrs_definefrom attrs import field as _attrs_field-T = TypeVar("T", bound="AssignTemplateTagRequest")+T = TypeVar("T", bound="AssignTemplateTagsRequest")@_attrs_define-class AssignTemplateTagRequest:+class AssignTemplateTagsRequest:"""Attributes:- names (list[str]): Names of the template- target (str): Target template name in 'alias:tag' format+ tags (list[str]): Tags to assign to the template+ target (str): Target template in "name:tag" format"""- names: list[str]+ tags: list[str]target: stradditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)def to_dict(self) -> dict[str, Any]:- names = self.names+ tags = self.tagstarget = self.target@@ -28,7 +28,7 @@ class AssignTemplateTagRequest:field_dict.update(self.additional_properties)field_dict.update({- "names": names,+ "tags": tags,"target": target,})@@ -38,17 +38,17 @@ class AssignTemplateTagRequest:@classmethoddef from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:d = dict(src_dict)- names = cast(list[str], d.pop("names"))+ tags = cast(list[str], d.pop("tags"))target = d.pop("target")- assign_template_tag_request = cls(- names=names,+ assign_template_tags_request = cls(+ tags=tags,target=target,)- assign_template_tag_request.additional_properties = d- return assign_template_tag_request+ assign_template_tags_request.additional_properties = d+ return assign_template_tags_request@propertydef additional_keys(self) -> list[str]:diff --git a/packages/python-sdk/e2b/api/client/models/template_tag.py b/packages/python-sdk/e2b/api/client/models/assigned_template_tags.pysimilarity index 84%rename from packages/python-sdk/e2b/api/client/models/template_tag.pyrename to packages/python-sdk/e2b/api/client/models/assigned_template_tags.pyindex 52072f77a..7f9ecaa7f 100644--- a/packages/python-sdk/e2b/api/client/models/template_tag.py+++ b/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py@@ -5,15 +5,15 @@ from uuid import UUIDfrom attrs import define as _attrs_definefrom attrs import field as _attrs_field-T = TypeVar("T", bound="TemplateTag")+T = TypeVar("T", bound="AssignedTemplateTags")@_attrs_define-class TemplateTag:+class AssignedTemplateTags:"""Attributes:- build_id (UUID): Identifier of the build associated with this tag- tags (list[str]): Tags of the template+ build_id (UUID): Identifier of the build associated with these tags+ tags (list[str]): Assigned tags of the template"""build_id: UUID@@ -43,13 +43,13 @@ class TemplateTag:tags = cast(list[str], d.pop("tags"))- template_tag = cls(+ assigned_template_tags = cls(build_id=build_id,tags=tags,)- template_tag.additional_properties = d- return template_tag+ assigned_template_tags.additional_properties = d+ return assigned_template_tags@propertydef additional_keys(self) -> list[str]:diff --git a/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py b/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.pynew file mode 100644index 000000000..2aa06ae9a--- /dev/null+++ b/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py@@ -0,0 +1,67 @@+from collections.abc import Mapping+from typing import Any, TypeVar, cast++from attrs import define as _attrs_define+from attrs import field as _attrs_field++T = TypeVar("T", bound="DeleteTemplateTagsRequest")+++@_attrs_define+class DeleteTemplateTagsRequest:+ """+ Attributes:+ name (str): Name of the template+ tags (list[str]): Tags to delete+ """++ name: str+ tags: list[str]+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)++ def to_dict(self) -> dict[str, Any]:+ name = self.name++ tags = self.tags++ field_dict: dict[str, Any] = {}+ field_dict.update(self.additional_properties)+ field_dict.update(+ {+ "name": name,+ "tags": tags,+ }+ )++ return field_dict++ @classmethod+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:+ d = dict(src_dict)+ name = d.pop("name")++ tags = cast(list[str], d.pop("tags"))++ delete_template_tags_request = cls(+ name=name,+ tags=tags,+ )++ delete_template_tags_request.additional_properties = d+ return delete_template_tags_request++ @property+ def additional_keys(self) -> list[str]:+ return list(self.additional_properties.keys())++ def __getitem__(self, key: str) -> Any:+ return self.additional_properties[key]++ def __setitem__(self, key: str, value: Any) -> None:+ self.additional_properties[key] = value++ def __delitem__(self, key: str) -> None:+ del self.additional_properties[key]++ def __contains__(self, key: str) -> bool:+ return key in self.additional_propertiesdiff --git a/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py b/packages/python-sdk/e2b/api/client/models/template_build_request_v3.pyindex 3c9106d39..dda90f01f 100644--- a/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py+++ b/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py@@ -13,17 +13,20 @@ T = TypeVar("T", bound="TemplateBuildRequestV3")class TemplateBuildRequestV3:"""Attributes:- alias (Union[Unset, str]): Alias of the template. Deprecated, use names instead.+ alias (Union[Unset, str]): Alias of the template. Deprecated, use name instead.cpu_count (Union[Unset, int]): CPU cores for the sandboxmemory_mb (Union[Unset, int]): Memory for the sandbox in MiB- names (Union[Unset, list[str]]): Names of the template+ name (Union[Unset, str]): Name of the template. Can include a tag with colon separator (e.g. "my-template" or+ "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array.+ tags (Union[Unset, list[str]]): Tags to assign to the template buildteam_id (Union[Unset, str]): Identifier of the team"""alias: Union[Unset, str] = UNSETcpu_count: Union[Unset, int] = UNSETmemory_mb: Union[Unset, int] = UNSET- names: Union[Unset, list[str]] = UNSET+ name: Union[Unset, str] = UNSET+ tags: Union[Unset, list[str]] = UNSETteam_id: Union[Unset, str] = UNSETadditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)@@ -34,9 +37,11 @@ class TemplateBuildRequestV3:memory_mb = self.memory_mb- names: Union[Unset, list[str]] = UNSET- if not isinstance(self.names, Unset):- names = self.names+ name = self.name++ tags: Union[Unset, list[str]] = UNSET+ if not isinstance(self.tags, Unset):+ tags = self.tagsteam_id = self.team_id@@ -49,8 +54,10 @@ class TemplateBuildRequestV3:field_dict["cpuCount"] = cpu_countif memory_mb is not UNSET:field_dict["memoryMB"] = memory_mb- if names is not UNSET:- field_dict["names"] = names+ if name is not UNSET:+ field_dict["name"] = name+ if tags is not UNSET:+ field_dict["tags"] = tagsif team_id is not UNSET:field_dict["teamID"] = team_id@@ -65,7 +72,9 @@ class TemplateBuildRequestV3:memory_mb = d.pop("memoryMB", UNSET)- names = cast(list[str], d.pop("names", UNSET))+ name = d.pop("name", UNSET)++ tags = cast(list[str], d.pop("tags", UNSET))team_id = d.pop("teamID", UNSET)@@ -73,7 +82,8 @@ class TemplateBuildRequestV3:alias=alias,cpu_count=cpu_count,memory_mb=memory_mb,- names=names,+ name=name,+ tags=tags,team_id=team_id,)diff --git a/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py b/packages/python-sdk/e2b/api/client/models/template_request_response_v3.pyindex efe0e8c4f..9921980c5 100644--- a/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py+++ b/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py@@ -13,13 +13,17 @@ class TemplateRequestResponseV3:Attributes:aliases (list[str]): Aliases of the templatebuild_id (str): Identifier of the last successful build for given template+ names (list[str]): Names of the templatepublic (bool): Whether the template is public or only accessible by the team+ tags (list[str]): Tags assigned to the template buildtemplate_id (str): Identifier of the template"""aliases: list[str]build_id: str+ names: list[str]public: bool+ tags: list[str]template_id: stradditional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)@@ -28,8 +32,12 @@ class TemplateRequestResponseV3:build_id = self.build_id+ names = self.names+public = self.public+ tags = self.tags+template_id = self.template_idfield_dict: dict[str, Any] = {}@@ -38,7 +46,9 @@ class TemplateRequestResponseV3:{"aliases": aliases,"buildID": build_id,+ "names": names,"public": public,+ "tags": tags,"templateID": template_id,})@@ -52,14 +62,20 @@ class TemplateRequestResponseV3:build_id = d.pop("buildID")+ names = cast(list[str], d.pop("names"))+public = d.pop("public")+ tags = cast(list[str], d.pop("tags"))+template_id = d.pop("templateID")template_request_response_v3 = cls(aliases=aliases,build_id=build_id,+ names=names,public=public,+ tags=tags,template_id=template_id,)diff --git a/packages/python-sdk/e2b/template/types.py b/packages/python-sdk/e2b/template/types.pyindex a1e840694..b1ed5c6d1 100644--- a/packages/python-sdk/e2b/template/types.py+++ b/packages/python-sdk/e2b/template/types.py@@ -1,10 +1,77 @@-from dataclasses import dataclass+from dataclasses import dataclass, fieldfrom enum import Enumfrom pathlib import Pathfrom typing import List, Literal, Optional, TypedDict, Unionfrom typing_extensions import NotRequired+from e2b.template.logger import LogEntry+++class TemplateBuildStatus(str, Enum):+ """+ Status of a template build.+ """++ BUILDING = "building"+ WAITING = "waiting"+ READY = "ready"+ ERROR = "error"+++@dataclass+class BuildStatusReason:+ """+ Reason for the current build status (typically for errors).+ """++ message: str+ """Message with the status reason."""++ step: Optional[str] = None+ """Step that failed."""++ log_entries: List[LogEntry] = field(default_factory=list)+ """Log entries related to the status reason."""+++@dataclass+class TemplateBuildStatusResponse:+ """+ Response from getting build status.+ """++ build_id: str+ """Build identifier."""++ template_id: str+ """Template identifier."""++ status: TemplateBuildStatus+ """Current status of the build."""++ log_entries: List[LogEntry]+ """Build log entries."""++ logs: List[str]+ """Build logs (raw strings). Deprecated: use log_entries instead."""++ reason: Optional[BuildStatusReason] = None+ """Reason for the current status (typically for errors)."""+++@dataclass+class TemplateTagInfo:+ """+ Information about assigned template tags.+ """++ build_id: str+ """Build identifier associated with this tag."""++ tags: List[str]+ """Assigned tags of the template."""+class InstructionType(str, Enum):"""@@ -100,6 +167,9 @@ class BuildInfo:Information about a built template."""- alias: strtemplate_id: strbuild_id: str+ name: str+ # Deprecated: use name instead+ alias: str+ tags: List[str] = field(default_factory=list)diff --git a/packages/python-sdk/e2b/template/utils.py b/packages/python-sdk/e2b/template/utils.pyindex 413c58a4f..09f87ac09 100644--- a/packages/python-sdk/e2b/template/utils.py+++ b/packages/python-sdk/e2b/template/utils.py@@ -10,9 +10,30 @@ import inspectfrom types import TracebackType, FrameTypefrom typing import List, Optional, Union+from e2b.exceptions import TemplateExceptionfrom e2b.template.consts import BASE_STEP_NAME, FINALIZE_STEP_NAME+def normalize_build_arguments(+ name: Optional[str] = None,+ alias: Optional[str] = None,+) -> str:+ """+ Normalize build arguments from different parameter signatures.+ Handles string name or legacy alias parameter.++ :param name: Template name in 'name' or 'name:tag' format+ :param alias: (Deprecated) Alias name for the template. Use name instead.+ :return: Normalized template name+ :raises TemplateException: If no template name is provided+ """+ if name and len(name) > 0:+ return name+ if alias and len(alias) > 0:+ return alias+ raise TemplateException("Name must be provided")++def read_dockerignore(context_path: str) -> List[str]:"""Read and parse a .dockerignore file.diff --git a/packages/python-sdk/e2b/template_async/build_api.py b/packages/python-sdk/e2b/template_async/build_api.pyindex 84d3672e5..b45937a84 100644--- a/packages/python-sdk/e2b/template_async/build_api.py+++ b/packages/python-sdk/e2b/template_async/build_api.py@@ -1,6 +1,6 @@import asynciofrom types import TracebackType-from typing import Callable, Literal, Optional, List, Union+from typing import Callable, Optional, List, Unionimport httpx@@ -12,27 +12,44 @@ from e2b.api.client.api.templates import (get_templates_template_id_builds_build_id_status,get_templates_aliases_alias,)+from e2b.api.client.api.tags import (+ post_templates_tags,+ delete_templates_tags,+)from e2b.api.client.client import AuthenticatedClientfrom e2b.api.client.models import (TemplateBuildRequestV3,TemplateBuildStartV2,TemplateBuildFileUpload,- TemplateBuild,Error,+ AssignTemplateTagsRequest,+ DeleteTemplateTagsRequest,)+from e2b.api.client.types import UNSET, Unsetfrom e2b.exceptions import BuildException, FileUploadException, TemplateExceptionfrom e2b.template.logger import LogEntry-from e2b.template.types import TemplateType+from e2b.template.types import (+ TemplateType,+ BuildStatusReason,+ TemplateBuildStatus,+ TemplateBuildStatusResponse,+ TemplateTagInfo,+)from e2b.template.utils import get_build_step_index, tar_file_streamasync def request_build(- client: AuthenticatedClient, name: str, cpu_count: int, memory_mb: int+ client: AuthenticatedClient,+ name: str,+ tags: Optional[List[str]],+ cpu_count: int,+ memory_mb: int,):res = await post_v3_templates.asyncio_detailed(client=client,body=TemplateBuildRequestV3(- alias=name,+ name=name,+ tags=tags if tags else UNSET,cpu_count=cpu_count,memory_mb=memory_mb,),@@ -125,9 +142,36 @@ async def trigger_build(raise handle_api_exception(res, BuildException)+def _map_log_entry(entry) -> LogEntry:+ """Map API log entry to LogEntry type."""+ return LogEntry(+ timestamp=entry.timestamp,+ level=entry.level.value,+ message=entry.message,+ )+++def _map_build_status_reason(reason) -> Optional[BuildStatusReason]:+ """Map API build status reason to custom BuildStatusReason type."""+ if reason is None or isinstance(reason, Unset):+ return None+ return BuildStatusReason(+ message=reason.message,+ step=reason.step if not isinstance(reason.step, Unset) else None,+ log_entries=[+ _map_log_entry(e)+ for e in (+ reason.log_entries+ if not isinstance(reason.log_entries, Unset) and reason.log_entries+ else []+ )+ ],+ )++async def get_build_status(client: AuthenticatedClient, template_id: str, build_id: str, logs_offset: int-) -> TemplateBuild:+) -> TemplateBuildStatusResponse:res = await get_templates_template_id_builds_build_id_status.asyncio_detailed(template_id=template_id,build_id=build_id,@@ -144,7 +188,14 @@ async def get_build_status(if res.parsed is None:raise BuildException("Failed to get build status")- return res.parsed+ return TemplateBuildStatusResponse(+ build_id=res.parsed.build_id,+ template_id=res.parsed.template_id,+ status=TemplateBuildStatus(res.parsed.status.value),+ log_entries=[_map_log_entry(e) for e in res.parsed.log_entries],+ logs=res.parsed.logs,+ reason=_map_build_status_reason(res.parsed.reason),+ )async def wait_for_build_finish(@@ -156,9 +207,9 @@ async def wait_for_build_finish(stack_traces: List[Union[TracebackType, None]] = [],):logs_offset = 0- status: Literal["building", "waiting", "ready", "error"] = "building"+ status = TemplateBuildStatus.BUILDING- while status in ["building", "waiting"]:+ while status in [TemplateBuildStatus.BUILDING, TemplateBuildStatus.WAITING]:build_status = await get_build_status(client, template_id, build_id, logs_offset)@@ -167,23 +218,17 @@ async def wait_for_build_finish(for log_entry in build_status.log_entries:if on_build_logs:- on_build_logs(- LogEntry(- timestamp=log_entry.timestamp,- level=log_entry.level.value,- message=log_entry.message,- )- )+ on_build_logs(log_entry)- status = build_status.status.value+ status = build_status.status- if status == "ready":+ if status == TemplateBuildStatus.READY:return- elif status == "waiting":+ elif status == TemplateBuildStatus.WAITING:pass- elif status == "error":+ elif status == TemplateBuildStatus.ERROR:traceback = Noneif build_status.reason and build_status.reason.step:# Find the corresponding stack trace for the failed step@@ -233,3 +278,61 @@ async def check_alias_exists(client: AuthenticatedClient, alias: str) -> bool:# If we get Ok with data, you are owner and the alias existsreturn res.parsed is not None+++async def assign_tags(+ client: AuthenticatedClient, target_name: str, tags: List[str]+) -> TemplateTagInfo:+ """+ Assign tag(s) to an existing template build.++ Args:+ client: Authenticated API client+ target_name: Template name in 'name:tag' format (the source build to tag from)+ tags: Tags to assign++ Returns:+ TemplateTagInfo with build_id and assigned tags+ """+ res = await post_templates_tags.asyncio_detailed(+ client=client,+ body=AssignTemplateTagsRequest(+ target=target_name,+ tags=tags,+ ),+ )++ if res.status_code >= 300:+ raise handle_api_exception(res, TemplateException)++ if isinstance(res.parsed, Error):+ raise TemplateException(f"API error: {res.parsed.message}")++ if res.parsed is None:+ raise TemplateException("Failed to assign tags")++ return TemplateTagInfo(+ build_id=str(res.parsed.build_id),+ tags=res.parsed.tags,+ )+++async def remove_tags(client: AuthenticatedClient, name: str, tags: List[str]) -> None:+ """+ Remove tag(s) from a template.++ Args:+ client: Authenticated API client+ name: Template name+ tags: List of tags to remove+ """+ res = await delete_templates_tags.asyncio_detailed(+ client=client,+ body=DeleteTemplateTagsRequest(+ name=name,+ tags=tags,+ ),+ )++ if res.status_code >= 300:+ raise handle_api_exception(res, TemplateException)diff --git a/packages/python-sdk/e2b/template_async/main.py b/packages/python-sdk/e2b/template_async/main.pyindex e561c2b9e..8a1746b4d 100644--- a/packages/python-sdk/e2b/template_async/main.py+++ b/packages/python-sdk/e2b/template_async/main.py@@ -1,5 +1,5 @@from datetime import datetime-from typing import Callable, Optional+from typing import Callable, List, Optional, Unionfrom typing_extensions import Unpack@@ -8,11 +8,13 @@ from e2b.connection_config import ApiParams, ConnectionConfigfrom e2b.template.consts import RESOLVE_SYMLINKSfrom e2b.template.logger import LogEntry, LogEntryEnd, LogEntryStartfrom e2b.template.main import TemplateBase, TemplateClass-from e2b.template.types import BuildInfo, InstructionType-from e2b.template.utils import read_dockerignore+from e2b.template.types import BuildInfo, InstructionType, TemplateTagInfo+from e2b.template.utils import normalize_build_arguments, read_dockerignorefrom .build_api import (+ assign_tags,check_alias_exists,+ remove_tags,get_build_status,get_file_upload_link,request_build,@@ -30,9 +32,10 @@ class AsyncTemplate(TemplateBase):@staticmethodasync def _build(- template: TemplateClass,api_client: AuthenticatedClient,- alias: str,+ template: TemplateClass,+ name: str,+ tags: Optional[List[str]] = None,cpu_count: int = 2,memory_mb: int = 1024,skip_cache: bool = False,@@ -41,9 +44,10 @@ class AsyncTemplate(TemplateBase):"""Internal implementation of the template build process- :param template: The template to build:param api_client: Authenticated API client- :param alias: Alias name for the template+ :param template: The template to build+ :param name: Name for the template+ :param tags: Optional tags for the template:param cpu_count: Number of CPUs allocated to the sandbox:param memory_mb: Amount of memory in MB allocated to the sandbox:param skip_cache: If True, forces a complete rebuild ignoring cache@@ -54,23 +58,26 @@ class AsyncTemplate(TemplateBase):# Create templateif on_build_logs:+ tags_msg = f" with tags: {', '.join(tags)}" if tags else ""on_build_logs(LogEntry(timestamp=datetime.now(),level="info",- message=f"Requesting build for template: {alias}",+ message=f"Requesting build for template: {name}{tags_msg}",))response = await request_build(api_client,- name=alias,+ name=name,cpu_count=cpu_count,memory_mb=memory_mb,+ tags=tags,)template_id = response.template_idbuild_id = response.build_id+ response_tags = response.tagsif on_build_logs:on_build_logs(@@ -165,15 +172,20 @@ class AsyncTemplate(TemplateBase):)return BuildInfo(- alias=alias,template_id=template_id,build_id=build_id,+ alias=name,+ name=name,+ tags=response_tags,)@staticmethodasync def build(template: TemplateClass,- alias: str,+ name: Optional[str] = None,+ *,+ alias: Optional[str] = None,+ tags: Optional[List[str]] = None,cpu_count: int = 2,memory_mb: int = 1024,skip_cache: bool = False,@@ -184,7 +196,9 @@ class AsyncTemplate(TemplateBase):Build and deploy a template to E2B infrastructure.:param template: The template to build- :param alias: Alias name for the template+ :param name: Template name in 'name' or 'name:tag' format+ :param alias: (Deprecated) Alias name for the template. Use name instead.+ :param tags: Optional additional tags to assign to the template:param cpu_count: Number of CPUs allocated to the sandbox:param memory_mb: Amount of memory in MB allocated to the sandbox:param skip_cache: If True, forces a complete rebuild ignoring cache@@ -201,14 +215,15 @@ class AsyncTemplate(TemplateBase):.run_cmd('pip install -r /home/user/requirements.txt'))- await AsyncTemplate.build(- template,- alias='my-python-env',- cpu_count=2,- memory_mb=1024- )+ # Build with single tag+ await AsyncTemplate.build(template, 'my-python-env:v1.0')++ # Build with multiple tags+ await AsyncTemplate.build(template, 'my-python-env', tags=['v1.1.0', 'stable'])```"""+ name = normalize_build_arguments(name, alias)+try:if on_build_logs:on_build_logs(@@ -226,13 +241,14 @@ class AsyncTemplate(TemplateBase):)data = await AsyncTemplate._build(- template,api_client,- alias,- cpu_count,- memory_mb,- skip_cache,- on_build_logs,+ template,+ name,+ tags=tags,+ cpu_count=cpu_count,+ memory_mb=memory_mb,+ skip_cache=skip_cache,+ on_build_logs=on_build_logs,)if on_build_logs:@@ -266,7 +282,10 @@ class AsyncTemplate(TemplateBase):@staticmethodasync def build_in_background(template: TemplateClass,- alias: str,+ name: Optional[str] = None,+ *,+ alias: Optional[str] = None,+ tags: Optional[List[str]] = None,cpu_count: int = 2,memory_mb: int = 1024,skip_cache: bool = False,@@ -277,7 +296,9 @@ class AsyncTemplate(TemplateBase):Build and deploy a template to E2B infrastructure without waiting for completion.:param template: The template to build- :param alias: Alias name for the template+ :param name: Template name in 'name' or 'name:tag' format+ :param alias: (Deprecated) Alias name for the template. Use name instead.+ :param tags: Optional additional tags to assign to the template:param cpu_count: Number of CPUs allocated to the sandbox:param memory_mb: Amount of memory in MB allocated to the sandbox:param skip_cache: If True, forces a complete rebuild ignoring cache@@ -294,14 +315,15 @@ class AsyncTemplate(TemplateBase):.set_start_cmd('echo "Hello"', 'sleep 1'))- build_info = await AsyncTemplate.build_in_background(- template,- alias='my-python-env',- cpu_count=2,- memory_mb=1024- )+ # Build with single tag+ build_info = await AsyncTemplate.build_in_background(template, 'my-python-env:v1.0')++ # Build with multiple tags+ build_info = await AsyncTemplate.build_in_background(template, 'my-python-env', tags=['v1.1.0', 'stable'])```"""+ name = normalize_build_arguments(name, alias)+config = ConnectionConfig(**opts)api_client = get_api_client(config,@@ -310,13 +332,14 @@ class AsyncTemplate(TemplateBase):)return await AsyncTemplate._build(- template,api_client,- alias,- cpu_count,- memory_mb,- skip_cache,- on_build_logs,+ template,+ name,+ tags=tags,+ cpu_count=cpu_count,+ memory_mb=memory_mb,+ skip_cache=skip_cache,+ on_build_logs=on_build_logs,)@staticmethod@@ -381,3 +404,70 @@ class AsyncTemplate(TemplateBase):)return await check_alias_exists(api_client, alias)++ @staticmethod+ async def assign_tags(+ target_name: str,+ tags: Union[str, List[str]],+ **opts: Unpack[ApiParams],+ ) -> TemplateTagInfo:+ """+ Assign tag(s) to an existing template build.++ :param target_name: Template name in 'name:tag' format (the source build to tag from)+ :param tags: Tag or tags to assign+ :return: TemplateTagInfo with build_id and assigned tags++ Example+ ```python+ from e2b import AsyncTemplate++ # Assign a single tag+ result = await AsyncTemplate.assign_tags('my-template:v1.0', 'production')++ # Assign multiple tags+ result = await AsyncTemplate.assign_tags('my-template:v1.0', ['production', 'stable'])+ ```+ """+ config = ConnectionConfig(**opts)+ api_client = get_api_client(+ config,+ require_api_key=True,+ require_access_token=False,+ )++ normalized_tags = [tags] if isinstance(tags, str) else tags+ return await assign_tags(api_client, target_name, normalized_tags)++ @staticmethod+ async def remove_tags(+ name: str,+ tags: Union[str, List[str]],+ **opts: Unpack[ApiParams],+ ) -> None:+ """+ Remove tag(s) from a template.++ :param name: Template name+ :param tags: Tag or tags to remove++ Example+ ```python+ from e2b import AsyncTemplate++ # Remove a single tag+ await AsyncTemplate.remove_tags('my-template', 'production')++ # Remove multiple tags+ await AsyncTemplate.remove_tags('my-template', ['production', 'stable'])+ ```+ """+ config = ConnectionConfig(**opts)+ api_client = get_api_client(+ config,+ require_api_key=True,+ require_access_token=False,+ )++ normalized_tags = [tags] if isinstance(tags, str) else tags+ await remove_tags(api_client, name, normalized_tags)diff --git a/packages/python-sdk/e2b/template_sync/build_api.py b/packages/python-sdk/e2b/template_sync/build_api.pyindex 459243430..87e10e95d 100644--- a/packages/python-sdk/e2b/template_sync/build_api.py+++ b/packages/python-sdk/e2b/template_sync/build_api.py@@ -1,6 +1,6 @@import timefrom types import TracebackType-from typing import Callable, Literal, Optional, List, Union+from typing import Callable, Optional, List, Unionimport httpx@@ -12,27 +12,44 @@ from e2b.api.client.api.templates import (get_templates_template_id_builds_build_id_status,get_templates_aliases_alias,)+from e2b.api.client.api.tags import (+ post_templates_tags,+ delete_templates_tags,+)from e2b.api.client.client import AuthenticatedClientfrom e2b.api.client.models import (TemplateBuildRequestV3,TemplateBuildStartV2,TemplateBuildFileUpload,- TemplateBuild,Error,+ AssignTemplateTagsRequest,+ DeleteTemplateTagsRequest,)+from e2b.api.client.types import UNSET, Unsetfrom e2b.exceptions import BuildException, FileUploadException, TemplateExceptionfrom e2b.template.logger import LogEntry-from e2b.template.types import TemplateType+from e2b.template.types import (+ TemplateType,+ BuildStatusReason,+ TemplateBuildStatus,+ TemplateBuildStatusResponse,+ TemplateTagInfo,+)from e2b.template.utils import get_build_step_index, tar_file_streamdef request_build(- client: AuthenticatedClient, name: str, cpu_count: int, memory_mb: int+ client: AuthenticatedClient,+ name: str,+ tags: Optional[List[str]],+ cpu_count: int,+ memory_mb: int,):res = post_v3_templates.sync_detailed(client=client,body=TemplateBuildRequestV3(- alias=name,+ name=name,+ tags=tags if tags else UNSET,cpu_count=cpu_count,memory_mb=memory_mb,),@@ -124,9 +141,36 @@ def trigger_build(raise handle_api_exception(res, BuildException)+def _map_log_entry(entry) -> LogEntry:+ """Map API log entry to LogEntry type."""+ return LogEntry(+ timestamp=entry.timestamp,+ level=entry.level.value,+ message=entry.message,+ )+++def _map_build_status_reason(reason) -> Optional[BuildStatusReason]:+ """Map API build status reason to custom BuildStatusReason type."""+ if reason is None or isinstance(reason, Unset):+ return None+ return BuildStatusReason(+ message=reason.message,+ step=reason.step if not isinstance(reason.step, Unset) else None,+ log_entries=[+ _map_log_entry(e)+ for e in (+ reason.log_entries+ if not isinstance(reason.log_entries, Unset) and reason.log_entries+ else []+ )+ ],+ )++def get_build_status(client: AuthenticatedClient, template_id: str, build_id: str, logs_offset: int-) -> TemplateBuild:+) -> TemplateBuildStatusResponse:res = get_templates_template_id_builds_build_id_status.sync_detailed(template_id=template_id,build_id=build_id,@@ -143,7 +187,14 @@ def get_build_status(if res.parsed is None:raise BuildException("Failed to get build status")- return res.parsed+ return TemplateBuildStatusResponse(+ build_id=res.parsed.build_id,+ template_id=res.parsed.template_id,+ status=TemplateBuildStatus(res.parsed.status.value),+ log_entries=[_map_log_entry(e) for e in res.parsed.log_entries],+ logs=res.parsed.logs,+ reason=_map_build_status_reason(res.parsed.reason),+ )def wait_for_build_finish(@@ -155,32 +206,26 @@ def wait_for_build_finish(stack_traces: List[Union[TracebackType, None]] = [],):logs_offset = 0- status: Literal["building", "waiting", "ready", "error"] = "building"+ status = TemplateBuildStatus.BUILDING- while status in ["building", "waiting"]:+ while status in [TemplateBuildStatus.BUILDING, TemplateBuildStatus.WAITING]:build_status = get_build_status(client, template_id, build_id, logs_offset)logs_offset += len(build_status.log_entries)for log_entry in build_status.log_entries:if on_build_logs:- on_build_logs(- LogEntry(- timestamp=log_entry.timestamp,- level=log_entry.level.value,- message=log_entry.message,- )- )+ on_build_logs(log_entry)- status = build_status.status.value+ status = build_status.status- if status == "ready":+ if status == TemplateBuildStatus.READY:return- elif status == "waiting":+ elif status == TemplateBuildStatus.WAITING:pass- elif status == "error":+ elif status == TemplateBuildStatus.ERROR:traceback = Noneif build_status.reason and build_status.reason.step:# Find the corresponding stack trace for the failed step@@ -230,3 +275,61 @@ def check_alias_exists(client: AuthenticatedClient, alias: str) -> bool:# If we get Ok with data, you are owner and the alias existsreturn res.parsed is not None+++def assign_tags(+ client: AuthenticatedClient, target_name: str, tags: List[str]+) -> TemplateTagInfo:+ """+ Assign tag(s) to an existing template build.++ Args:+ client: Authenticated API client+ target_name: Template name in 'name:tag' format (the source build to tag from)+ tags: Tags to assign++ Returns:+ TemplateTagInfo with build_id and assigned tags+ """+ res = post_templates_tags.sync_detailed(+ client=client,+ body=AssignTemplateTagsRequest(+ target=target_name,+ tags=tags,+ ),+ )++ if res.status_code >= 300:+ raise handle_api_exception(res, TemplateException)++ if isinstance(res.parsed, Error):+ raise TemplateException(f"API error: {res.parsed.message}")++ if res.parsed is None:+ raise TemplateException("Failed to assign tags")++ return TemplateTagInfo(+ build_id=str(res.parsed.build_id),+ tags=res.parsed.tags,+ )+++def remove_tags(client: AuthenticatedClient, name: str, tags: List[str]) -> None:+ """+ Remove tag(s) from a template.++ Args:+ client: Authenticated API client+ name: Template name+ tags: List of tags to remove+ """+ res = delete_templates_tags.sync_detailed(+ client=client,+ body=DeleteTemplateTagsRequest(+ name=name,+ tags=tags,+ ),+ )++ if res.status_code >= 300:+ raise handle_api_exception(res, TemplateException)diff --git a/packages/python-sdk/e2b/template_sync/main.py b/packages/python-sdk/e2b/template_sync/main.pyindex b173b050c..10a6012f8 100644--- a/packages/python-sdk/e2b/template_sync/main.py+++ b/packages/python-sdk/e2b/template_sync/main.py@@ -1,5 +1,5 @@from datetime import datetime-from typing import Callable, Optional+from typing import Callable, List, Optional, Unionfrom typing_extensions import Unpack@@ -10,9 +10,11 @@ from e2b.api.client_sync import get_api_clientfrom e2b.template.consts import RESOLVE_SYMLINKSfrom e2b.template.logger import LogEntry, LogEntryEnd, LogEntryStartfrom e2b.template.main import TemplateBase, TemplateClass-from e2b.template.types import BuildInfo, InstructionType+from e2b.template.types import BuildInfo, InstructionType, TemplateTagInfofrom e2b.template_sync.build_api import (+ assign_tags,check_alias_exists,+ remove_tags,get_build_status,get_file_upload_link,request_build,@@ -20,7 +22,7 @@ from e2b.template_sync.build_api import (upload_file,wait_for_build_finish,)-from e2b.template.utils import read_dockerignore+from e2b.template.utils import normalize_build_arguments, read_dockerignoreclass Template(TemplateBase):@@ -30,9 +32,10 @@ class Template(TemplateBase):@staticmethoddef _build(- template: TemplateClass,api_client: AuthenticatedClient,- alias: str,+ template: TemplateClass,+ name: str,+ tags: Optional[List[str]] = None,cpu_count: int = 2,memory_mb: int = 1024,skip_cache: bool = False,@@ -41,9 +44,10 @@ class Template(TemplateBase):"""Internal implementation of the template build process- :param template: The template to build:param api_client: Authenticated API client- :param alias: Alias name for the template+ :param template: The template to build+ :param name: Name for the template+ :param tags: Optional tags for the template:param cpu_count: Number of CPUs allocated to the sandbox:param memory_mb: Amount of memory in MB allocated to the sandbox:param skip_cache: If True, forces a complete rebuild ignoring cache@@ -54,23 +58,26 @@ class Template(TemplateBase):# Create templateif on_build_logs:+ tags_msg = f" with tags: {', '.join(tags)}" if tags else ""on_build_logs(LogEntry(timestamp=datetime.now(),level="info",- message=f"Requesting build for template: {alias}",+ message=f"Requesting build for template: {name}{tags_msg}",))response = request_build(api_client,- name=alias,+ name=name,cpu_count=cpu_count,memory_mb=memory_mb,+ tags=tags,)template_id = response.template_idbuild_id = response.build_id+ response_tags = response.tagsif on_build_logs:on_build_logs(@@ -165,15 +172,20 @@ class Template(TemplateBase):)return BuildInfo(- alias=alias,template_id=template_id,build_id=build_id,+ alias=name,+ name=name,+ tags=response_tags,)@staticmethoddef build(template: TemplateClass,- alias: str,+ name: Optional[str] = None,+ *,+ alias: Optional[str] = None,+ tags: Optional[List[str]] = None,cpu_count: int = 2,memory_mb: int = 1024,skip_cache: bool = False,@@ -184,7 +196,9 @@ class Template(TemplateBase):Build and deploy a template to E2B infrastructure.:param template: The template to build- :param alias: Alias name for the template+ :param name: Template name in 'name' or 'name:tag' format+ :param alias: (Deprecated) Alias name for the template. Use name instead.+ :param tags: Optional additional tags to assign to the template:param cpu_count: Number of CPUs allocated to the sandbox:param memory_mb: Amount of memory in MB allocated to the sandbox:param skip_cache: If True, forces a complete rebuild ignoring cache@@ -201,14 +215,15 @@ class Template(TemplateBase):.run_cmd('pip install -r /home/user/requirements.txt'))- Template.build(- template,- alias='my-python-env',- cpu_count=2,- memory_mb=1024- )+ # Build with single tag+ Template.build(template, 'my-python-env:v1.0')++ # Build with multiple tags+ Template.build(template, 'my-python-env', tags=['v1.1.0', 'stable'])```"""+ name = normalize_build_arguments(name, alias)+try:if on_build_logs:on_build_logs(@@ -226,13 +241,14 @@ class Template(TemplateBase):)data = Template._build(- template,api_client,- alias,- cpu_count,- memory_mb,- skip_cache,- on_build_logs,+ template,+ name,+ tags=tags,+ cpu_count=cpu_count,+ memory_mb=memory_mb,+ skip_cache=skip_cache,+ on_build_logs=on_build_logs,)if on_build_logs:@@ -266,7 +282,10 @@ class Template(TemplateBase):@staticmethoddef build_in_background(template: TemplateClass,- alias: str,+ name: Optional[str] = None,+ *,+ alias: Optional[str] = None,+ tags: Optional[List[str]] = None,cpu_count: int = 2,memory_mb: int = 1024,skip_cache: bool = False,@@ -277,7 +296,9 @@ class Template(TemplateBase):Build and deploy a template to E2B infrastructure without waiting for completion.:param template: The template to build- :param alias: Alias name for the template+ :param name: Template name in 'name' or 'name:tag' format+ :param alias: (Deprecated) Alias name for the template. Use name instead.+ :param tags: Optional additional tags to assign to the template:param cpu_count: Number of CPUs allocated to the sandbox:param memory_mb: Amount of memory in MB allocated to the sandbox:param skip_cache: If True, forces a complete rebuild ignoring cache@@ -294,14 +315,15 @@ class Template(TemplateBase):.set_start_cmd('echo "Hello"', 'sleep 1'))- build_info = Template.build_in_background(- template,- alias='my-python-env',- cpu_count=2,- memory_mb=1024- )+ # Build with single tag+ build_info = Template.build_in_background(template, 'my-python-env:v1.0')++ # Build with multiple tags+ build_info = Template.build_in_background(template, 'my-python-env', tags=['v1.1.0', 'stable'])```"""+ name = normalize_build_arguments(name, alias)+config = ConnectionConfig(**opts)api_client = get_api_client(config,@@ -310,13 +332,14 @@ class Template(TemplateBase):)return Template._build(- template,api_client,- alias,- cpu_count,- memory_mb,- skip_cache,- on_build_logs,+ template,+ name,+ tags=tags,+ cpu_count=cpu_count,+ memory_mb=memory_mb,+ skip_cache=skip_cache,+ on_build_logs=on_build_logs,)@staticmethod@@ -382,3 +405,70 @@ class Template(TemplateBase):)return check_alias_exists(api_client, alias)++ @staticmethod+ def assign_tags(+ target_name: str,+ tags: Union[str, List[str]],+ **opts: Unpack[ApiParams],+ ) -> TemplateTagInfo:+ """+ Assign tag(s) to an existing template build.++ :param target_name: Template name in 'name:tag' format (the source build to tag from)+ :param tags: Tag or tags to assign+ :return: TemplateTagInfo with build_id and assigned tags++ Example+ ```python+ from e2b import Template++ # Assign a single tag+ result = Template.assign_tags('my-template:v1.0', 'production')++ # Assign multiple tags+ result = Template.assign_tags('my-template:v1.0', ['production', 'stable'])+ ```+ """+ config = ConnectionConfig(**opts)+ api_client = get_api_client(+ config,+ require_api_key=True,+ require_access_token=False,+ )++ normalized_tags = [tags] if isinstance(tags, str) else tags+ return assign_tags(api_client, target_name, normalized_tags)++ @staticmethod+ def remove_tags(+ name: str,+ tags: Union[str, List[str]],+ **opts: Unpack[ApiParams],+ ) -> None:+ """+ Remove tag(s) from a template.++ :param name: Template name+ :param tags: Tag or tags to remove++ Example+ ```python+ from e2b import Template++ # Remove a single tag+ Template.remove_tags('my-template', 'production')++ # Remove multiple tags+ Template.remove_tags('my-template', ['production', 'stable'])+ ```+ """+ config = ConnectionConfig(**opts)+ api_client = get_api_client(+ config,+ require_api_key=True,+ require_access_token=False,+ )++ normalized_tags = [tags] if isinstance(tags, str) else tags+ remove_tags(api_client, name, normalized_tags)diff --git a/packages/python-sdk/tests/async/template_async/test_background_build.py b/packages/python-sdk/tests/async/template_async/test_background_build.pyindex 783a766b8..637232458 100644--- a/packages/python-sdk/tests/async/template_async/test_background_build.py+++ b/packages/python-sdk/tests/async/template_async/test_background_build.py@@ -17,11 +17,11 @@ async def test_build_in_background_should_start_build_and_return_info():.set_start_cmd('echo "Hello"', wait_for_timeout(10_000)))- alias = f"e2b-test-{uuid.uuid4()}"+ name = f"e2b-test-{uuid.uuid4()}"build_info = await AsyncTemplate.build_in_background(template,- alias=alias,+ name,cpu_count=1,memory_mb=1024,)diff --git a/packages/python-sdk/tests/async/template_async/test_stacktrace.py b/packages/python-sdk/tests/async/template_async/test_stacktrace.pyindex 7bff6ee22..08acc9206 100644--- a/packages/python-sdk/tests/async/template_async/test_stacktrace.py+++ b/packages/python-sdk/tests/async/template_async/test_stacktrace.py@@ -1,13 +1,13 @@import tracebackfrom types import SimpleNamespace-from typing import Optional+from typing import List, Optionalfrom uuid import uuid4import pytestimport linecachefrom e2b import AsyncTemplate, CopyItem, wait_for_timeout-from e2b.api.client.models import TemplateBuildStatus+from e2b.template.types import TemplateBuildStatusimport e2b.template_async.main as template_async_mainimport e2b.template_async.build_api as build_api_mod@@ -43,8 +43,10 @@ failure_map: dict[str, Optional[int]] = {@pytest.fixture(autouse=True)def mock_template_build(monkeypatch):- async def mock_request_build(client, name: str, cpu_count: int, memory_mb: int):- return SimpleNamespace(template_id=name, build_id=str(uuid4()))+ async def mock_request_build(+ client, name: str, tags: Optional[List[str]], cpu_count: int, memory_mb: int+ ):+ return SimpleNamespace(template_id=name, build_id=str(uuid4()), tags=tags or [])async def mock_trigger_build(client, template_id: str, build_id: str, template):return None@@ -94,7 +96,7 @@ async def _expect_to_throw_and_check_trace(func, expected_method: str):async def test_traces_on_from_image(async_build):template = AsyncTemplate().from_image("e2b.dev/this-image-does-not-exist")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="from_image", skip_cache=True), "from_image"+ lambda: async_build(template, name="from_image", skip_cache=True), "from_image")@@ -102,7 +104,7 @@ async def test_traces_on_from_image(async_build):async def test_traces_on_from_template(async_build):template = AsyncTemplate().from_template("this-template-does-not-exist")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="from_template", skip_cache=True),+ lambda: async_build(template, name="from_template", skip_cache=True),"from_template",)@@ -111,7 +113,7 @@ async def test_traces_on_from_template(async_build):async def test_traces_on_from_dockerfile(async_build):template = AsyncTemplate().from_dockerfile("FROM ubuntu:22.04\nRUN nonexistent")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="from_dockerfile", skip_cache=True),+ lambda: async_build(template, name="from_dockerfile", skip_cache=True),"from_dockerfile",)@@ -124,7 +126,7 @@ async def test_traces_on_from_image_registry(async_build):password="test",)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="from_image_registry", skip_cache=True),+ lambda: async_build(template, name="from_image_registry", skip_cache=True),"from_image",)@@ -138,7 +140,7 @@ async def test_traces_on_from_aws_registry(async_build):region="us-east-1",)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="from_aws_registry"), "from_aws_registry"+ lambda: async_build(template, name="from_aws_registry"), "from_aws_registry")@@ -151,7 +153,7 @@ async def test_traces_on_from_gcp_registry(async_build):},)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="from_gcp_registry"), "from_gcp_registry"+ lambda: async_build(template, name="from_gcp_registry"), "from_gcp_registry")@@ -161,7 +163,7 @@ async def test_traces_on_copy(async_build):template = template.from_base_image()template = template.skip_cache().copy(non_existent_path, non_existent_path)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="copy"), "copy"+ lambda: async_build(template, name="copy"), "copy")@@ -173,7 +175,7 @@ async def test_traces_on_copyItems(async_build):[CopyItem(src=non_existent_path, dest=non_existent_path)])await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="copy_items"), "copy_items"+ lambda: async_build(template, name="copy_items"), "copy_items")@@ -183,7 +185,7 @@ async def test_traces_on_remove(async_build):template = template.from_base_image()template = template.skip_cache().remove(non_existent_path)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="remove"), "remove"+ lambda: async_build(template, name="remove"), "remove")@@ -193,7 +195,7 @@ async def test_traces_on_rename(async_build):template = template.from_base_image()template = template.skip_cache().rename(non_existent_path, "/tmp/dest.txt")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="rename"), "rename"+ lambda: async_build(template, name="rename"), "rename")@@ -203,7 +205,7 @@ async def test_traces_on_make_dir(async_build):template = template.from_base_image()template = template.set_user("root").skip_cache().make_dir("/root/.bashrc")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="make_dir"), "make_dir"+ lambda: async_build(template, name="make_dir"), "make_dir")@@ -213,7 +215,7 @@ async def test_traces_on_make_symlink(async_build):template = template.from_base_image()template = template.skip_cache().make_symlink(".bashrc", ".bashrc")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="make_symlink"), "make_symlink"+ lambda: async_build(template, name="make_symlink"), "make_symlink")@@ -223,7 +225,7 @@ async def test_traces_on_run_cmd(async_build):template = template.from_base_image()template = template.skip_cache().run_cmd(f"cat {non_existent_path}")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="run_cmd"), "run_cmd"+ lambda: async_build(template, name="run_cmd"), "run_cmd")@@ -233,7 +235,7 @@ async def test_traces_on_set_workdir(async_build):template = template.from_base_image()template = template.set_user("root").skip_cache().set_workdir("/root/.bashrc")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="set_workdir"), "set_workdir"+ lambda: async_build(template, name="set_workdir"), "set_workdir")@@ -243,7 +245,7 @@ async def test_traces_on_set_user(async_build):template = template.from_base_image()template = template.skip_cache().set_user("; exit 1")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="set_user"), "set_user"+ lambda: async_build(template, name="set_user"), "set_user")@@ -253,7 +255,7 @@ async def test_traces_on_pip_install(async_build):template = template.from_base_image()template = template.skip_cache().pip_install("nonexistent-package")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="pip_install"), "pip_install"+ lambda: async_build(template, name="pip_install"), "pip_install")@@ -263,7 +265,7 @@ async def test_traces_on_npm_install(async_build):template = template.from_base_image()template = template.skip_cache().npm_install("nonexistent-package")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="npm_install"), "npm_install"+ lambda: async_build(template, name="npm_install"), "npm_install")@@ -273,7 +275,7 @@ async def test_traces_on_apt_install(async_build):template = template.from_base_image()template = template.skip_cache().apt_install("nonexistent-package")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="apt_install"), "apt_install"+ lambda: async_build(template, name="apt_install"), "apt_install")@@ -283,7 +285,7 @@ async def test_traces_on_git_clone(async_build):template = template.from_base_image()template = template.skip_cache().git_clone("https://github.com/repo.git")await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="git_clone"), "git_clone"+ lambda: async_build(template, name="git_clone"), "git_clone")@@ -295,7 +297,7 @@ async def test_traces_on_start_cmd(async_build):f"./{non_existent_path}", wait_for_timeout(10_000))await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="set_start_cmd"), "set_start_cmd"+ lambda: async_build(template, name="set_start_cmd"), "set_start_cmd")@@ -314,7 +316,7 @@ async def test_traces_on_dev_container_prebuild(async_build):template = template.from_template("devcontainer")template = template.skip_cache().beta_dev_container_prebuild(non_existent_path)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="beta_dev_container_prebuild"),+ lambda: async_build(template, name="beta_dev_container_prebuild"),"beta_dev_container_prebuild",)@@ -325,6 +327,6 @@ async def test_traces_on_set_dev_container_start(async_build):template = template.from_template("devcontainer")template = template.beta_set_dev_container_start(non_existent_path)await _expect_to_throw_and_check_trace(- lambda: async_build(template, alias="beta_set_dev_container_start"),+ lambda: async_build(template, name="beta_set_dev_container_start"),"beta_set_dev_container_start",)diff --git a/packages/python-sdk/tests/async/template_async/test_tags.py b/packages/python-sdk/tests/async/template_async/test_tags.pynew file mode 100644index 000000000..c25ce4281--- /dev/null+++ b/packages/python-sdk/tests/async/template_async/test_tags.py@@ -0,0 +1,185 @@+import uuid+from unittest.mock import AsyncMock++import pytest++from e2b import AsyncTemplate, TemplateTagInfo, Template+from e2b.exceptions import TemplateException+import e2b.template_async.main as template_async_main+++class TestAssignTags:+ """Tests for AsyncTemplate.assign_tags method."""++ @pytest.mark.asyncio+ async def test_assign_single_tag(self, monkeypatch):+ """Test assigning a single tag to a template."""+ mock_assign_tags = AsyncMock(+ return_value=TemplateTagInfo(+ build_id="00000000-0000-0000-0000-000000000000",+ tags=["production"],+ )+ )++ monkeypatch.setattr(+ template_async_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_async_main, "assign_tags", mock_assign_tags)++ result = await AsyncTemplate.assign_tags("my-template:v1.0", "production")++ assert result.build_id == "00000000-0000-0000-0000-000000000000"+ assert "production" in result.tags+ mock_assign_tags.assert_called_once()+ _, target, tags = mock_assign_tags.call_args[0]+ assert target == "my-template:v1.0"+ assert tags == ["production"]++ @pytest.mark.asyncio+ async def test_assign_multiple_tags(self, monkeypatch):+ """Test assigning multiple tags to a template."""+ mock_assign_tags = AsyncMock(+ return_value=TemplateTagInfo(+ build_id="00000000-0000-0000-0000-000000000000",+ tags=["production", "stable"],+ )+ )++ monkeypatch.setattr(+ template_async_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_async_main, "assign_tags", mock_assign_tags)++ result = await AsyncTemplate.assign_tags(+ "my-template:v1.0", ["production", "stable"]+ )++ assert result.build_id == "00000000-0000-0000-0000-000000000000"+ assert "production" in result.tags+ assert "stable" in result.tags+ mock_assign_tags.assert_called_once()+ _, _, tags = mock_assign_tags.call_args[0]+ assert tags == ["production", "stable"]+++class TestRemoveTags:+ """Tests for AsyncTemplate.remove_tags method."""++ @pytest.mark.asyncio+ async def test_remove_single_tag(self, monkeypatch):+ """Test deleting a single tag from a template."""+ mock_remove_tags = AsyncMock(return_value=None)++ monkeypatch.setattr(+ template_async_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_async_main, "remove_tags", mock_remove_tags)++ await AsyncTemplate.remove_tags("my-template", "production")++ mock_remove_tags.assert_called_once()+ _, name, tags = mock_remove_tags.call_args[0]+ assert name == "my-template"+ assert tags == ["production"]++ @pytest.mark.asyncio+ async def test_remove_multiple_tags(self, monkeypatch):+ """Test deleting multiple tags from a template."""+ mock_remove_tags = AsyncMock(return_value=None)++ monkeypatch.setattr(+ template_async_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_async_main, "remove_tags", mock_remove_tags)++ await AsyncTemplate.remove_tags("my-template", ["production", "staging"])++ mock_remove_tags.assert_called_once()+ _, name, tags = mock_remove_tags.call_args[0]+ assert name == "my-template"+ assert tags == ["production", "staging"]++ @pytest.mark.asyncio+ async def test_remove_tags_error(self, monkeypatch):+ """Test that remove_tags raises an error for nonexistent template."""+ mock_remove_tags = AsyncMock(+ side_effect=TemplateException("Template not found")+ )++ monkeypatch.setattr(+ template_async_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_async_main, "remove_tags", mock_remove_tags)++ with pytest.raises(TemplateException):+ await AsyncTemplate.remove_tags("nonexistent", ["tag"])+++# Integration tests+class TestTagsIntegration:+ """Integration tests for AsyncTemplate tags functionality."""++ @pytest.mark.skip_debug()+ async def test_build_template_with_tags_assign_and_delete(self, async_build):+ """Test building a template with tags, assigning new tags, and deleting."""+ template_alias = f"e2b-async-tags-test-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ # Build a template with initial tag+ template = Template().from_base_image()+ build_info = await async_build(template, name=initial_tag)++ assert build_info.build_id+ assert build_info.template_id++ # Assign additional tags+ tag_info = await AsyncTemplate.assign_tags(+ initial_tag, ["production", "latest"]+ )++ assert tag_info.build_id+ # API returns just the tag portion, not the full alias:tag+ assert "production" in tag_info.tags+ assert "latest" in tag_info.tags++ @pytest.mark.skip_debug()+ async def test_assign_single_tag_to_existing_template(self, async_build):+ """Test assigning a single tag (not array) to an existing template."""+ template_alias = f"e2b-async-single-tag-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ template = Template().from_base_image()+ await async_build(template, name=initial_tag)++ # Assign single tag (not array)+ tag_info = await AsyncTemplate.assign_tags(initial_tag, "stable")++ assert tag_info.build_id+ # API returns just the tag portion, not the full alias:tag+ assert "stable" in tag_info.tags++ @pytest.mark.skip_debug()+ async def test_rejects_invalid_tag_format_missing_alias(self, async_build):+ """Test that tag without alias (starts with colon) is rejected."""+ template_alias = f"e2b-async-invalid-tag-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ template = Template().from_base_image()+ await async_build(template, name=initial_tag)++ # Tag without alias (starts with colon) should be rejected+ with pytest.raises(Exception):+ await AsyncTemplate.assign_tags(initial_tag, ":invalid-tag")++ @pytest.mark.skip_debug()+ async def test_rejects_invalid_tag_format_missing_tag(self, async_build):+ """Test that tag without tag portion (ends with colon) is rejected."""+ template_alias = f"e2b-async-invalid-tag2-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ template = Template().from_base_image()+ await async_build(template, name=initial_tag)++ # Tag without tag portion (ends with colon) should be rejected+ with pytest.raises(Exception):+ await AsyncTemplate.assign_tags(initial_tag, f"{template_alias}:")diff --git a/packages/python-sdk/tests/conftest.py b/packages/python-sdk/tests/conftest.pyindex 8ce631196..313bdc1ca 100644--- a/packages/python-sdk/tests/conftest.py+++ b/packages/python-sdk/tests/conftest.py@@ -1,7 +1,7 @@import asyncioimport osimport uuid-from typing import Callable, Optional+from typing import Callable, Dict, Optionalfrom uuid import uuid4import pytest@@ -97,18 +97,42 @@ async def async_sandbox(async_sandbox_factory):def build():def _build(template: TemplateClass,- alias: Optional[str] = None,+ name: Optional[str] = None,skip_cache: bool = False,on_build_logs: Optional[Callable[[LogEntry], None]] = None,):- return Template.build(- template,- alias=alias or f"e2b-test-{uuid4()}",- cpu_count=1,- memory_mb=1024,- skip_cache=skip_cache,- on_build_logs=on_build_logs,- )+ build_name = name or f"e2b-test-{uuid4()}"+ build_info: Dict[str, Optional[str]] = {"template_id": None, "build_id": None}++ def capture_logs(log: LogEntry):+ import re++ if "Template created with ID:" in log.message:+ match = re.search(+ r"Template created with ID: ([^,]+), Build ID: (.+)", log.message+ )+ if match:+ build_info["template_id"] = match.group(1)+ build_info["build_id"] = match.group(2)+ if on_build_logs:+ on_build_logs(log)++ try:+ return Template.build(+ template,+ build_name,+ cpu_count=1,+ memory_mb=1024,+ skip_cache=skip_cache,+ on_build_logs=capture_logs,+ )+ except Exception as e:+ print(+ f"\n[BUILD FAILED] name={build_name}, "+ f"template_id={build_info['template_id']}, "+ f"build_id={build_info['build_id']}, error={e}"+ )+ raisereturn _build@@ -117,18 +141,42 @@ def build():def async_build():async def _async_build(template: TemplateClass,- alias: Optional[str] = None,+ name: Optional[str] = None,skip_cache: bool = False,on_build_logs: Optional[Callable[[LogEntry], None]] = None,):- return await AsyncTemplate.build(- template,- alias=alias or f"e2b-test-{uuid4()}",- cpu_count=1,- memory_mb=1024,- skip_cache=skip_cache,- on_build_logs=on_build_logs,- )+ build_name = name or f"e2b-test-{uuid4()}"+ build_info: Dict[str, Optional[str]] = {"template_id": None, "build_id": None}++ def capture_logs(log: LogEntry):+ import re++ if "Template created with ID:" in log.message:+ match = re.search(+ r"Template created with ID: ([^,]+), Build ID: (.+)", log.message+ )+ if match:+ build_info["template_id"] = match.group(1)+ build_info["build_id"] = match.group(2)+ if on_build_logs:+ on_build_logs(log)++ try:+ return await AsyncTemplate.build(+ template,+ build_name,+ cpu_count=1,+ memory_mb=1024,+ skip_cache=skip_cache,+ on_build_logs=capture_logs,+ )+ except Exception as e:+ print(+ f"\n[BUILD FAILED] name={build_name}, "+ f"template_id={build_info['template_id']}, "+ f"build_id={build_info['build_id']}, error={e}"+ )+ raisereturn _async_builddiff --git a/packages/python-sdk/tests/shared/template/utils/test_normalize_build_arguments.py b/packages/python-sdk/tests/shared/template/utils/test_normalize_build_arguments.pynew file mode 100644index 000000000..f6e83c479--- /dev/null+++ b/packages/python-sdk/tests/shared/template/utils/test_normalize_build_arguments.py@@ -0,0 +1,45 @@+import pytest++from e2b.template.utils import normalize_build_arguments+from e2b.exceptions import TemplateException+++def test_handles_string_name():+ result = normalize_build_arguments(name="my-template:v1.0")+ assert result == "my-template:v1.0"+++def test_handles_name_without_tag():+ result = normalize_build_arguments(name="my-template")+ assert result == "my-template"+++def test_handles_legacy_alias():+ result = normalize_build_arguments(alias="my-template")+ assert result == "my-template"+++def test_name_takes_precedence_over_alias():+ # When both are provided, name should be used+ result = normalize_build_arguments(name="from-name", alias="from-alias")+ assert result == "from-name"+++def test_throws_for_empty_name():+ with pytest.raises(TemplateException, match="Name must be provided"):+ normalize_build_arguments(name="")+++def test_throws_for_empty_alias():+ with pytest.raises(TemplateException, match="Name must be provided"):+ normalize_build_arguments(alias="")+++def test_throws_for_missing_name_and_alias():+ with pytest.raises(TemplateException, match="Name must be provided"):+ normalize_build_arguments()+++def test_throws_for_none_values():+ with pytest.raises(TemplateException, match="Name must be provided"):+ normalize_build_arguments(name=None, alias=None)diff --git a/packages/python-sdk/tests/sync/template_sync/test_background_build.py b/packages/python-sdk/tests/sync/template_sync/test_background_build.pyindex 56fd1576d..07f465961 100644--- a/packages/python-sdk/tests/sync/template_sync/test_background_build.py+++ b/packages/python-sdk/tests/sync/template_sync/test_background_build.py@@ -17,11 +17,11 @@ def test_build_in_background_should_start_build_and_return_info():.set_start_cmd('echo "Hello"', wait_for_timeout(10_000)))- alias = f"e2b-test-{uuid.uuid4()}"+ name = f"e2b-test-{uuid.uuid4()}"build_info = Template.build_in_background(template,- alias=alias,+ name,cpu_count=1,memory_mb=1024,)diff --git a/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py b/packages/python-sdk/tests/sync/template_sync/test_stacktrace.pyindex 02e0a97ba..489f451dc 100644--- a/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py+++ b/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py@@ -1,13 +1,13 @@import tracebackfrom types import SimpleNamespace-from typing import Optional+from typing import List, Optionalfrom uuid import uuid4import pytestimport linecachefrom e2b import Template, CopyItem, wait_for_timeout-from e2b.api.client.models import TemplateBuildStatus+from e2b.template.types import TemplateBuildStatusimport e2b.template_sync.main as template_sync_mainimport e2b.template_sync.build_api as build_api_mod@@ -43,8 +43,10 @@ failure_map: dict[str, Optional[int]] = {@pytest.fixture(autouse=True)def mock_template_build(monkeypatch):- def mock_request_build(client, name: str, cpu_count: int, memory_mb: int):- return SimpleNamespace(template_id=name, build_id=str(uuid4()))+ def mock_request_build(+ client, name: str, tags: Optional[List[str]], cpu_count: int, memory_mb: int+ ):+ return SimpleNamespace(template_id=name, build_id=str(uuid4()), tags=tags or [])def mock_trigger_build(client, template_id: str, build_id: str, template):return None@@ -95,7 +97,7 @@ def test_traces_on_from_image(build):template = Template()template = template.from_image("e2b.dev/this-image-does-not-exist")_expect_to_throw_and_check_trace(- lambda: build(template, alias="from_image", skip_cache=True), "from_image"+ lambda: build(template, name="from_image", skip_cache=True), "from_image")@@ -103,7 +105,7 @@ def test_traces_on_from_image(build):def test_traces_on_from_template(build):template = Template().from_template("this-template-does-not-exist")_expect_to_throw_and_check_trace(- lambda: build(template, alias="from_template", skip_cache=True), "from_template"+ lambda: build(template, name="from_template", skip_cache=True), "from_template")@@ -112,7 +114,7 @@ def test_traces_on_from_dockerfile(build):template = Template()template = template.from_dockerfile("FROM ubuntu:22.04\nRUN nonexistent")_expect_to_throw_and_check_trace(- lambda: build(template, alias="from_dockerfile", skip_cache=True),+ lambda: build(template, name="from_dockerfile", skip_cache=True),"from_dockerfile",)@@ -126,7 +128,7 @@ def test_traces_on_from_image_registry(build):password="test",)_expect_to_throw_and_check_trace(- lambda: build(template, alias="from_image_registry", skip_cache=True),+ lambda: build(template, name="from_image_registry", skip_cache=True),"from_image",)@@ -141,7 +143,7 @@ def test_traces_on_from_aws_registry(build):region="us-east-1",)_expect_to_throw_and_check_trace(- lambda: build(template, alias="from_aws_registry"), "from_aws_registry"+ lambda: build(template, name="from_aws_registry"), "from_aws_registry")@@ -155,7 +157,7 @@ def test_traces_on_from_gcp_registry(build):},)_expect_to_throw_and_check_trace(- lambda: build(template, alias="from_gcp_registry"), "from_gcp_registry"+ lambda: build(template, name="from_gcp_registry"), "from_gcp_registry")@@ -164,7 +166,7 @@ def test_traces_on_copy(build):template = Template()template = template.from_base_image()template = template.skip_cache().copy(non_existent_path, non_existent_path)- _expect_to_throw_and_check_trace(lambda: build(template, alias="copy"), "copy")+ _expect_to_throw_and_check_trace(lambda: build(template, name="copy"), "copy")@pytest.mark.skip_debug()@@ -175,7 +177,7 @@ def test_traces_on_copyItems(build):[CopyItem(src=non_existent_path, dest=non_existent_path)])_expect_to_throw_and_check_trace(- lambda: build(template, alias="copy_items"), "copy_items"+ lambda: build(template, name="copy_items"), "copy_items")@@ -184,7 +186,7 @@ def test_traces_on_remove(build):template = Template()template = template.from_base_image()template = template.skip_cache().remove(non_existent_path)- _expect_to_throw_and_check_trace(lambda: build(template, alias="remove"), "remove")+ _expect_to_throw_and_check_trace(lambda: build(template, name="remove"), "remove")@pytest.mark.skip_debug()@@ -192,7 +194,7 @@ def test_traces_on_rename(build):template = Template()template = template.from_base_image()template = template.skip_cache().rename(non_existent_path, "/tmp/dest.txt")- _expect_to_throw_and_check_trace(lambda: build(template, alias="rename"), "rename")+ _expect_to_throw_and_check_trace(lambda: build(template, name="rename"), "rename")@pytest.mark.skip_debug()@@ -201,7 +203,7 @@ def test_traces_on_make_dir(build):template = template.from_base_image()template = template.set_user("root").skip_cache().make_dir("/root/.bashrc")_expect_to_throw_and_check_trace(- lambda: build(template, alias="make_dir"), "make_dir"+ lambda: build(template, name="make_dir"), "make_dir")@@ -211,7 +213,7 @@ def test_traces_on_make_symlink(build):template = template.from_base_image()template = template.skip_cache().make_symlink(".bashrc", ".bashrc")_expect_to_throw_and_check_trace(- lambda: build(template, alias="make_symlink"), "make_symlink"+ lambda: build(template, name="make_symlink"), "make_symlink")@@ -220,9 +222,7 @@ def test_traces_on_run_cmd(build):template = Template()template = template.from_base_image()template = template.skip_cache().run_cmd(f"cat {non_existent_path}")- _expect_to_throw_and_check_trace(- lambda: build(template, alias="run_cmd"), "run_cmd"- )+ _expect_to_throw_and_check_trace(lambda: build(template, name="run_cmd"), "run_cmd")@pytest.mark.skip_debug()@@ -231,7 +231,7 @@ def test_traces_on_set_workdir(build):template = template.from_base_image()template = template.set_user("root").skip_cache().set_workdir("/root/.bashrc")_expect_to_throw_and_check_trace(- lambda: build(template, alias="set_workdir"), "set_workdir"+ lambda: build(template, name="set_workdir"), "set_workdir")@@ -241,7 +241,7 @@ def test_traces_on_set_user(build):template = template.from_base_image()template = template.skip_cache().set_user("; exit 1")_expect_to_throw_and_check_trace(- lambda: build(template, alias="set_user"), "set_user"+ lambda: build(template, name="set_user"), "set_user")@@ -251,7 +251,7 @@ def test_traces_on_pip_install(build):template = template.from_base_image()template = template.skip_cache().pip_install("nonexistent-package")_expect_to_throw_and_check_trace(- lambda: build(template, alias="pip_install"), "pip_install"+ lambda: build(template, name="pip_install"), "pip_install")@@ -261,7 +261,7 @@ def test_traces_on_npm_install(build):template = template.from_base_image()template = template.skip_cache().npm_install("nonexistent-package")_expect_to_throw_and_check_trace(- lambda: build(template, alias="npm_install"), "npm_install"+ lambda: build(template, name="npm_install"), "npm_install")@@ -271,7 +271,7 @@ def test_traces_on_apt_install(build):template = template.from_base_image()template = template.skip_cache().apt_install("nonexistent-package")_expect_to_throw_and_check_trace(- lambda: build(template, alias="apt_install"), "apt_install"+ lambda: build(template, name="apt_install"), "apt_install")@@ -281,7 +281,7 @@ def test_traces_on_git_clone(build):template = template.from_base_image()template = template.skip_cache().git_clone("https://github.com/repo.git")_expect_to_throw_and_check_trace(- lambda: build(template, alias="git_clone"), "git_clone"+ lambda: build(template, name="git_clone"), "git_clone")@@ -293,7 +293,7 @@ def test_traces_on_set_start_cmd(build):f"./{non_existent_path}", wait_for_timeout(10_000))_expect_to_throw_and_check_trace(- lambda: build(template, alias="set_start_cmd"), "set_start_cmd"+ lambda: build(template, name="set_start_cmd"), "set_start_cmd")@@ -312,7 +312,7 @@ def test_traces_on_dev_container_prebuild(build):template = template.from_template("devcontainer")template = template.skip_cache().beta_dev_container_prebuild(non_existent_path)_expect_to_throw_and_check_trace(- lambda: build(template, alias="beta_dev_container_prebuild"),+ lambda: build(template, name="beta_dev_container_prebuild"),"beta_dev_container_prebuild",)@@ -323,6 +323,6 @@ def test_traces_on_set_dev_container_start(build):template = template.from_template("devcontainer")template = template.beta_set_dev_container_start(non_existent_path)_expect_to_throw_and_check_trace(- lambda: build(template, alias="beta_set_dev_container_start"),+ lambda: build(template, name="beta_set_dev_container_start"),"beta_set_dev_container_start",)diff --git a/packages/python-sdk/tests/sync/template_sync/test_tags.py b/packages/python-sdk/tests/sync/template_sync/test_tags.pynew file mode 100644index 000000000..d2648894a--- /dev/null+++ b/packages/python-sdk/tests/sync/template_sync/test_tags.py@@ -0,0 +1,174 @@+import uuid+from unittest.mock import Mock++import pytest++from e2b import TemplateTagInfo, Template+from e2b.exceptions import TemplateException+import e2b.template_sync.main as template_sync_main+++class TestAssignTags:+ """Tests for Template.assign_tags method."""++ def test_assign_single_tag(self, monkeypatch):+ """Test assigning a single tag to a template."""+ mock_assign_tags = Mock(+ return_value=TemplateTagInfo(+ build_id="00000000-0000-0000-0000-000000000000",+ tags=["production"],+ )+ )++ monkeypatch.setattr(+ template_sync_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_sync_main, "assign_tags", mock_assign_tags)++ result = Template.assign_tags("my-template:v1.0", "production")++ assert result.build_id == "00000000-0000-0000-0000-000000000000"+ assert "production" in result.tags+ mock_assign_tags.assert_called_once()+ _, target, tags = mock_assign_tags.call_args[0]+ assert target == "my-template:v1.0"+ assert tags == ["production"]++ def test_assign_multiple_tags(self, monkeypatch):+ """Test assigning multiple tags to a template."""+ mock_assign_tags = Mock(+ return_value=TemplateTagInfo(+ build_id="00000000-0000-0000-0000-000000000000",+ tags=["production", "stable"],+ )+ )++ monkeypatch.setattr(+ template_sync_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_sync_main, "assign_tags", mock_assign_tags)++ result = Template.assign_tags("my-template:v1.0", ["production", "stable"])++ assert result.build_id == "00000000-0000-0000-0000-000000000000"+ assert "production" in result.tags+ assert "stable" in result.tags+ mock_assign_tags.assert_called_once()+ _, _, tags = mock_assign_tags.call_args[0]+ assert tags == ["production", "stable"]+++class TestRemoveTags:+ """Tests for Template.remove_tags method."""++ def test_remove_single_tag(self, monkeypatch):+ """Test deleting a single tag from a template."""+ mock_remove_tags = Mock(return_value=None)++ monkeypatch.setattr(+ template_sync_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_sync_main, "remove_tags", mock_remove_tags)++ Template.remove_tags("my-template", "production")++ mock_remove_tags.assert_called_once()+ _, name, tags = mock_remove_tags.call_args[0]+ assert name == "my-template"+ assert tags == ["production"]++ def test_remove_multiple_tags(self, monkeypatch):+ """Test deleting multiple tags from a template."""+ mock_remove_tags = Mock(return_value=None)++ monkeypatch.setattr(+ template_sync_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_sync_main, "remove_tags", mock_remove_tags)++ Template.remove_tags("my-template", ["production", "staging"])++ mock_remove_tags.assert_called_once()+ _, name, tags = mock_remove_tags.call_args[0]+ assert name == "my-template"+ assert tags == ["production", "staging"]++ def test_remove_tags_error(self, monkeypatch):+ """Test that remove_tags raises an error for nonexistent template."""+ mock_remove_tags = Mock(side_effect=TemplateException("Template not found"))++ monkeypatch.setattr(+ template_sync_main, "get_api_client", lambda *args, **kwargs: None+ )+ monkeypatch.setattr(template_sync_main, "remove_tags", mock_remove_tags)++ with pytest.raises(TemplateException):+ Template.remove_tags("nonexistent", ["tag"])+++# Integration tests+class TestTagsIntegration:+ """Integration tests for Template tags functionality."""++ @pytest.mark.skip_debug()+ def test_build_template_with_tags_assign_and_delete(self, build):+ """Test building a template with tags, assigning new tags, and deleting."""+ template_alias = f"e2b-sync-tags-test-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ # Build a template with initial tag+ template = Template().from_base_image()+ build_info = build(template, name=initial_tag)++ assert build_info.build_id+ assert build_info.template_id++ # Assign additional tags+ tag_info = Template.assign_tags(initial_tag, ["production", "latest"])++ assert tag_info.build_id+ # API returns just the tag portion, not the full alias:tag+ assert "production" in tag_info.tags+ assert "latest" in tag_info.tags++ @pytest.mark.skip_debug()+ def test_assign_single_tag_to_existing_template(self, build):+ """Test assigning a single tag (not array) to an existing template."""+ template_alias = f"e2b-sync-single-tag-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ template = Template().from_base_image()+ build(template, name=initial_tag)++ # Assign single tag (not array)+ tag_info = Template.assign_tags(initial_tag, "stable")++ assert tag_info.build_id+ # API returns just the tag portion, not the full alias:tag+ assert "stable" in tag_info.tags++ @pytest.mark.skip_debug()+ def test_rejects_invalid_tag_format_missing_alias(self, build):+ """Test that tag without alias (starts with colon) is rejected."""+ template_alias = f"e2b-sync-invalid-tag-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ template = Template().from_base_image()+ build(template, name=initial_tag)++ # Tag without alias (starts with colon) should be rejected+ with pytest.raises(Exception):+ Template.assign_tags(initial_tag, ":invalid-tag")++ @pytest.mark.skip_debug()+ def test_rejects_invalid_tag_format_missing_tag(self, build):+ """Test that tag without tag portion (ends with colon) is rejected."""+ template_alias = f"e2b-sync-invalid-tag2-{uuid.uuid4().hex}"+ initial_tag = f"{template_alias}:v1.0"++ template = Template().from_base_image()+ build(template, name=initial_tag)++ # Tag without tag portion (ends with colon) should be rejected+ with pytest.raises(Exception):+ Template.assign_tags(initial_tag, f"{template_alias}:")diff --git a/spec/openapi.yml b/spec/openapi.ymlindex faa19b956..ea86cc595 100644--- a/spec/openapi.yml+++ b/spec/openapi.yml@@ -102,42 +102,42 @@ components:type: stringresponses:- '400':+ "400":description: Bad requestcontent:application/json:schema:- $ref: '#/components/schemas/Error'- '401':+ $ref: "#/components/schemas/Error"+ "401":description: Authentication errorcontent:application/json:schema:- $ref: '#/components/schemas/Error'- '403':+ $ref: "#/components/schemas/Error"+ "403":description: Forbiddencontent:application/json:schema:- $ref: '#/components/schemas/Error'- '404':+ $ref: "#/components/schemas/Error"+ "404":description: Not foundcontent:application/json:schema:- $ref: '#/components/schemas/Error'- '409':+ $ref: "#/components/schemas/Error"+ "409":description: Conflictcontent:application/json:schema:- $ref: '#/components/schemas/Error'- '500':+ $ref: "#/components/schemas/Error"+ "500":description: Server errorcontent:application/json:schema:- $ref: '#/components/schemas/Error'+ $ref: "#/components/schemas/Error"schemas:Team:@@ -274,7 +274,7 @@ components:type: stringdescription: Log message contentlevel:- $ref: '#/components/schemas/LogLevel'+ $ref: "#/components/schemas/LogLevel"fields:type: objectadditionalProperties:@@ -289,12 +289,12 @@ components:description: Logs of the sandboxtype: arrayitems:- $ref: '#/components/schemas/SandboxLog'+ $ref: "#/components/schemas/SandboxLog"logEntries:description: Structured logs of the sandboxtype: arrayitems:- $ref: '#/components/schemas/SandboxLogEntry'+ $ref: "#/components/schemas/SandboxLogEntry"SandboxMetric:description: Metric entry with timestamp and line@@ -363,7 +363,7 @@ components:deprecated: truedescription: Identifier of the clientenvdVersion:- $ref: '#/components/schemas/EnvdVersion'+ $ref: "#/components/schemas/EnvdVersion"envdAccessToken:type: stringdescription: Access token used for envd communication@@ -411,7 +411,7 @@ components:format: date-timedescription: Time when the sandbox will expireenvdVersion:- $ref: '#/components/schemas/EnvdVersion'+ $ref: "#/components/schemas/EnvdVersion"envdAccessToken:type: stringdescription: Access token used for envd communication@@ -420,15 +420,15 @@ components:nullable: truedescription: Base domain where the sandbox traffic is accessiblecpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"diskSizeMB:- $ref: '#/components/schemas/DiskSizeMB'+ $ref: "#/components/schemas/DiskSizeMB"metadata:- $ref: '#/components/schemas/SandboxMetadata'+ $ref: "#/components/schemas/SandboxMetadata"state:- $ref: '#/components/schemas/SandboxState'+ $ref: "#/components/schemas/SandboxState"ListedSandbox:required:@@ -465,17 +465,17 @@ components:format: date-timedescription: Time when the sandbox will expirecpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"diskSizeMB:- $ref: '#/components/schemas/DiskSizeMB'+ $ref: "#/components/schemas/DiskSizeMB"metadata:- $ref: '#/components/schemas/SandboxMetadata'+ $ref: "#/components/schemas/SandboxMetadata"state:- $ref: '#/components/schemas/SandboxState'+ $ref: "#/components/schemas/SandboxState"envdVersion:- $ref: '#/components/schemas/EnvdVersion'+ $ref: "#/components/schemas/EnvdVersion"SandboxesWithMetrics:required:@@ -483,7 +483,7 @@ components:properties:sandboxes:additionalProperties:- $ref: '#/components/schemas/SandboxMetric'+ $ref: "#/components/schemas/SandboxMetric"NewSandbox:required:@@ -511,13 +511,13 @@ components:Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOutto 0.0.0.0/0 in the network config.network:- $ref: '#/components/schemas/SandboxNetworkConfig'+ $ref: "#/components/schemas/SandboxNetworkConfig"metadata:- $ref: '#/components/schemas/SandboxMetadata'+ $ref: "#/components/schemas/SandboxMetadata"envVars:- $ref: '#/components/schemas/EnvVars'+ $ref: "#/components/schemas/EnvVars"mcp:- $ref: '#/components/schemas/Mcp'+ $ref: "#/components/schemas/Mcp"ResumedSandbox:properties:@@ -626,11 +626,11 @@ components:type: stringdescription: Identifier of the last successful build for given templatecpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"diskSizeMB:- $ref: '#/components/schemas/DiskSizeMB'+ $ref: "#/components/schemas/DiskSizeMB"public:type: booleandescription: Whether the template is public or only accessible by the team@@ -649,7 +649,7 @@ components:description: Time when the template was last updatedcreatedBy:allOf:- - $ref: '#/components/schemas/TeamUser'+ - $ref: "#/components/schemas/TeamUser"nullable: truelastSpawnedAt:type: string@@ -665,9 +665,9 @@ components:format: int32description: Number of times the template was builtenvdVersion:- $ref: '#/components/schemas/EnvdVersion'+ $ref: "#/components/schemas/EnvdVersion"buildStatus:- $ref: '#/components/schemas/TemplateBuildStatus'+ $ref: "#/components/schemas/TemplateBuildStatus"TemplateRequestResponseV3:required:@@ -675,6 +675,8 @@ components:- buildID- public- aliases+ - names+ - tagsproperties:templateID:type: string@@ -685,9 +687,20 @@ components:public:type: booleandescription: Whether the template is public or only accessible by the team+ names:+ type: array+ description: Names of the template+ items:+ type: string+ tags:+ type: array+ description: Tags assigned to the template build+ items:+ type: stringaliases:type: arraydescription: Aliases of the template+ deprecated: trueitems:type: string@@ -715,11 +728,11 @@ components:type: stringdescription: Identifier of the last successful build for given templatecpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"diskSizeMB:- $ref: '#/components/schemas/DiskSizeMB'+ $ref: "#/components/schemas/DiskSizeMB"public:type: booleandescription: Whether the template is public or only accessible by the team@@ -738,7 +751,7 @@ components:description: Time when the template was last updatedcreatedBy:allOf:- - $ref: '#/components/schemas/TeamUser'+ - $ref: "#/components/schemas/TeamUser"nullable: truelastSpawnedAt:type: string@@ -754,7 +767,7 @@ components:format: int32description: Number of times the template was builtenvdVersion:- $ref: '#/components/schemas/EnvdVersion'+ $ref: "#/components/schemas/EnvdVersion"TemplateBuild:required:@@ -770,7 +783,7 @@ components:format: uuiddescription: Identifier of the buildstatus:- $ref: '#/components/schemas/TemplateBuildStatus'+ $ref: "#/components/schemas/TemplateBuildStatus"createdAt:type: stringformat: date-time@@ -784,13 +797,13 @@ components:format: date-timedescription: Time when the build was finishedcpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"diskSizeMB:- $ref: '#/components/schemas/DiskSizeMB'+ $ref: "#/components/schemas/DiskSizeMB"envdVersion:- $ref: '#/components/schemas/EnvdVersion'+ $ref: "#/components/schemas/EnvdVersion"TemplateWithBuilds:required:@@ -835,7 +848,7 @@ components:type: arraydescription: List of builds for the templateitems:- $ref: '#/components/schemas/TemplateBuild'+ $ref: "#/components/schemas/TemplateBuild"TemplateAliasResponse:required:@@ -869,9 +882,9 @@ components:description: Ready check command to execute in the template after the buildtype: stringcpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"TemplateStep:description: Step in the template build process@@ -897,22 +910,26 @@ components:TemplateBuildRequestV3:properties:- alias:- description: Alias of the template. Deprecated, use names instead.+ name:+ description: Name of the template. Can include a tag with colon separator (e.g. "my-template" or "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array.type: string- deprecated: true- names:+ tags:type: array- description: Names of the template+ description: Tags to assign to the template builditems:type: string+ alias:+ description: Alias of the template. Deprecated, use name instead.+ type: string+ deprecated: trueteamID:+ deprecated: truetype: stringdescription: Identifier of the teamcpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"TemplateBuildRequestV2:required:@@ -922,24 +939,25 @@ components:description: Alias of the templatetype: stringteamID:+ deprecated: truetype: stringdescription: Identifier of the teamcpuCount:- $ref: '#/components/schemas/CPUCount'+ $ref: "#/components/schemas/CPUCount"memoryMB:- $ref: '#/components/schemas/MemoryMB'+ $ref: "#/components/schemas/MemoryMB"FromImageRegistry:oneOf:- - $ref: '#/components/schemas/AWSRegistry'- - $ref: '#/components/schemas/GCPRegistry'- - $ref: '#/components/schemas/GeneralRegistry'+ - $ref: "#/components/schemas/AWSRegistry"+ - $ref: "#/components/schemas/GCPRegistry"+ - $ref: "#/components/schemas/GeneralRegistry"discriminator:propertyName: typemapping:- aws: '#/components/schemas/AWSRegistry'- gcp: '#/components/schemas/GCPRegistry'- registry: '#/components/schemas/GeneralRegistry'+ aws: "#/components/schemas/AWSRegistry"+ gcp: "#/components/schemas/GCPRegistry"+ registry: "#/components/schemas/GeneralRegistry"AWSRegistry:type: object@@ -1005,7 +1023,7 @@ components:type: stringdescription: Template to use as a base for the template buildfromImageRegistry:- $ref: '#/components/schemas/FromImageRegistry'+ $ref: "#/components/schemas/FromImageRegistry"force:default: falsetype: boolean@@ -1015,7 +1033,7 @@ components:description: List of steps to execute in the template buildtype: arrayitems:- $ref: '#/components/schemas/TemplateStep'+ $ref: "#/components/schemas/TemplateStep"startCmd:description: Start command to execute in the template after the buildtype: string@@ -1057,7 +1075,7 @@ components:type: stringdescription: Log message contentlevel:- $ref: '#/components/schemas/LogLevel'+ $ref: "#/components/schemas/LogLevel"step:type: stringdescription: Step in the build process related to the log entry@@ -1077,7 +1095,7 @@ components:description: Log entries related to the status reasontype: arrayitems:- $ref: '#/components/schemas/BuildLogEntry'+ $ref: "#/components/schemas/BuildLogEntry"TemplateBuildStatus:type: string@@ -1107,7 +1125,7 @@ components:description: Build logs structuredtype: arrayitems:- $ref: '#/components/schemas/BuildLogEntry'+ $ref: "#/components/schemas/BuildLogEntry"templateID:type: stringdescription: Identifier of the template@@ -1115,9 +1133,9 @@ components:type: stringdescription: Identifier of the buildstatus:- $ref: '#/components/schemas/TemplateBuildStatus'+ $ref: "#/components/schemas/TemplateBuildStatus"reason:- $ref: '#/components/schemas/BuildStatusReason'+ $ref: "#/components/schemas/BuildStatusReason"TemplateBuildLogsResponse:required:@@ -1128,7 +1146,7 @@ components:description: Build logs structuredtype: arrayitems:- $ref: '#/components/schemas/BuildLogEntry'+ $ref: "#/components/schemas/BuildLogEntry"LogsDirection:type: string@@ -1173,7 +1191,7 @@ components:format: uuiddescription: Identifier of the clusterstatus:- $ref: '#/components/schemas/NodeStatus'+ $ref: "#/components/schemas/NodeStatus"DiskMetrics:required:@@ -1240,7 +1258,7 @@ components:type: arraydescription: Detailed metrics for each disk/mount pointitems:- $ref: '#/components/schemas/DiskMetrics'+ $ref: "#/components/schemas/DiskMetrics"MachineInfo:required:- cpuFamily@@ -1297,15 +1315,15 @@ components:type: stringdescription: Identifier of the clustermachineInfo:- $ref: '#/components/schemas/MachineInfo'+ $ref: "#/components/schemas/MachineInfo"status:- $ref: '#/components/schemas/NodeStatus'+ $ref: "#/components/schemas/NodeStatus"sandboxCount:type: integerformat: uint32description: Number of sandboxes running on the nodemetrics:- $ref: '#/components/schemas/NodeMetrics'+ $ref: "#/components/schemas/NodeMetrics"createSuccesses:type: integerformat: uint64@@ -1355,16 +1373,16 @@ components:deprecated: truedescription: Identifier of the nomad nodemachineInfo:- $ref: '#/components/schemas/MachineInfo'+ $ref: "#/components/schemas/MachineInfo"status:- $ref: '#/components/schemas/NodeStatus'+ $ref: "#/components/schemas/NodeStatus"sandboxes:type: arraydescription: List of sandboxes running on the nodeitems:- $ref: '#/components/schemas/ListedSandbox'+ $ref: "#/components/schemas/ListedSandbox"metrics:- $ref: '#/components/schemas/NodeMetrics'+ $ref: "#/components/schemas/NodeMetrics"cachedBuilds:type: arraydescription: List of cached builds id on the node@@ -1398,7 +1416,7 @@ components:type: stringdescription: The fully created access tokenmask:- $ref: '#/components/schemas/IdentifierMaskingDetails'+ $ref: "#/components/schemas/IdentifierMaskingDetails"createdAt:type: stringformat: date-time@@ -1427,14 +1445,14 @@ components:type: stringdescription: Name of the API keymask:- $ref: '#/components/schemas/IdentifierMaskingDetails'+ $ref: "#/components/schemas/IdentifierMaskingDetails"createdAt:type: stringformat: date-timedescription: Timestamp of API key creationcreatedBy:allOf:- - $ref: '#/components/schemas/TeamUser'+ - $ref: "#/components/schemas/TeamUser"nullable: truelastUsed:type: string@@ -1458,7 +1476,7 @@ components:type: stringdescription: Raw value of the API keymask:- $ref: '#/components/schemas/IdentifierMaskingDetails'+ $ref: "#/components/schemas/IdentifierMaskingDetails"name:type: stringdescription: Name of the API key@@ -1468,7 +1486,7 @@ components:description: Timestamp of API key creationcreatedBy:allOf:- - $ref: '#/components/schemas/TeamUser'+ - $ref: "#/components/schemas/TeamUser"nullable: truelastUsed:type: string@@ -1492,7 +1510,7 @@ components:type: stringdescription: New name for the API key- TemplateTag:+ AssignedTemplateTags:required:- tags- buildID@@ -1501,22 +1519,36 @@ components:type: arrayitems:type: string- description: Tags of the template+ description: Assigned tags of the templatebuildID:type: stringformat: uuid- description: Identifier of the build associated with this tag+ description: Identifier of the build associated with these tags- AssignTemplateTagRequest:+ AssignTemplateTagsRequest:required:- target- - names+ - tagsproperties:target:type: string- description: Target template name in 'alias:tag' format- names:- description: Names of the template+ description: Target template in "name:tag" format+ tags:+ description: Tags to assign to the template+ type: array+ items:+ type: string++ DeleteTemplateTagsRequest:+ required:+ - name+ - tags+ properties:+ name:+ type: string+ description: Name of the template+ tags:+ description: Tags to deletetype: arrayitems:type: string@@ -1567,10 +1599,10 @@ paths:get:description: Health checkresponses:- '200':+ "200":description: Request was successful- '401':- $ref: '#/components/responses/401'+ "401":+ $ref: "#/components/responses/401"/teams:get:@@ -1580,7 +1612,7 @@ paths:- AccessTokenAuth: []- Supabase1TokenAuth: []responses:- '200':+ "200":description: Successfully returned all teamscontent:application/json:@@ -1588,11 +1620,11 @@ paths:type: arrayitems:allOf:- - $ref: '#/components/schemas/Team'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ - $ref: "#/components/schemas/Team"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/teams/{teamID}/metrics:get:@@ -1603,7 +1635,7 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/teamID'+ - $ref: "#/components/parameters/teamID"- in: queryname: startschema:@@ -1619,22 +1651,22 @@ paths:minimum: 0description: Unix timestamp for the end of the interval, in seconds, for which the metricsresponses:- '200':+ "200":description: Successfully returned the team metricscontent:application/json:schema:type: arrayitems:- $ref: '#/components/schemas/TeamMetric'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '403':- $ref: '#/components/responses/403'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TeamMetric"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "403":+ $ref: "#/components/responses/403"+ "500":+ $ref: "#/components/responses/500"/teams/{teamID}/metrics/max:get:@@ -1645,7 +1677,7 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/teamID'+ - $ref: "#/components/parameters/teamID"- in: queryname: startschema:@@ -1668,20 +1700,20 @@ paths:enum: [concurrent_sandboxes, sandbox_start_rate]description: Metric to retrieve the maximum value forresponses:- '200':+ "200":description: Successfully returned the team metricscontent:application/json:schema:- $ref: '#/components/schemas/MaxTeamMetric'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '403':- $ref: '#/components/responses/403'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/MaxTeamMetric"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "403":+ $ref: "#/components/responses/403"+ "500":+ $ref: "#/components/responses/500"/sandboxes:get:@@ -1694,12 +1726,12 @@ paths:parameters:- name: metadatain: query- description: Metadata query used to filter the sandboxes (e.g. 'user=abc&app=prod'). Each key and values must be URL encoded.+ description: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.required: falseschema:type: stringresponses:- '200':+ "200":description: Successfully returned all running sandboxescontent:application/json:@@ -1707,13 +1739,13 @@ paths:type: arrayitems:allOf:- - $ref: '#/components/schemas/ListedSandbox'- '401':- $ref: '#/components/responses/401'- '400':- $ref: '#/components/responses/400'- '500':- $ref: '#/components/responses/500'+ - $ref: "#/components/schemas/ListedSandbox"+ "401":+ $ref: "#/components/responses/401"+ "400":+ $ref: "#/components/responses/400"+ "500":+ $ref: "#/components/responses/500"post:description: Create a sandbox from the templatetags: [sandboxes]@@ -1726,20 +1758,20 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/NewSandbox'+ $ref: "#/components/schemas/NewSandbox"responses:- '201':+ "201":description: The sandbox was created successfullycontent:application/json:schema:- $ref: '#/components/schemas/Sandbox'- '401':- $ref: '#/components/responses/401'- '400':- $ref: '#/components/responses/400'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/Sandbox"+ "401":+ $ref: "#/components/responses/401"+ "400":+ $ref: "#/components/responses/400"+ "500":+ $ref: "#/components/responses/500"/v2/sandboxes:get:@@ -1752,7 +1784,7 @@ paths:parameters:- name: metadatain: query- description: Metadata query used to filter the sandboxes (e.g. 'user=abc&app=prod'). Each key and values must be URL encoded.+ description: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded.required: falseschema:type: string@@ -1763,13 +1795,13 @@ paths:schema:type: arrayitems:- $ref: '#/components/schemas/SandboxState'+ $ref: "#/components/schemas/SandboxState"style: formexplode: false- - $ref: '#/components/parameters/paginationNextToken'- - $ref: '#/components/parameters/paginationLimit'+ - $ref: "#/components/parameters/paginationNextToken"+ - $ref: "#/components/parameters/paginationLimit"responses:- '200':+ "200":description: Successfully returned all running sandboxescontent:application/json:@@ -1777,13 +1809,13 @@ paths:type: arrayitems:allOf:- - $ref: '#/components/schemas/ListedSandbox'- '401':- $ref: '#/components/responses/401'- '400':- $ref: '#/components/responses/400'- '500':- $ref: '#/components/responses/500'+ - $ref: "#/components/schemas/ListedSandbox"+ "401":+ $ref: "#/components/responses/401"+ "400":+ $ref: "#/components/responses/400"+ "500":+ $ref: "#/components/responses/500"/sandboxes/metrics:get:@@ -1806,18 +1838,18 @@ paths:maxItems: 100uniqueItems: trueresponses:- '200':+ "200":description: Successfully returned all running sandboxes with metricscontent:application/json:schema:- $ref: '#/components/schemas/SandboxesWithMetrics'- '401':- $ref: '#/components/responses/401'- '400':- $ref: '#/components/responses/400'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/SandboxesWithMetrics"+ "401":+ $ref: "#/components/responses/401"+ "400":+ $ref: "#/components/responses/400"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}/logs:get:@@ -1828,7 +1860,7 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"- in: queryname: startschema:@@ -1845,18 +1877,18 @@ paths:type: integerdescription: Maximum number of logs that should be returnedresponses:- '200':+ "200":description: Successfully returned the sandbox logscontent:application/json:schema:- $ref: '#/components/schemas/SandboxLogs'- '404':- $ref: '#/components/responses/404'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/SandboxLogs"+ "404":+ $ref: "#/components/responses/404"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}:get:@@ -1867,20 +1899,20 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"responses:- '200':+ "200":description: Successfully returned the sandboxcontent:application/json:schema:- $ref: '#/components/schemas/SandboxDetail'- '404':- $ref: '#/components/responses/404'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/SandboxDetail"+ "404":+ $ref: "#/components/responses/404"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"delete:description: Kill a sandbox@@ -1890,16 +1922,16 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"responses:- '204':+ "204":description: The sandbox was killed successfully- '404':- $ref: '#/components/responses/404'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ "404":+ $ref: "#/components/responses/404"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}/metrics:get:@@ -1910,7 +1942,7 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"- in: queryname: startschema:@@ -1927,22 +1959,22 @@ paths:description: Unix timestamp for the end of the interval, in seconds, for which the metricsresponses:- '200':+ "200":description: Successfully returned the sandbox metricscontent:application/json:schema:type: arrayitems:- $ref: '#/components/schemas/SandboxMetric'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/SandboxMetric"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"# TODO: Pause and resume might be exposed as POST /sandboxes/{sandboxID}/snapshot and then POST /sandboxes with specified snapshotting setup/sandboxes/{sandboxID}/pause:@@ -1954,18 +1986,18 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"responses:- '204':+ "204":description: The sandbox was paused successfully and can be resumed- '409':- $ref: '#/components/responses/409'- '404':- $ref: '#/components/responses/404'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ "409":+ $ref: "#/components/responses/409"+ "404":+ $ref: "#/components/responses/404"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}/resume:post:@@ -1977,28 +2009,28 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/ResumedSandbox'+ $ref: "#/components/schemas/ResumedSandbox"responses:- '201':+ "201":description: The sandbox was resumed successfullycontent:application/json:schema:- $ref: '#/components/schemas/Sandbox'- '409':- $ref: '#/components/responses/409'- '404':- $ref: '#/components/responses/404'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/Sandbox"+ "409":+ $ref: "#/components/responses/409"+ "404":+ $ref: "#/components/responses/404"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}/connect:post:@@ -2009,34 +2041,34 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/ConnectSandbox'+ $ref: "#/components/schemas/ConnectSandbox"responses:- '200':+ "200":description: The sandbox was already runningcontent:application/json:schema:- $ref: '#/components/schemas/Sandbox'- '201':+ $ref: "#/components/schemas/Sandbox"+ "201":description: The sandbox was resumed successfullycontent:application/json:schema:- $ref: '#/components/schemas/Sandbox'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/Sandbox"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}/timeout:post:@@ -2060,16 +2092,16 @@ paths:format: int32minimum: 0parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"responses:- '204':+ "204":description: Successfully set the sandbox timeout- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/sandboxes/{sandboxID}/refreshes:post:@@ -2091,14 +2123,14 @@ paths:maximum: 3600 # 1 hourminimum: 0parameters:- - $ref: '#/components/parameters/sandboxID'+ - $ref: "#/components/parameters/sandboxID"responses:- '204':+ "204":description: Successfully refreshed the sandbox- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"/v3/templates:post:@@ -2107,26 +2139,27 @@ paths:security:- ApiKeyAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildRequestV3'+ $ref: "#/components/schemas/TemplateBuildRequestV3"responses:- '202':+ "202":description: The build was requested successfullycontent:application/json:schema:- $ref: '#/components/schemas/TemplateRequestResponseV3'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateRequestResponseV3"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/v2/templates:post:@@ -2136,26 +2169,27 @@ paths:security:- ApiKeyAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildRequestV2'+ $ref: "#/components/schemas/TemplateBuildRequestV2"responses:- '202':+ "202":description: The build was requested successfullycontent:application/json:schema:- $ref: '#/components/schemas/TemplateLegacy'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateLegacy"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/templates/{templateID}/files/{hash}:get:@@ -2165,8 +2199,9 @@ paths:- AccessTokenAuth: []- ApiKeyAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'+ - $ref: "#/components/parameters/templateID"- in: pathname: hashrequired: true@@ -2175,20 +2210,20 @@ paths:description: Hash of the filesresponses:- '201':+ "201":description: The upload link where to upload the tar filecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildFileUpload'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateBuildFileUpload"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/templates:get:@@ -2198,6 +2233,7 @@ paths:- ApiKeyAuth: []- AccessTokenAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- in: queryrequired: false@@ -2206,7 +2242,7 @@ paths:type: stringdescription: Identifier of the teamresponses:- '200':+ "200":description: Successfully returned all templatescontent:application/json:@@ -2214,11 +2250,11 @@ paths:type: arrayitems:allOf:- - $ref: '#/components/schemas/Template'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ - $ref: "#/components/schemas/Template"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"post:description: Create a new templatedeprecated: true@@ -2226,26 +2262,27 @@ paths:security:- AccessTokenAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildRequest'+ $ref: "#/components/schemas/TemplateBuildRequest"responses:- '202':+ "202":description: The build was acceptedcontent:application/json:schema:- $ref: '#/components/schemas/TemplateLegacy'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateLegacy"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/templates/{templateID}:get:@@ -2256,20 +2293,20 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'- - $ref: '#/components/parameters/paginationNextToken'- - $ref: '#/components/parameters/paginationLimit'+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/paginationNextToken"+ - $ref: "#/components/parameters/paginationLimit"responses:- '200':+ "200":description: Successfully returned the template with its buildscontent:application/json:schema:- $ref: '#/components/schemas/TemplateWithBuilds'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateWithBuilds"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"post:description: Rebuild an templatedeprecated: true@@ -2277,26 +2314,27 @@ paths:security:- AccessTokenAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'+ - $ref: "#/components/parameters/templateID"requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildRequest'+ $ref: "#/components/schemas/TemplateBuildRequest"responses:- '202':+ "202":description: The build was acceptedcontent:application/json:schema:- $ref: '#/components/schemas/TemplateLegacy'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateLegacy"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"delete:description: Delete a templatetags: [templates]@@ -2304,15 +2342,16 @@ paths:- ApiKeyAuth: []- AccessTokenAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'+ - $ref: "#/components/parameters/templateID"responses:- '204':+ "204":description: The template was deleted successfully- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"patch:description: Update templatetags: [templates]@@ -2320,23 +2359,24 @@ paths:- ApiKeyAuth: []- AccessTokenAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'+ - $ref: "#/components/parameters/templateID"requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/TemplateUpdateRequest'+ $ref: "#/components/schemas/TemplateUpdateRequest"responses:- '200':+ "200":description: The template was updated successfully- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/templates/{templateID}/builds/{buildID}:post:@@ -2346,16 +2386,17 @@ paths:security:- AccessTokenAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'- - $ref: '#/components/parameters/buildID'+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/buildID"responses:- '202':+ "202":description: The build has started- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/v2/templates/{templateID}/builds/{buildID}:post:@@ -2364,22 +2405,23 @@ paths:security:- ApiKeyAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'- - $ref: '#/components/parameters/buildID'+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/buildID"requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildStartV2'+ $ref: "#/components/schemas/TemplateBuildStartV2"responses:- '202':+ "202":description: The build has started- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/templates/{templateID}/builds/{buildID}/status:get:@@ -2389,9 +2431,10 @@ paths:- AccessTokenAuth: []- ApiKeyAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'- - $ref: '#/components/parameters/buildID'+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/buildID"- in: queryname: logsOffsetschema:@@ -2412,20 +2455,20 @@ paths:- in: queryname: levelschema:- $ref: '#/components/schemas/LogLevel'+ $ref: "#/components/schemas/LogLevel"responses:- '200':+ "200":description: Successfully returned the templatecontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildInfo'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateBuildInfo"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/templates/{templateID}/builds/{buildID}/logs:get:@@ -2435,9 +2478,10 @@ paths:- AccessTokenAuth: []- ApiKeyAuth: []- Supabase1TokenAuth: []+ Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/templateID'- - $ref: '#/components/parameters/buildID'+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/buildID"- in: queryname: cursorschema:@@ -2457,29 +2501,29 @@ paths:- in: queryname: directionschema:- $ref: '#/components/schemas/LogsDirection'+ $ref: "#/components/schemas/LogsDirection"- in: queryname: levelschema:- $ref: '#/components/schemas/LogLevel'+ $ref: "#/components/schemas/LogLevel"- in: queryname: sourceschema:- $ref: '#/components/schemas/LogsSource'+ $ref: "#/components/schemas/LogsSource"description: Source of the logs that should be returned fromresponses:- '200':+ "200":description: Successfully returned the template build logscontent:application/json:schema:- $ref: '#/components/schemas/TemplateBuildLogsResponse'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateBuildLogsResponse"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/templates/tags:post:@@ -2494,48 +2538,46 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/AssignTemplateTagRequest'+ $ref: "#/components/schemas/AssignTemplateTagsRequest"responses:- '201':+ "201":description: Tag assigned successfullycontent:application/json:schema:- $ref: '#/components/schemas/TemplateTag'- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'- /templates/tags/{name}:- parameters:- - name: name- in: path- required: true- schema:- type: string- description: Template name in 'alias:tag' format+ $ref: "#/components/schemas/AssignedTemplateTags"+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"delete:- description: Delete a tag from a template+ description: Delete multiple tags from templatestags: [tags]security:- ApiKeyAuth: []- Supabase1TokenAuth: []Supabase2TeamAuth: []+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/DeleteTemplateTagsRequest"responses:- '204':- description: Tag deleted successfully- '400':- $ref: '#/components/responses/400'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ "204":+ description: Tags deleted successfully+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/templates/aliases/{alias}:get:@@ -2553,20 +2595,20 @@ paths:type: stringdescription: Template aliasresponses:- '200':+ "200":description: Successfully queried template by aliascontent:application/json:schema:- $ref: '#/components/schemas/TemplateAliasResponse'- '400':- $ref: '#/components/responses/400'- '403':- $ref: '#/components/responses/403'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TemplateAliasResponse"+ "400":+ $ref: "#/components/responses/400"+ "403":+ $ref: "#/components/responses/403"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/nodes:get:@@ -2575,7 +2617,7 @@ paths:security:- AdminTokenAuth: []responses:- '200':+ "200":description: Successfully returned all nodescontent:application/json:@@ -2583,11 +2625,11 @@ paths:type: arrayitems:allOf:- - $ref: '#/components/schemas/Node'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ - $ref: "#/components/schemas/Node"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/nodes/{nodeID}:get:@@ -2596,7 +2638,7 @@ paths:security:- AdminTokenAuth: []parameters:- - $ref: '#/components/parameters/nodeID'+ - $ref: "#/components/parameters/nodeID"- in: queryname: clusterIDdescription: Identifier of the cluster@@ -2605,39 +2647,39 @@ paths:type: stringformat: uuidresponses:- '200':+ "200":description: Successfully returned the nodecontent:application/json:schema:- $ref: '#/components/schemas/NodeDetail'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/NodeDetail"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"post:description: Change status of a nodetags: [admin]security:- AdminTokenAuth: []parameters:- - $ref: '#/components/parameters/nodeID'+ - $ref: "#/components/parameters/nodeID"requestBody:content:application/json:schema:- $ref: '#/components/schemas/NodeStatusChange'+ $ref: "#/components/schemas/NodeStatusChange"responses:- '204':+ "204":description: The node status was changed successfully- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/admin/teams/{teamID}/sandboxes/kill:post:@@ -2655,18 +2697,18 @@ paths:format: uuiddescription: Team IDresponses:- '200':+ "200":description: Successfully killed sandboxescontent:application/json:schema:- $ref: '#/components/schemas/AdminSandboxKillResult'- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/AdminSandboxKillResult"+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/access-tokens:post:@@ -2679,18 +2721,18 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/NewAccessToken'+ $ref: "#/components/schemas/NewAccessToken"responses:- '201':+ "201":description: Access token created successfullycontent:application/json:schema:- $ref: '#/components/schemas/CreatedAccessToken'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/CreatedAccessToken"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/access-tokens/{accessTokenID}:delete:@@ -2699,16 +2741,16 @@ paths:security:- Supabase1TokenAuth: []parameters:- - $ref: '#/components/parameters/accessTokenID'+ - $ref: "#/components/parameters/accessTokenID"responses:- '204':+ "204":description: Access token deleted successfully- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"/api-keys:get:@@ -2718,18 +2760,18 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []responses:- '200':+ "200":description: Successfully returned all team API keyscontent:application/json:schema:type: arrayitems:- $ref: '#/components/schemas/TeamAPIKey'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/TeamAPIKey"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"post:description: Create a new team API keytags: [api-keys]@@ -2741,18 +2783,18 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/NewTeamAPIKey'+ $ref: "#/components/schemas/NewTeamAPIKey"responses:- '201':+ "201":description: Team API key created successfullycontent:application/json:schema:- $ref: '#/components/schemas/CreatedTeamAPIKey'- '401':- $ref: '#/components/responses/401'- '500':- $ref: '#/components/responses/500'+ $ref: "#/components/schemas/CreatedTeamAPIKey"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/api-keys/{apiKeyID}:patch:@@ -2762,22 +2804,22 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/apiKeyID'+ - $ref: "#/components/parameters/apiKeyID"requestBody:required: truecontent:application/json:schema:- $ref: '#/components/schemas/UpdateTeamAPIKey'+ $ref: "#/components/schemas/UpdateTeamAPIKey"responses:- '200':+ "200":description: Team API key updated successfully- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"delete:description: Delete a team API keytags: [api-keys]@@ -2785,13 +2827,13 @@ paths:- Supabase1TokenAuth: []Supabase2TeamAuth: []parameters:- - $ref: '#/components/parameters/apiKeyID'+ - $ref: "#/components/parameters/apiKeyID"responses:- '204':+ "204":description: Team API key deleted successfully- '401':- $ref: '#/components/responses/401'- '404':- $ref: '#/components/responses/404'- '500':- $ref: '#/components/responses/500'+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":+ $ref: "#/components/responses/500"diff --git a/spec/remove_extra_tags.py b/spec/remove_extra_tags.pyindex 387052d63..7292a8e60 100644--- a/spec/remove_extra_tags.py+++ b/spec/remove_extra_tags.py@@ -15,7 +15,14 @@ tags_to_keep = sys.argv[1:] if len(sys.argv) > 1 else Nonefiltered_paths = {}for path, methods in spec.get("paths", {}).items():+ # Store path-level parameters if they exist+ path_level_params = methods.get("parameters")+for method, operation in methods.items():+ # Skip path-level parameters key as it's not a method+ if method == "parameters":+ continue+if "tags" in operation:for tag in tags_to_keep:if tag in operation["tags"]:@@ -23,6 +30,9 @@ for path, methods in spec.get("paths", {}).items():filtered_paths[path][method] = operationelse:filtered_paths[path] = {method: operation}+ # Add path-level parameters if they exist+ if path_level_params:+ filtered_paths[path]["parameters"] = path_level_paramsbreak