agentkit-sdk-python 0.1.5__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/__init__.py +23 -0
- agentkit/apps/__init__.py +58 -0
- agentkit/apps/a2a_app/__init__.py +13 -0
- agentkit/apps/a2a_app/a2a_app.py +134 -0
- agentkit/apps/a2a_app/telemetry.py +119 -0
- agentkit/apps/agent_server_app/__init__.py +13 -0
- agentkit/apps/agent_server_app/agent_server_app.py +85 -0
- agentkit/apps/base_app.py +20 -0
- agentkit/apps/mcp_app/__init__.py +13 -0
- agentkit/apps/mcp_app/mcp_app.py +150 -0
- agentkit/apps/mcp_app/telemetry.py +115 -0
- agentkit/apps/simple_app/__init__.py +13 -0
- agentkit/apps/simple_app/simple_app.py +94 -0
- agentkit/apps/simple_app/simple_app_handlers.py +325 -0
- agentkit/apps/simple_app/telemetry.py +124 -0
- agentkit/apps/utils.py +45 -0
- agentkit/client/__init__.py +26 -0
- agentkit/client/base_client.py +219 -0
- agentkit/identity/__init__.py +13 -0
- agentkit/identity/auth.py +70 -0
- agentkit/knowledge/__init__.py +47 -0
- agentkit/knowledge/knowledge.py +203 -0
- agentkit/knowledge/knowledge_all_types.py +191 -0
- agentkit/mcp/__init__.py +79 -0
- agentkit/mcp/mcp.py +294 -0
- agentkit/mcp/mcp_all_types.py +1212 -0
- agentkit/memory/__init__.py +71 -0
- agentkit/memory/memory.py +236 -0
- agentkit/memory/memory_all_types.py +358 -0
- agentkit/runtime/__init__.py +13 -0
- agentkit/runtime/runtime.py +191 -0
- agentkit/runtime/runtime_all_types.py +624 -0
- agentkit/runtime/runtime_v1.py +178 -0
- agentkit/runtime/types.py +188 -0
- agentkit/toolkit/__init__.py +13 -0
- agentkit/toolkit/cli/__init__.py +13 -0
- agentkit/toolkit/cli/__main__.py +7 -0
- agentkit/toolkit/cli/cli.py +97 -0
- agentkit/toolkit/cli/cli_build.py +53 -0
- agentkit/toolkit/cli/cli_config.py +170 -0
- agentkit/toolkit/cli/cli_deploy.py +52 -0
- agentkit/toolkit/cli/cli_destroy.py +53 -0
- agentkit/toolkit/cli/cli_init.py +364 -0
- agentkit/toolkit/cli/cli_invoke.py +168 -0
- agentkit/toolkit/cli/cli_launch.py +34 -0
- agentkit/toolkit/cli/cli_status.py +53 -0
- agentkit/toolkit/cli/cli_version.py +87 -0
- agentkit/toolkit/cli/utils.py +47 -0
- agentkit/toolkit/config/__init__.py +52 -0
- agentkit/toolkit/config/auto_prompt.py +752 -0
- agentkit/toolkit/config/build_config.py +28 -0
- agentkit/toolkit/config/common_config.py +18 -0
- agentkit/toolkit/config/config.py +306 -0
- agentkit/toolkit/config/config_handler.py +331 -0
- agentkit/toolkit/config/config_manager.py +48 -0
- agentkit/toolkit/config/config_validator.py +121 -0
- agentkit/toolkit/config/constants.py +18 -0
- agentkit/toolkit/config/dataclass_utils.py +153 -0
- agentkit/toolkit/config/deploy_config.py +1 -0
- agentkit/toolkit/config/utils.py +57 -0
- agentkit/toolkit/config/workflow_configs.py +149 -0
- agentkit/toolkit/consts.py +1 -0
- agentkit/toolkit/core/__init__.py +13 -0
- agentkit/toolkit/core/build/__init__.py +13 -0
- agentkit/toolkit/core/build/base_builder.py +6 -0
- agentkit/toolkit/core/build/cloud_builder.py +0 -0
- agentkit/toolkit/core/build/local_builder.py +0 -0
- agentkit/toolkit/core/deploy/__init__.py +13 -0
- agentkit/toolkit/core/deploy/base_deployer.py +6 -0
- agentkit/toolkit/core/deploy/cloud_deployer.py +0 -0
- agentkit/toolkit/core/deploy/local_deployer.py +0 -0
- agentkit/toolkit/integrations/__init__.py +17 -0
- agentkit/toolkit/integrations/builder/__init__.py +23 -0
- agentkit/toolkit/integrations/builder/base.py +59 -0
- agentkit/toolkit/integrations/builder/local_docker_builder.py +163 -0
- agentkit/toolkit/integrations/builder/ve_core_pipeline_builder.py +853 -0
- agentkit/toolkit/integrations/container.py +843 -0
- agentkit/toolkit/integrations/runner/__init__.py +26 -0
- agentkit/toolkit/integrations/runner/base.py +222 -0
- agentkit/toolkit/integrations/runner/local_docker_runner.py +407 -0
- agentkit/toolkit/integrations/runner/ve_agentkit_runner.py +665 -0
- agentkit/toolkit/integrations/services/__init__.py +26 -0
- agentkit/toolkit/integrations/services/cr_service.py +449 -0
- agentkit/toolkit/integrations/services/tos_service.py +291 -0
- agentkit/toolkit/integrations/utils/__init__.py +21 -0
- agentkit/toolkit/integrations/utils/project_archiver.py +276 -0
- agentkit/toolkit/integrations/ve_code_pipeline.py +643 -0
- agentkit/toolkit/integrations/ve_cr.py +385 -0
- agentkit/toolkit/integrations/ve_iam.py +210 -0
- agentkit/toolkit/resources/samples/basic.py +79 -0
- agentkit/toolkit/resources/samples/basic_stream.py +100 -0
- agentkit/toolkit/resources/samples/customer_support_assistant.py +3 -0
- agentkit/toolkit/resources/samples/financial_analyst.py +140 -0
- agentkit/toolkit/resources/samples/simple_a2a_veadk.py +32 -0
- agentkit/toolkit/resources/samples/simple_app_veadk.py +55 -0
- agentkit/toolkit/resources/samples/simple_mcp_veadk.py +50 -0
- agentkit/toolkit/resources/templates/Dockerfile.j2 +27 -0
- agentkit/toolkit/resources/templates/code-pipeline-tos-cr-step.j2 +52 -0
- agentkit/toolkit/workflows/__init__.py +27 -0
- agentkit/toolkit/workflows/base.py +87 -0
- agentkit/toolkit/workflows/hybird_local_ve_workflow_v1.py +381 -0
- agentkit/toolkit/workflows/local_workflow_v1.py +262 -0
- agentkit/toolkit/workflows/ve_agentkit_workflow.py +369 -0
- agentkit/tools/__init__.py +17 -0
- agentkit/tools/tools.py +106 -0
- agentkit/tools/tools_all_types.py +337 -0
- agentkit/utils/__init__.py +41 -0
- agentkit/utils/credential.py +44 -0
- agentkit/utils/logging_config.py +366 -0
- agentkit/utils/misc.py +70 -0
- agentkit/utils/request.py +59 -0
- agentkit/utils/template_utils.py +256 -0
- agentkit/utils/ve_sign.py +247 -0
- agentkit/version.py +15 -0
- agentkit_sdk_python-0.1.5.dist-info/METADATA +262 -0
- agentkit_sdk_python-0.1.5.dist-info/RECORD +120 -0
- agentkit_sdk_python-0.1.5.dist-info/WHEEL +5 -0
- agentkit_sdk_python-0.1.5.dist-info/entry_points.txt +2 -0
- agentkit_sdk_python-0.1.5.dist-info/licenses/LICENSE +201 -0
- agentkit_sdk_python-0.1.5.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Copyright (c) 2025 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
|
+
import json
|
|
16
|
+
from typing import Dict
|
|
17
|
+
|
|
18
|
+
from agentkit.client import BaseAgentkitClient
|
|
19
|
+
from agentkit.utils import get_logger
|
|
20
|
+
|
|
21
|
+
from agentkit.runtime.types import (
|
|
22
|
+
CreateAgentkitRuntimeRequest,
|
|
23
|
+
CreateAgentkitRuntimeResponse,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# 导入自动生成的类型(强类型版本)
|
|
27
|
+
from agentkit.runtime.runtime_all_types import (
|
|
28
|
+
GetAgentKitRuntimeRequest,
|
|
29
|
+
GetAgentKitRuntimeResponse,
|
|
30
|
+
ListAgentKitRuntimesRequest,
|
|
31
|
+
ListAgentKitRuntimesResponse,
|
|
32
|
+
UpdateAgentKitRuntimeRequest,
|
|
33
|
+
UpdateAgentKitRuntimeResponse,
|
|
34
|
+
DeleteAgentKitRuntimeRequest,
|
|
35
|
+
DeleteAgentKitRuntimeResponse,
|
|
36
|
+
ReleaseAgentKitRuntimeRequest,
|
|
37
|
+
ReleaseAgentKitRuntimeResponse,
|
|
38
|
+
GetAgentKitRuntimeVersionRequest,
|
|
39
|
+
GetAgentKitRuntimeVersionResponse,
|
|
40
|
+
ListAgentKitRuntimeVersionsRequest,
|
|
41
|
+
ListAgentKitRuntimeVersionsResponse,
|
|
42
|
+
GetAgentKitRuntimeCozeTokenRequest,
|
|
43
|
+
GetAgentKitRuntimeCozeTokenResponse,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
logger = get_logger(__name__)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AgentkitRuntime(BaseAgentkitClient):
|
|
50
|
+
"""AgentKit Runtime Management Service"""
|
|
51
|
+
|
|
52
|
+
# Define all API actions for this service
|
|
53
|
+
API_ACTIONS: Dict[str, str] = {
|
|
54
|
+
"CreateAgentKitRuntime": "CreateRuntime",
|
|
55
|
+
"GetAgentKitRuntime": "GetRuntime",
|
|
56
|
+
"UpdateAgentKitRuntime": "UpdateRuntime",
|
|
57
|
+
"DeleteAgentKitRuntime": "DeleteRuntime",
|
|
58
|
+
"ListAgentKitRuntimes": "ListRuntimes",
|
|
59
|
+
"ReleaseAgentKitRuntime": "ReleaseRuntime",
|
|
60
|
+
"GetAgentKitRuntimeVersion": "GetRuntimeVersion",
|
|
61
|
+
"ListAgentKitRuntimeVersions": "ListRuntimeVersions",
|
|
62
|
+
"GetAgentKitRuntimeCozeToken": "GetRuntimeCozeToken",
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
def __init__(
|
|
66
|
+
self,
|
|
67
|
+
access_key: str = "",
|
|
68
|
+
secret_key: str = "",
|
|
69
|
+
region: str = "",
|
|
70
|
+
session_token: str = "",
|
|
71
|
+
) -> None:
|
|
72
|
+
super().__init__(
|
|
73
|
+
access_key=access_key,
|
|
74
|
+
secret_key=secret_key,
|
|
75
|
+
region=region,
|
|
76
|
+
session_token=session_token,
|
|
77
|
+
service_name="runtime",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def create(
|
|
81
|
+
self, request: CreateAgentkitRuntimeRequest, params: dict
|
|
82
|
+
) -> CreateAgentkitRuntimeResponse:
|
|
83
|
+
"""Create a new AgentKit Runtime on Volcengine."""
|
|
84
|
+
res = self.json(
|
|
85
|
+
api="CreateAgentKitRuntime", params=params, body=request.model_dump()
|
|
86
|
+
)
|
|
87
|
+
if not res:
|
|
88
|
+
raise Exception("Empty response from create agentkit runtime request.")
|
|
89
|
+
|
|
90
|
+
response_data = json.loads(res)
|
|
91
|
+
return CreateAgentkitRuntimeResponse(**response_data.get('Result', {}))
|
|
92
|
+
|
|
93
|
+
def get(self, request: GetAgentKitRuntimeRequest) -> GetAgentKitRuntimeResponse:
|
|
94
|
+
"""Get details of a specific AgentKit Runtime from Volcengine."""
|
|
95
|
+
logger.debug("Get runtime request: %s", json.dumps(request.model_dump(by_alias=True)))
|
|
96
|
+
try:
|
|
97
|
+
resp = self._invoke_api(
|
|
98
|
+
api_action="GetAgentKitRuntime",
|
|
99
|
+
request=request,
|
|
100
|
+
response_type=GetAgentKitRuntimeResponse,
|
|
101
|
+
)
|
|
102
|
+
except Exception as e:
|
|
103
|
+
if "InvalidAgentKitRuntime.NotFound" in str(e):
|
|
104
|
+
return None
|
|
105
|
+
raise Exception(f"Failed to get agentkit runtime: {str(e)}")
|
|
106
|
+
return resp
|
|
107
|
+
|
|
108
|
+
def update(
|
|
109
|
+
self, request: UpdateAgentKitRuntimeRequest
|
|
110
|
+
) -> UpdateAgentKitRuntimeResponse:
|
|
111
|
+
"""Update an existing AgentKit Runtime on Volcengine."""
|
|
112
|
+
logger.debug("Update runtime request: %s", json.dumps(request.model_dump(by_alias=True, exclude_none=True)))
|
|
113
|
+
return self._invoke_api(
|
|
114
|
+
api_action="UpdateAgentKitRuntime",
|
|
115
|
+
request=request,
|
|
116
|
+
response_type=UpdateAgentKitRuntimeResponse,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def delete(
|
|
120
|
+
self, request: DeleteAgentKitRuntimeRequest
|
|
121
|
+
) -> DeleteAgentKitRuntimeResponse:
|
|
122
|
+
"""Delete an AgentKit Runtime on Volcengine."""
|
|
123
|
+
return self._invoke_api(
|
|
124
|
+
api_action="DeleteAgentKitRuntime",
|
|
125
|
+
request=request,
|
|
126
|
+
response_type=DeleteAgentKitRuntimeResponse,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
def list(
|
|
130
|
+
self, request: ListAgentKitRuntimesRequest
|
|
131
|
+
) -> ListAgentKitRuntimesResponse:
|
|
132
|
+
"""List all AgentKit Runtimes from Volcengine."""
|
|
133
|
+
return self._invoke_api(
|
|
134
|
+
api_action="ListAgentKitRuntimes",
|
|
135
|
+
request=request,
|
|
136
|
+
response_type=ListAgentKitRuntimesResponse,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def release(
|
|
140
|
+
self, request: ReleaseAgentKitRuntimeRequest
|
|
141
|
+
) -> ReleaseAgentKitRuntimeResponse:
|
|
142
|
+
"""Release an AgentKit Runtime on Volcengine."""
|
|
143
|
+
return self._invoke_api(
|
|
144
|
+
api_action="ReleaseAgentKitRuntime",
|
|
145
|
+
request=request,
|
|
146
|
+
response_type=ReleaseAgentKitRuntimeResponse,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
def get_version(
|
|
150
|
+
self, request: GetAgentKitRuntimeVersionRequest
|
|
151
|
+
) -> GetAgentKitRuntimeVersionResponse:
|
|
152
|
+
"""Get the version of a specific AgentKit Runtime."""
|
|
153
|
+
return self._invoke_api(
|
|
154
|
+
api_action="GetAgentKitRuntimeVersion",
|
|
155
|
+
request=request,
|
|
156
|
+
response_type=GetAgentKitRuntimeVersionResponse,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
def list_versions(
|
|
160
|
+
self, request: ListAgentKitRuntimeVersionsRequest
|
|
161
|
+
) -> ListAgentKitRuntimeVersionsResponse:
|
|
162
|
+
"""List all versions of a specific AgentKit Runtime."""
|
|
163
|
+
return self._invoke_api(
|
|
164
|
+
api_action="ListAgentKitRuntimeVersions",
|
|
165
|
+
request=request,
|
|
166
|
+
response_type=ListAgentKitRuntimeVersionsResponse,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
def get_coze_token(
|
|
170
|
+
self, request: GetAgentKitRuntimeCozeTokenRequest
|
|
171
|
+
) -> GetAgentKitRuntimeCozeTokenResponse:
|
|
172
|
+
"""Get Coze JWT token for a specific AgentKit Runtime."""
|
|
173
|
+
return self._invoke_api(
|
|
174
|
+
api_action="GetAgentKitRuntimeCozeToken",
|
|
175
|
+
request=request,
|
|
176
|
+
response_type=GetAgentKitRuntimeCozeTokenResponse,
|
|
177
|
+
)
|
|
178
|
+
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Copyright (c) 2025 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
|
+
from typing import Optional
|
|
16
|
+
|
|
17
|
+
from pydantic import BaseModel, Field
|
|
18
|
+
|
|
19
|
+
# ==================
|
|
20
|
+
# Atomic configs
|
|
21
|
+
# ==================
|
|
22
|
+
|
|
23
|
+
class KeyAuth_(BaseModel):
|
|
24
|
+
ApiKey: str = Field(alias="ApiKey")
|
|
25
|
+
ApiKeyName: str = Field(alias="ApiKeyName")
|
|
26
|
+
ApiKeyLocation: str = Field(alias="ApiKeyLocation")
|
|
27
|
+
|
|
28
|
+
class AuthorizerConfiguration(BaseModel):
|
|
29
|
+
KeyAuth: Optional[KeyAuth_] = Field(default=None, alias="KeyAuth")
|
|
30
|
+
|
|
31
|
+
model_config = {
|
|
32
|
+
"arbitrary_types_allowed": True
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# ==================
|
|
37
|
+
# API configs
|
|
38
|
+
# ==================
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CreateAgentkitRuntimeRequest(BaseModel):
|
|
42
|
+
name: str = Field(alias="Name")
|
|
43
|
+
description: Optional[str] = Field(alias="Description")
|
|
44
|
+
artifact_type: str = Field(alias="ArtifactType")
|
|
45
|
+
artifact_url: str = Field(alias="ArtifactUrl")
|
|
46
|
+
# command: str = Field(alias="Command")
|
|
47
|
+
project_name: str = Field(alias="ProjectName")
|
|
48
|
+
client_token: str = Field(alias="ClientToken")
|
|
49
|
+
role_name: str = Field(alias="RoleName")
|
|
50
|
+
authorizer_configuration: AuthorizerConfiguration = Field(alias="AuthorizerConfiguration")
|
|
51
|
+
envs: Optional[list[dict]] = Field(alias="Envs")
|
|
52
|
+
tags: Optional[list[dict]] = Field(alias="Tags")
|
|
53
|
+
enable_apmplus: Optional[bool] = Field(False, alias="ApmplusEnable")
|
|
54
|
+
|
|
55
|
+
model_config = {
|
|
56
|
+
"populate_by_name": True,
|
|
57
|
+
"arbitrary_types_allowed": True
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class CreateAgentkitRuntimeResponse(BaseModel):
|
|
62
|
+
id: str = Field(alias="RuntimeId")
|
|
63
|
+
model_config = {
|
|
64
|
+
"populate_by_name": True,
|
|
65
|
+
"arbitrary_types_allowed": True
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class GetAgentkitRuntimeRequest(BaseModel):
|
|
70
|
+
runtime_id: str = Field(alias="RuntimeId")
|
|
71
|
+
|
|
72
|
+
model_config = {
|
|
73
|
+
"populate_by_name": True,
|
|
74
|
+
"arbitrary_types_allowed": True
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# todo
|
|
79
|
+
class GetAgentkitRuntimeResponse(BaseModel):
|
|
80
|
+
runtime_id: str = Field(alias="RuntimeId")
|
|
81
|
+
name: str = Field(alias="Name")
|
|
82
|
+
description: Optional[str] = Field(alias="Description")
|
|
83
|
+
artifact_type: str = Field(alias="ArtifactType")
|
|
84
|
+
artifact_url: str = Field(alias="ArtifactUrl")
|
|
85
|
+
command: str = Field(alias="Command")
|
|
86
|
+
project_name: str = Field(alias="ProjectName")
|
|
87
|
+
status: str = Field(alias="Status")
|
|
88
|
+
created_at: str = Field(alias="CreatedAt")
|
|
89
|
+
updated_at: str = Field(alias="UpdatedAt")
|
|
90
|
+
role_name: str = Field(alias="RoleName")
|
|
91
|
+
endpoint: str = Field(alias="Endpoint")
|
|
92
|
+
authorizer_configuration: Optional[AuthorizerConfiguration] = Field(default=None, alias="AuthorizerConfiguration")
|
|
93
|
+
envs: Optional[list[dict]] = Field(alias="Envs")
|
|
94
|
+
tags: Optional[list[dict]] = Field(alias="Tags")
|
|
95
|
+
enable_apmplus: Optional[bool] = Field(alias="ApmplusEnable")
|
|
96
|
+
|
|
97
|
+
model_config = {
|
|
98
|
+
"populate_by_name": True,
|
|
99
|
+
"arbitrary_types_allowed": True
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class UpdateAgentkitRuntimeRequest(BaseModel):
|
|
104
|
+
description: Optional[str]
|
|
105
|
+
artifact_url: Optional[str]
|
|
106
|
+
role_name: Optional[str]
|
|
107
|
+
to_release: bool = False
|
|
108
|
+
client_token: str
|
|
109
|
+
model_config = {
|
|
110
|
+
"populate_by_name": True,
|
|
111
|
+
"arbitrary_types_allowed": True
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class UpdateAgentkitRuntimeResponse(BaseModel):
|
|
116
|
+
id: str
|
|
117
|
+
model_config = {
|
|
118
|
+
"populate_by_name": True,
|
|
119
|
+
"arbitrary_types_allowed": True
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class DeleteAgentkitRuntimeRequest(BaseModel):
|
|
124
|
+
id: str = Field(alias="RuntimeId")
|
|
125
|
+
client_token: Optional[str] = Field(default="",alias="ClientToken")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class DeleteAgentkitRuntimeResponse(BaseModel):
|
|
129
|
+
id: str = Field(alias="RuntimeId")
|
|
130
|
+
model_config = {
|
|
131
|
+
"populate_by_name": True,
|
|
132
|
+
"arbitrary_types_allowed": True
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ListAgentkitRuntimesRequest(BaseModel):
|
|
137
|
+
name_contains: Optional[str]
|
|
138
|
+
status: Optional[str]
|
|
139
|
+
creation_time_before: Optional[str]
|
|
140
|
+
creation_time_after: Optional[str]
|
|
141
|
+
last_update_time_before: Optional[str]
|
|
142
|
+
last_update_time_after: Optional[str]
|
|
143
|
+
next_token: Optional[str]
|
|
144
|
+
max_results: Optional[int]
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class ListAgentkitRuntimesResponse(BaseModel):
|
|
148
|
+
next_token: str
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class ReleaseAgentkitRuntimeRequest(BaseModel):
|
|
152
|
+
id: str
|
|
153
|
+
version_number: int
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class ReleaseAgentkitRuntimeResponse(BaseModel):
|
|
157
|
+
id: str
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class ListAgentkitRuntimeErrorDetailsRequest(BaseModel):
|
|
161
|
+
id: str
|
|
162
|
+
version_number: int
|
|
163
|
+
next_token: str
|
|
164
|
+
max_results: int
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ListAgentkitRuntimeErrorDetailsResponse(BaseModel):
|
|
168
|
+
next_token: str
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class GetAgentkitRuntimeVersionRequest(BaseModel):
|
|
172
|
+
id: str
|
|
173
|
+
version_number: int
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class GetAgentkitRuntimeVersionResponse(BaseModel):
|
|
177
|
+
id: str
|
|
178
|
+
name: str
|
|
179
|
+
description: str
|
|
180
|
+
version_number: int
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class ListAgentkitRuntimeVersionsRequest(BaseModel):
|
|
184
|
+
version: str
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class ListAgentkitRuntimeVersionsResponse(BaseModel):
|
|
188
|
+
version: str
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright (c) 2025 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.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright (c) 2025 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.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Copyright (c) 2025 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
|
+
"""AgentKit CLI - Main entry point for AgentKit Starter Toolkit."""
|
|
16
|
+
|
|
17
|
+
import logging
|
|
18
|
+
import typer
|
|
19
|
+
from rich.panel import Panel
|
|
20
|
+
from rich.console import Console
|
|
21
|
+
|
|
22
|
+
logging.basicConfig(level=logging.ERROR)
|
|
23
|
+
|
|
24
|
+
# Import command modules
|
|
25
|
+
from agentkit.toolkit.cli.cli_init import init_command, show_logo
|
|
26
|
+
from agentkit.toolkit.cli.cli_invoke import invoke_command
|
|
27
|
+
from agentkit.toolkit.cli.cli_config import config_command
|
|
28
|
+
from agentkit.toolkit.cli.cli_version import version_command, get_package_version
|
|
29
|
+
from agentkit.toolkit.cli.cli_build import build_command
|
|
30
|
+
from agentkit.toolkit.cli.cli_deploy import deploy_command
|
|
31
|
+
from agentkit.toolkit.cli.cli_launch import launch_command
|
|
32
|
+
from agentkit.toolkit.cli.cli_status import status_command
|
|
33
|
+
from agentkit.toolkit.cli.cli_destroy import destroy_command
|
|
34
|
+
|
|
35
|
+
# Note: 不要在文件开头导很重的包,不然会导致命令很卡(import包很慢)
|
|
36
|
+
|
|
37
|
+
app = typer.Typer(
|
|
38
|
+
name="agentkit",
|
|
39
|
+
help="AgentKit CLI - Deploy AI agents with ease",
|
|
40
|
+
add_completion=False,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
console = Console()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# get_package_version is now imported from cli_version
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def version_callback(value: bool):
|
|
50
|
+
"""Callback for --version flag."""
|
|
51
|
+
if value:
|
|
52
|
+
pkg_version = get_package_version()
|
|
53
|
+
console.print(Panel(
|
|
54
|
+
f"[bold cyan]AgentKit SDK[/bold cyan]\n[green]Version: {pkg_version}[/green]",
|
|
55
|
+
title="📦 Version Info",
|
|
56
|
+
border_style="cyan"
|
|
57
|
+
))
|
|
58
|
+
raise typer.Exit()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@app.callback(invoke_without_command=True)
|
|
62
|
+
def main(
|
|
63
|
+
ctx: typer.Context,
|
|
64
|
+
version_flag: bool = typer.Option(
|
|
65
|
+
False,
|
|
66
|
+
"--version",
|
|
67
|
+
"-v",
|
|
68
|
+
help="Show version information",
|
|
69
|
+
callback=version_callback,
|
|
70
|
+
is_eager=True
|
|
71
|
+
)
|
|
72
|
+
):
|
|
73
|
+
"""AgentKit CLI - Deploy AI agents with ease."""
|
|
74
|
+
# If no subcommand is provided, show logo
|
|
75
|
+
if ctx.invoked_subcommand is None:
|
|
76
|
+
show_logo()
|
|
77
|
+
pkg_version = get_package_version()
|
|
78
|
+
console.print(f"Version: {pkg_version}\n")
|
|
79
|
+
console.print("Run [bold]agentkit --help[/bold] to see available commands.\n")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# Register commands
|
|
83
|
+
app.command(name="init")(init_command)
|
|
84
|
+
app.command(name="invoke")(invoke_command)
|
|
85
|
+
app.command(name="config")(config_command)
|
|
86
|
+
app.command(name="version")(version_command)
|
|
87
|
+
app.command(name="build")(build_command)
|
|
88
|
+
app.command(name="deploy")(deploy_command)
|
|
89
|
+
app.command(name="launch")(launch_command)
|
|
90
|
+
app.command(name="status")(status_command)
|
|
91
|
+
app.command(name="destroy")(destroy_command)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
app()
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Copyright (c) 2025 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
|
+
"""AgentKit CLI - Build command implementation."""
|
|
16
|
+
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
import typer
|
|
19
|
+
from rich.console import Console
|
|
20
|
+
from agentkit.toolkit.config import get_config
|
|
21
|
+
|
|
22
|
+
# Note: 不要在文件开头导很重的包,不然会导致命令很卡(import包很慢)
|
|
23
|
+
|
|
24
|
+
console = Console()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def build_command(
|
|
28
|
+
config_file: Path = typer.Option("agentkit.yaml", help="Configuration file"),
|
|
29
|
+
platform: str = typer.Option("auto", help="Build platform"),
|
|
30
|
+
):
|
|
31
|
+
"""Build Docker image for the Agent."""
|
|
32
|
+
from agentkit.toolkit.workflows import WORKFLOW_REGISTRY, Workflow
|
|
33
|
+
console.print(f"[cyan]Building image with {config_file}[/cyan]")
|
|
34
|
+
|
|
35
|
+
config = get_config(config_path=config_file)
|
|
36
|
+
common_config = config.get_common_config()
|
|
37
|
+
|
|
38
|
+
if not common_config.entry_point:
|
|
39
|
+
console.print("[red]Entry point not configured, cannot build image[/red]")
|
|
40
|
+
raise typer.Exit(1)
|
|
41
|
+
|
|
42
|
+
workflow_name = common_config.launch_type
|
|
43
|
+
if workflow_name not in WORKFLOW_REGISTRY:
|
|
44
|
+
console.print(f"[red]Error: Unknown workflow type '{workflow_name}'[/red]")
|
|
45
|
+
raise typer.Exit(1)
|
|
46
|
+
|
|
47
|
+
workflow_config = config.get_workflow_config(workflow_name)
|
|
48
|
+
|
|
49
|
+
workflow:Workflow = WORKFLOW_REGISTRY[workflow_name]()
|
|
50
|
+
success = workflow.build(workflow_config)
|
|
51
|
+
|
|
52
|
+
if not success:
|
|
53
|
+
raise typer.Exit(1)
|