agentkit-sdk-python 0.7.13__py3-none-any.whl → 0.8.0__py3-none-any.whl
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.
- agentkit/toolkit/cli/sandbox/__init__.py +6 -6
- agentkit/toolkit/cli/sandbox/agentkit_client.py +23 -0
- agentkit/toolkit/cli/sandbox/cli.py +10 -6
- agentkit/toolkit/cli/sandbox/cli_config.py +139 -0
- agentkit/toolkit/cli/sandbox/cli_create.py +233 -171
- agentkit/toolkit/cli/sandbox/cli_delete.py +369 -0
- agentkit/toolkit/cli/sandbox/cli_exec.py +138 -136
- agentkit/toolkit/cli/sandbox/{cli_init_dockerfile.py → cli_init.py} +2 -5
- agentkit/toolkit/cli/sandbox/cli_invoke.py +94 -18
- agentkit/toolkit/cli/sandbox/cli_list.py +186 -0
- agentkit/toolkit/cli/sandbox/cli_model_login.py +29 -10
- agentkit/toolkit/cli/sandbox/cli_mount.py +73 -126
- agentkit/toolkit/cli/sandbox/cli_run.py +32 -23
- agentkit/toolkit/cli/sandbox/cli_scp.py +666 -0
- agentkit/toolkit/cli/sandbox/cli_shell.py +45 -28
- agentkit/toolkit/cli/sandbox/cli_web.py +29 -2
- agentkit/toolkit/cli/sandbox/config_store.py +698 -0
- agentkit/toolkit/cli/sandbox/git_config.py +1 -1
- agentkit/toolkit/cli/sandbox/sandbox_client.py +199 -76
- agentkit/toolkit/cli/sandbox/session_create.py +46 -7
- agentkit/toolkit/cli/sandbox/session_sync.py +2 -3
- agentkit/toolkit/cli/sandbox/tool_resolve.py +88 -1
- agentkit/toolkit/cli/tool_lookup.py +130 -0
- agentkit/toolkit/resources/templates/sandbox/Dockerfile.install-package +0 -1
- agentkit/toolkit/resources/templates/sandbox/Dockerfile.install-skills +0 -1
- agentkit/toolkit/resources/templates/sandbox/Dockerfile.web-server +0 -1
- agentkit/version.py +1 -1
- {agentkit_sdk_python-0.7.13.dist-info → agentkit_sdk_python-0.8.0.dist-info}/METADATA +1 -1
- {agentkit_sdk_python-0.7.13.dist-info → agentkit_sdk_python-0.8.0.dist-info}/RECORD +33 -29
- agentkit/toolkit/cli/sandbox/cli_file.py +0 -926
- agentkit/toolkit/cli/sandbox/cli_get.py +0 -104
- {agentkit_sdk_python-0.7.13.dist-info → agentkit_sdk_python-0.8.0.dist-info}/WHEEL +0 -0
- {agentkit_sdk_python-0.7.13.dist-info → agentkit_sdk_python-0.8.0.dist-info}/entry_points.txt +0 -0
- {agentkit_sdk_python-0.7.13.dist-info → agentkit_sdk_python-0.8.0.dist-info}/licenses/LICENSE +0 -0
- {agentkit_sdk_python-0.7.13.dist-info → agentkit_sdk_python-0.8.0.dist-info}/top_level.txt +0 -0
|
@@ -18,9 +18,9 @@ from agentkit.toolkit.cli.sandbox.cli import sandbox_app
|
|
|
18
18
|
from agentkit.toolkit.cli.sandbox.cli_build import build_command
|
|
19
19
|
from agentkit.toolkit.cli.sandbox.cli_create import create_command
|
|
20
20
|
from agentkit.toolkit.cli.sandbox.cli_exec import exec_command
|
|
21
|
-
from agentkit.toolkit.cli.sandbox.
|
|
22
|
-
from agentkit.toolkit.cli.sandbox.
|
|
23
|
-
from agentkit.toolkit.cli.sandbox.
|
|
21
|
+
from agentkit.toolkit.cli.sandbox.cli_scp import scp_command
|
|
22
|
+
from agentkit.toolkit.cli.sandbox.cli_list import list_command
|
|
23
|
+
from agentkit.toolkit.cli.sandbox.cli_init import init_command
|
|
24
24
|
from agentkit.toolkit.cli.sandbox.cli_run import run_command
|
|
25
25
|
from agentkit.toolkit.cli.sandbox.cli_shell import shell_command
|
|
26
26
|
from agentkit.toolkit.cli.sandbox.cli_web import web_command
|
|
@@ -29,9 +29,9 @@ __all__ = [
|
|
|
29
29
|
"build_command",
|
|
30
30
|
"create_command",
|
|
31
31
|
"exec_command",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
32
|
+
"scp_command",
|
|
33
|
+
"init_command",
|
|
34
|
+
"list_command",
|
|
35
35
|
"run_command",
|
|
36
36
|
"sandbox_app",
|
|
37
37
|
"shell_command",
|
|
@@ -28,6 +28,8 @@ from agentkit.sdk.tools.client import AgentkitToolsClient as _OpenapiAgentkitToo
|
|
|
28
28
|
from agentkit.sdk.tools.types import (
|
|
29
29
|
CreateSessionRequest,
|
|
30
30
|
CreateSessionResponse,
|
|
31
|
+
DeleteSessionRequest,
|
|
32
|
+
DeleteSessionResponse,
|
|
31
33
|
GetSessionRequest,
|
|
32
34
|
GetSessionResponse,
|
|
33
35
|
ListSessionsRequest,
|
|
@@ -128,6 +130,15 @@ class TipAgentkitToolsClient(_OpenapiAgentkitToolsClient):
|
|
|
128
130
|
if self.uses_tip_auth:
|
|
129
131
|
self._tip_session = requests.Session()
|
|
130
132
|
return
|
|
133
|
+
if not region:
|
|
134
|
+
try:
|
|
135
|
+
from agentkit.toolkit.cli.sandbox.config_store import (
|
|
136
|
+
config_default_str,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
region = config_default_str("region") or region
|
|
140
|
+
except Exception:
|
|
141
|
+
pass
|
|
131
142
|
|
|
132
143
|
super().__init__(
|
|
133
144
|
access_key=access_key,
|
|
@@ -216,6 +227,13 @@ class TipAgentkitToolsClient(_OpenapiAgentkitToolsClient):
|
|
|
216
227
|
response_type=ListSessionsResponse,
|
|
217
228
|
)
|
|
218
229
|
|
|
230
|
+
def delete_session(self, request: DeleteSessionRequest) -> DeleteSessionResponse:
|
|
231
|
+
return self._invoke_tip_api(
|
|
232
|
+
api_action="DeleteSession",
|
|
233
|
+
request=request,
|
|
234
|
+
response_type=DeleteSessionResponse,
|
|
235
|
+
)
|
|
236
|
+
|
|
219
237
|
def _raise_tip_unsupported(self, api_action: str) -> None:
|
|
220
238
|
raise Exception(
|
|
221
239
|
f"{api_action} is not available with TIP sandbox auth. "
|
|
@@ -238,6 +256,11 @@ class TipAgentkitToolsClient(_OpenapiAgentkitToolsClient):
|
|
|
238
256
|
self._raise_tip_unsupported("ListTools")
|
|
239
257
|
return super().list_tools(request)
|
|
240
258
|
|
|
259
|
+
def delete_tool(self, request: Any) -> Any:
|
|
260
|
+
if self.uses_tip_auth:
|
|
261
|
+
self._raise_tip_unsupported("DeleteTool")
|
|
262
|
+
return super().delete_tool(request)
|
|
263
|
+
|
|
241
264
|
|
|
242
265
|
def is_tip_agentkit_client(client: object) -> bool:
|
|
243
266
|
return bool(getattr(client, "uses_tip_auth", False))
|
|
@@ -19,12 +19,14 @@ from __future__ import annotations
|
|
|
19
19
|
import typer
|
|
20
20
|
|
|
21
21
|
from agentkit.toolkit.cli.sandbox.cli_build import build_command
|
|
22
|
+
from agentkit.toolkit.cli.sandbox.cli_config import config_command
|
|
22
23
|
from agentkit.toolkit.cli.sandbox.cli_create import create_command
|
|
24
|
+
from agentkit.toolkit.cli.sandbox.cli_delete import delete_command
|
|
23
25
|
from agentkit.toolkit.cli.sandbox.cli_exec import exec_command
|
|
24
|
-
from agentkit.toolkit.cli.sandbox.
|
|
25
|
-
from agentkit.toolkit.cli.sandbox.
|
|
26
|
+
from agentkit.toolkit.cli.sandbox.cli_scp import scp_command
|
|
27
|
+
from agentkit.toolkit.cli.sandbox.cli_list import list_command
|
|
26
28
|
from agentkit.toolkit.cli.sandbox.cli_invoke import invoke_command
|
|
27
|
-
from agentkit.toolkit.cli.sandbox.
|
|
29
|
+
from agentkit.toolkit.cli.sandbox.cli_init import init_command
|
|
28
30
|
from agentkit.toolkit.cli.sandbox.cli_model_login import codex_login_command
|
|
29
31
|
from agentkit.toolkit.cli.sandbox.cli_mount import mount_command
|
|
30
32
|
from agentkit.toolkit.cli.sandbox.cli_run import run_command
|
|
@@ -38,12 +40,13 @@ sandbox_app = typer.Typer(
|
|
|
38
40
|
)
|
|
39
41
|
|
|
40
42
|
sandbox_app.command(name="build")(build_command)
|
|
41
|
-
sandbox_app.command(name="init
|
|
43
|
+
sandbox_app.command(name="init")(init_command)
|
|
42
44
|
sandbox_app.command(
|
|
43
45
|
name="create",
|
|
44
46
|
context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
|
|
45
47
|
)(create_command)
|
|
46
|
-
sandbox_app.command(name="
|
|
48
|
+
sandbox_app.command(name="delete")(delete_command)
|
|
49
|
+
sandbox_app.command(name="list")(list_command)
|
|
47
50
|
sandbox_app.command(name="mount")(mount_command)
|
|
48
51
|
sandbox_app.command(
|
|
49
52
|
name="exec",
|
|
@@ -61,4 +64,5 @@ sandbox_app.command(
|
|
|
61
64
|
sandbox_app.command(name="web")(web_command)
|
|
62
65
|
sandbox_app.command(name="codex-login")(codex_login_command)
|
|
63
66
|
sandbox_app.command(name="model-login")(codex_login_command) # provider-agnostic alias
|
|
64
|
-
sandbox_app.
|
|
67
|
+
sandbox_app.command(name="config")(config_command)
|
|
68
|
+
sandbox_app.command(name="scp")(scp_command)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Config command for sandbox CLI."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import typer
|
|
20
|
+
import yaml
|
|
21
|
+
|
|
22
|
+
from agentkit.toolkit.cli.sandbox.config_store import (
|
|
23
|
+
SandboxConfigError,
|
|
24
|
+
configured_sandbox_config,
|
|
25
|
+
effective_sandbox_config,
|
|
26
|
+
ensure_sandbox_config_initialized,
|
|
27
|
+
get_sandbox_config_path,
|
|
28
|
+
redact_sandbox_config,
|
|
29
|
+
set_config_value,
|
|
30
|
+
unset_config_value,
|
|
31
|
+
write_sandbox_config,
|
|
32
|
+
)
|
|
33
|
+
from agentkit.toolkit.cli.sandbox.sandbox_client import error
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _dump_yaml(payload: object) -> None:
|
|
37
|
+
typer.echo(
|
|
38
|
+
yaml.safe_dump(
|
|
39
|
+
payload,
|
|
40
|
+
sort_keys=False,
|
|
41
|
+
allow_unicode=True,
|
|
42
|
+
).rstrip()
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _format_config_value(canonical: str, value: object) -> object:
|
|
47
|
+
if canonical in {"model-api-key", "websearch-apikey"}:
|
|
48
|
+
return "<redacted>"
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _parse_set_field(field: str) -> tuple[str, str]:
|
|
53
|
+
if "=" not in field:
|
|
54
|
+
raise SandboxConfigError("--set value must use KEY=VALUE format")
|
|
55
|
+
key, value = field.split("=", 1)
|
|
56
|
+
if not key.strip():
|
|
57
|
+
raise SandboxConfigError("--set key must not be empty")
|
|
58
|
+
return key, value
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _apply_config_options(
|
|
62
|
+
set_fields: list[str],
|
|
63
|
+
unset_keys: list[str],
|
|
64
|
+
list_config: bool,
|
|
65
|
+
) -> None:
|
|
66
|
+
path = get_sandbox_config_path()
|
|
67
|
+
data = None
|
|
68
|
+
wrote = False
|
|
69
|
+
|
|
70
|
+
if set_fields:
|
|
71
|
+
try:
|
|
72
|
+
path, data, _created = ensure_sandbox_config_initialized()
|
|
73
|
+
for field in set_fields:
|
|
74
|
+
key, value = _parse_set_field(field)
|
|
75
|
+
canonical, parsed = set_config_value(data, key, value)
|
|
76
|
+
typer.echo(
|
|
77
|
+
f"Set {canonical}: {_format_config_value(canonical, parsed)}"
|
|
78
|
+
)
|
|
79
|
+
except SandboxConfigError as exc:
|
|
80
|
+
error(str(exc))
|
|
81
|
+
|
|
82
|
+
if unset_keys:
|
|
83
|
+
if data is None:
|
|
84
|
+
if not path.exists():
|
|
85
|
+
error(f"Sandbox config not found: {path}")
|
|
86
|
+
try:
|
|
87
|
+
data = configured_sandbox_config()
|
|
88
|
+
except SandboxConfigError as exc:
|
|
89
|
+
error(str(exc))
|
|
90
|
+
try:
|
|
91
|
+
for key in unset_keys:
|
|
92
|
+
canonical, removed = unset_config_value(data, key)
|
|
93
|
+
if removed:
|
|
94
|
+
typer.echo(f"Unset {canonical}")
|
|
95
|
+
else:
|
|
96
|
+
typer.echo(f"{canonical} was not set")
|
|
97
|
+
except SandboxConfigError as exc:
|
|
98
|
+
error(str(exc))
|
|
99
|
+
|
|
100
|
+
if data is not None:
|
|
101
|
+
write_sandbox_config(data, path)
|
|
102
|
+
wrote = True
|
|
103
|
+
|
|
104
|
+
if wrote:
|
|
105
|
+
typer.echo(f"Wrote {path}")
|
|
106
|
+
|
|
107
|
+
if list_config:
|
|
108
|
+
try:
|
|
109
|
+
_dump_yaml(redact_sandbox_config(effective_sandbox_config()))
|
|
110
|
+
except SandboxConfigError as exc:
|
|
111
|
+
error(str(exc))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def config_command(
|
|
115
|
+
ctx: typer.Context,
|
|
116
|
+
set_fields: list[str] = typer.Option(
|
|
117
|
+
[],
|
|
118
|
+
"--set",
|
|
119
|
+
metavar="KEY=VALUE",
|
|
120
|
+
help="Set a config value. Can be repeated.",
|
|
121
|
+
),
|
|
122
|
+
unset_keys: list[str] = typer.Option(
|
|
123
|
+
[],
|
|
124
|
+
"--unset",
|
|
125
|
+
metavar="KEY",
|
|
126
|
+
help="Unset a config value. Can be repeated.",
|
|
127
|
+
),
|
|
128
|
+
list_config: bool = typer.Option(
|
|
129
|
+
False,
|
|
130
|
+
"--list",
|
|
131
|
+
help="List the current effective sandbox config.",
|
|
132
|
+
),
|
|
133
|
+
) -> None:
|
|
134
|
+
"""Configure default values for sandbox commands."""
|
|
135
|
+
has_options = bool(set_fields or unset_keys or list_config)
|
|
136
|
+
if not has_options:
|
|
137
|
+
typer.echo(ctx.get_help())
|
|
138
|
+
raise typer.Exit()
|
|
139
|
+
_apply_config_options(set_fields, unset_keys, list_config)
|