@datalayer/agent-runtimes 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2025-2026 Datalayer, Inc.
3
+ # Distributed under the terms of the Modified BSD License.
4
+
5
+ """Generate example sandbox agent specs for each sandbox variant.
6
+
7
+ This keeps sandbox demonstration specs aligned with supported sandbox variants
8
+ so examples can offer a consistent variant picker.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ from pathlib import Path
15
+
16
+ VARIANTS: tuple[str, ...] = (
17
+ "eval",
18
+ "jupyter",
19
+ "docker",
20
+ "datalayer",
21
+ "colab",
22
+ "kaggle",
23
+ "monty",
24
+ "modal",
25
+ )
26
+
27
+
28
+ def _emoji_for_variant(variant: str) -> str:
29
+ mapping = {
30
+ "eval": "A",
31
+ "jupyter": "B",
32
+ "docker": "C",
33
+ "datalayer": "D",
34
+ "colab": "E",
35
+ "kaggle": "H",
36
+ "monty": "F",
37
+ "modal": "G",
38
+ }
39
+ return mapping.get(variant, "A")
40
+
41
+
42
+ def _content_for_variant(variant: str) -> str:
43
+ variant_title = variant.capitalize()
44
+ spec_id = f"example-sandbox-{variant}"
45
+ emoji = _emoji_for_variant(variant)
46
+
47
+ return f"""# Copyright (c) 2025-2026 Datalayer, Inc.
48
+ # Distributed under the terms of the Modified BSD License.
49
+
50
+ # Agent Specification: Sandbox Variant ({variant})
51
+
52
+ id: {spec_id}
53
+ version: 0.0.1
54
+ name: Example Sandbox {variant_title} Agent
55
+ description: >-
56
+ Demonstration agent configured to run codemode code execution with the
57
+ '{variant}' sandbox variant.
58
+
59
+ tags:
60
+ - sandbox
61
+ - codemode
62
+ - {variant}
63
+
64
+ enabled: true
65
+ model: "bedrock:us.anthropic.claude-opus-4-8"
66
+
67
+ sandbox_variant: {variant}
68
+ memory: ephemeral
69
+
70
+ mcp_servers:
71
+ - tavily:0.0.1
72
+
73
+ skills:
74
+ - events:0.0.1
75
+
76
+ tools:
77
+ - runtime-echo:0.0.1
78
+
79
+ frontend_tools:
80
+ - jupyter-notebook:0.0.1
81
+ - lexical-document:0.0.1
82
+
83
+ environment_name: ai-agents-env
84
+
85
+ icon: package
86
+ emoji: "{emoji}"
87
+ color: "#1F6FEB"
88
+
89
+ suggestions:
90
+ - "Use execute_code to print('sandbox variant: {variant}')"
91
+ - "Use execute_code to compute sum(i*i for i in range(20))"
92
+ - "Use execute_code to load pandas and build a small DataFrame"
93
+
94
+ welcome_message: >-
95
+ You're connected to the {variant} sandbox variant demo. Ask me to run
96
+ Python code and I will use execute_code in codemode.
97
+
98
+ system_prompt: >-
99
+ You are a sandbox-variant demonstration assistant. Prefer executing
100
+ Python code via execute_code for computations, data checks, and quick
101
+ experiments, then summarize results clearly.
102
+
103
+ system_prompt_codemode_addons: >-
104
+ Always use execute_code when the user requests calculations, scripts,
105
+ DataFrame operations, package checks, or shell-style diagnostics.
106
+
107
+ codemode:
108
+ enabled: true
109
+ token_reduction: "~80%"
110
+ speedup: "~1.5x"
111
+
112
+ welcome_notebook: null
113
+ welcome_document: null
114
+ trigger: null
115
+ """
116
+
117
+
118
+ def generate_specs(agents_dir: Path) -> int:
119
+ agents_dir.mkdir(parents=True, exist_ok=True)
120
+ count = 0
121
+ for variant in VARIANTS:
122
+ path = agents_dir / f"example-sandbox-{variant}.yaml"
123
+ path.write_text(_content_for_variant(variant), encoding="utf-8")
124
+ count += 1
125
+ return count
126
+
127
+
128
+ def main() -> None:
129
+ parser = argparse.ArgumentParser(
130
+ description="Generate example sandbox agentspec files by sandbox variant."
131
+ )
132
+ parser.add_argument(
133
+ "--agents-dir",
134
+ type=Path,
135
+ required=True,
136
+ help="Path to agentspecs/agents directory.",
137
+ )
138
+ args = parser.parse_args()
139
+
140
+ generated = generate_specs(args.agents_dir)
141
+ print(f"Generated {generated} sandbox variant agentspec files in {args.agents_dir}")
142
+
143
+
144
+ if __name__ == "__main__":
145
+ main()