agentos-sdk-python 0.2.0__py3-none-any.whl → 1.1.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.
- agentos_sdk/__init__.py +80 -0
- agentos_sdk/clients/__init__.py +10 -0
- agentos_sdk/clients/agentkit.py +2 -37
- agentos_sdk/clients/authkit.py +60 -0
- agentos_sdk/clients/discoverykit.py +60 -0
- agentos_sdk/clients/harnesskit.py +384 -0
- agentos_sdk/clients/modelkit.py +98 -1
- agentos_sdk/clients/notifykit.py +47 -0
- agentos_sdk/clients/toolkit.py +8 -2
- agentos_sdk/clients/transferkit.py +149 -0
- agentos_sdk/normalizers.py +44 -14
- agentos_sdk/protocol.py +423 -8
- agentos_sdk/sdk.py +422 -32
- agentos_sdk/transport.py +9 -2
- agentos_sdk_python-1.1.0.dist-info/METADATA +677 -0
- agentos_sdk_python-1.1.0.dist-info/RECORD +23 -0
- agentos_sdk_python-0.2.0.dist-info/METADATA +0 -339
- agentos_sdk_python-0.2.0.dist-info/RECORD +0 -18
- {agentos_sdk_python-0.2.0.dist-info → agentos_sdk_python-1.1.0.dist-info}/WHEEL +0 -0
- {agentos_sdk_python-0.2.0.dist-info → agentos_sdk_python-1.1.0.dist-info}/licenses/LICENSE +0 -0
agentos_sdk/__init__.py
CHANGED
|
@@ -12,8 +12,46 @@ from .protocol import (
|
|
|
12
12
|
AppBundle,
|
|
13
13
|
AppEvent,
|
|
14
14
|
AppEventType,
|
|
15
|
+
AppModel,
|
|
16
|
+
AppModelCapabilities,
|
|
17
|
+
AppModelRegistration,
|
|
18
|
+
AppModelUpdate,
|
|
19
|
+
AppModelWriteResult,
|
|
20
|
+
DecisionAnswer,
|
|
21
|
+
DecisionChoiceQuestion,
|
|
22
|
+
DecisionNoulQuestion,
|
|
23
|
+
DecisionQuestion,
|
|
24
|
+
DecisionQuestionType,
|
|
25
|
+
DecisionRequest,
|
|
26
|
+
DecisionResponse,
|
|
27
|
+
DecisionScoreQuestion,
|
|
28
|
+
DecisionUsage,
|
|
29
|
+
HarnessKitCommand,
|
|
30
|
+
HarnessKitCommandReceipt,
|
|
31
|
+
HarnessKitEngineId,
|
|
32
|
+
HarnessKitEngineSwitchResult,
|
|
33
|
+
HarnessKitEvent,
|
|
34
|
+
HarnessKitHealth,
|
|
35
|
+
HarnessKitLlmConfig,
|
|
36
|
+
HarnessKitOperationalSnapshot,
|
|
37
|
+
HarnessKitRunAccepted,
|
|
38
|
+
HarnessKitRunError,
|
|
39
|
+
HarnessKitRunRequest,
|
|
40
|
+
HarnessKitRunResult,
|
|
41
|
+
HarnessKitRuntimeInfo,
|
|
42
|
+
HarnessKitRunUsage,
|
|
43
|
+
HarnessKitThreadDeleteResult,
|
|
44
|
+
HarnessKitThreadMessage,
|
|
45
|
+
HarnessKitThreadRenameResult,
|
|
46
|
+
HarnessKitThreadSnapshot,
|
|
15
47
|
HistoryTurnStatus,
|
|
16
48
|
HistoryTurnSummary,
|
|
49
|
+
Modality,
|
|
50
|
+
ModelTask,
|
|
51
|
+
NotifyKitEvent,
|
|
52
|
+
NotifyKitLevel,
|
|
53
|
+
NotifyKitNotification,
|
|
54
|
+
NotifyKitPublishResult,
|
|
17
55
|
OpenToolAvailability,
|
|
18
56
|
OpenToolProvisionFailure,
|
|
19
57
|
OpenToolProvisionSuccess,
|
|
@@ -22,7 +60,9 @@ from .protocol import (
|
|
|
22
60
|
OpenToolResolvedServer,
|
|
23
61
|
OpenToolServerDeclaration,
|
|
24
62
|
TaskStatus,
|
|
63
|
+
ToolContentState,
|
|
25
64
|
ToolDto,
|
|
65
|
+
ToolLifecycleEventDto,
|
|
26
66
|
ToolServerDto,
|
|
27
67
|
ToolStream,
|
|
28
68
|
ToolStreamEvent,
|
|
@@ -42,10 +82,48 @@ __all__ = [
|
|
|
42
82
|
"AppBundle",
|
|
43
83
|
"AppEvent",
|
|
44
84
|
"AppEventType",
|
|
85
|
+
"AppModel",
|
|
86
|
+
"AppModelCapabilities",
|
|
87
|
+
"AppModelRegistration",
|
|
88
|
+
"AppModelUpdate",
|
|
89
|
+
"AppModelWriteResult",
|
|
90
|
+
"DecisionAnswer",
|
|
91
|
+
"DecisionChoiceQuestion",
|
|
92
|
+
"DecisionNoulQuestion",
|
|
93
|
+
"DecisionQuestion",
|
|
94
|
+
"DecisionQuestionType",
|
|
95
|
+
"DecisionRequest",
|
|
96
|
+
"DecisionResponse",
|
|
97
|
+
"DecisionScoreQuestion",
|
|
98
|
+
"DecisionUsage",
|
|
45
99
|
"EventType",
|
|
46
100
|
"FunctionCallLifecycleError",
|
|
101
|
+
"HarnessKitCommand",
|
|
102
|
+
"HarnessKitCommandReceipt",
|
|
103
|
+
"HarnessKitEngineId",
|
|
104
|
+
"HarnessKitEngineSwitchResult",
|
|
105
|
+
"HarnessKitEvent",
|
|
106
|
+
"HarnessKitHealth",
|
|
107
|
+
"HarnessKitLlmConfig",
|
|
108
|
+
"HarnessKitOperationalSnapshot",
|
|
109
|
+
"HarnessKitRunAccepted",
|
|
110
|
+
"HarnessKitRunError",
|
|
111
|
+
"HarnessKitRunRequest",
|
|
112
|
+
"HarnessKitRunResult",
|
|
113
|
+
"HarnessKitRunUsage",
|
|
114
|
+
"HarnessKitRuntimeInfo",
|
|
115
|
+
"HarnessKitThreadDeleteResult",
|
|
116
|
+
"HarnessKitThreadMessage",
|
|
117
|
+
"HarnessKitThreadRenameResult",
|
|
118
|
+
"HarnessKitThreadSnapshot",
|
|
47
119
|
"HistoryTurnStatus",
|
|
48
120
|
"HistoryTurnSummary",
|
|
121
|
+
"Modality",
|
|
122
|
+
"ModelTask",
|
|
123
|
+
"NotifyKitEvent",
|
|
124
|
+
"NotifyKitLevel",
|
|
125
|
+
"NotifyKitNotification",
|
|
126
|
+
"NotifyKitPublishResult",
|
|
49
127
|
"OpenToolAvailability",
|
|
50
128
|
"OpenToolProvisionFailure",
|
|
51
129
|
"OpenToolProvisionSuccess",
|
|
@@ -55,7 +133,9 @@ __all__ = [
|
|
|
55
133
|
"OpenToolServerDeclaration",
|
|
56
134
|
"SseEvent",
|
|
57
135
|
"TaskStatus",
|
|
136
|
+
"ToolContentState",
|
|
58
137
|
"ToolDto",
|
|
138
|
+
"ToolLifecycleEventDto",
|
|
59
139
|
"ToolReturn",
|
|
60
140
|
"ToolServerDto",
|
|
61
141
|
"ToolStream",
|
agentos_sdk/clients/__init__.py
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
from .agentkit import AgentKitClient
|
|
2
2
|
from .appkit import AppKitClient
|
|
3
|
+
from .authkit import AuthKitClient
|
|
3
4
|
from .cronkit import CronKitClient
|
|
5
|
+
from .discoverykit import DiscoveryKitClient
|
|
6
|
+
from .harnesskit import HarnessKitClient
|
|
4
7
|
from .modelkit import ModelKitClient
|
|
8
|
+
from .notifykit import NotifyKitClient
|
|
5
9
|
from .systemkit import SystemKitClient
|
|
6
10
|
from .toolkit import ToolKitClient
|
|
11
|
+
from .transferkit import TransferKitClient
|
|
7
12
|
|
|
8
13
|
__all__ = [
|
|
9
14
|
"AgentKitClient",
|
|
10
15
|
"AppKitClient",
|
|
16
|
+
"AuthKitClient",
|
|
11
17
|
"CronKitClient",
|
|
18
|
+
"DiscoveryKitClient",
|
|
19
|
+
"HarnessKitClient",
|
|
12
20
|
"ModelKitClient",
|
|
21
|
+
"NotifyKitClient",
|
|
13
22
|
"SystemKitClient",
|
|
14
23
|
"ToolKitClient",
|
|
24
|
+
"TransferKitClient",
|
|
15
25
|
]
|
agentos_sdk/clients/agentkit.py
CHANGED
|
@@ -19,48 +19,17 @@ class AgentKitClient:
|
|
|
19
19
|
async def get_version(self, bearer_token: str) -> dict[str, Any]:
|
|
20
20
|
return await self.api_client.request("/agentkit/version", headers=_auth(bearer_token))
|
|
21
21
|
|
|
22
|
-
async def get_agent(self, bearer_token: str, agent_id: str) -> dict[str, Any]:
|
|
23
|
-
return await self.api_client.request(
|
|
24
|
-
"/agentkit/agent", query={"agentId": agent_id}, headers=_auth(bearer_token)
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
async def create_agent(self, bearer_token: str, agent: Mapping[str, Any]) -> dict[str, Any]:
|
|
28
|
-
return await self.api_client.request(
|
|
29
|
-
"/agentkit/agent/create",
|
|
30
|
-
method="POST",
|
|
31
|
-
headers=_auth(bearer_token),
|
|
32
|
-
data=dict(agent),
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
async def update_agent(
|
|
36
|
-
self, bearer_token: str, agent_id: str, agent: Mapping[str, Any]
|
|
37
|
-
) -> dict[str, Any]:
|
|
38
|
-
return await self.api_client.request(
|
|
39
|
-
"/agentkit/agent/update",
|
|
40
|
-
method="POST",
|
|
41
|
-
query={"agentId": agent_id},
|
|
42
|
-
headers=_auth(bearer_token),
|
|
43
|
-
data=dict(agent),
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
async def delete_agent(self, bearer_token: str, agent_id: str) -> dict[str, Any]:
|
|
47
|
-
return await self.api_client.request(
|
|
48
|
-
"/agentkit/agent/delete", query={"agentId": agent_id}, headers=_auth(bearer_token)
|
|
49
|
-
)
|
|
50
|
-
|
|
51
22
|
async def init_session(
|
|
52
23
|
self,
|
|
53
24
|
bearer_token: str,
|
|
54
25
|
*,
|
|
55
|
-
|
|
56
|
-
capability: Mapping[str, Any] | None = None,
|
|
26
|
+
capability: Mapping[str, Any],
|
|
57
27
|
) -> dict[str, Any]:
|
|
58
28
|
return await self.api_client.request(
|
|
59
29
|
"/agentkit/initSession",
|
|
60
30
|
method="POST",
|
|
61
|
-
query={"agentId": agent_id} if agent_id else None,
|
|
62
31
|
headers=_auth(bearer_token),
|
|
63
|
-
data=normalize_capability(capability)
|
|
32
|
+
data=normalize_capability(capability),
|
|
64
33
|
)
|
|
65
34
|
|
|
66
35
|
async def init_simple(
|
|
@@ -186,10 +155,6 @@ class AgentKitClient:
|
|
|
186
155
|
)
|
|
187
156
|
|
|
188
157
|
getVersion = get_version
|
|
189
|
-
getAgent = get_agent
|
|
190
|
-
createAgent = create_agent
|
|
191
|
-
updateAgent = update_agent
|
|
192
|
-
deleteAgent = delete_agent
|
|
193
158
|
initSession = init_session
|
|
194
159
|
initSimple = init_simple
|
|
195
160
|
chatSimple = chat_simple
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Mapping
|
|
4
|
+
|
|
5
|
+
from agentos_sdk.transport import ApiClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AuthKitClient:
|
|
9
|
+
def __init__(self, api_client: ApiClient | None = None) -> None:
|
|
10
|
+
self.api_client = api_client or ApiClient()
|
|
11
|
+
|
|
12
|
+
async def authorize(
|
|
13
|
+
self, bearer_token: str, request: Mapping[str, Any] | None = None
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
|
+
return await self.api_client.request(
|
|
16
|
+
"/authkit/authorize",
|
|
17
|
+
method="POST",
|
|
18
|
+
headers=_auth(bearer_token),
|
|
19
|
+
data=dict(request) if request else {},
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
async def get_status(self, bearer_token: str, request_id: str) -> dict[str, Any]:
|
|
23
|
+
return await self.api_client.request(
|
|
24
|
+
f"/authkit/authorize/{request_id}/status",
|
|
25
|
+
headers=_auth(bearer_token),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
async def exchange_token(
|
|
29
|
+
self, bearer_token: str, request: Mapping[str, Any]
|
|
30
|
+
) -> dict[str, Any]:
|
|
31
|
+
return await self.api_client.request(
|
|
32
|
+
"/authkit/token",
|
|
33
|
+
method="POST",
|
|
34
|
+
headers=_auth(bearer_token),
|
|
35
|
+
data=dict(request),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
async def get_user_info(self, access_token: str) -> dict[str, Any]:
|
|
39
|
+
return await self.api_client.request(
|
|
40
|
+
"/authkit/userinfo",
|
|
41
|
+
headers=_auth(access_token),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
async def revoke(
|
|
45
|
+
self, bearer_token: str, request: Mapping[str, Any] | None = None
|
|
46
|
+
) -> dict[str, Any]:
|
|
47
|
+
return await self.api_client.request(
|
|
48
|
+
"/authkit/revoke",
|
|
49
|
+
method="POST",
|
|
50
|
+
headers=_auth(bearer_token),
|
|
51
|
+
data=dict(request) if request else {},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
getStatus = get_status
|
|
55
|
+
exchangeToken = exchange_token
|
|
56
|
+
getUserInfo = get_user_info
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _auth(token: str) -> dict[str, str]:
|
|
60
|
+
return {"authorization": f"Bearer {token}"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any, AsyncGenerator, Mapping
|
|
5
|
+
|
|
6
|
+
from agentos_sdk.transport import ApiClient, iter_sse
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DiscoveryKitClient:
|
|
10
|
+
def __init__(self, api_client: ApiClient | None = None) -> None:
|
|
11
|
+
self.api_client = api_client or ApiClient()
|
|
12
|
+
|
|
13
|
+
async def get_peers(self, bearer_token: str) -> list[dict[str, Any]]:
|
|
14
|
+
return await self.api_client.request(
|
|
15
|
+
"/discoverykit/peers",
|
|
16
|
+
headers=_auth(bearer_token),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
async def stream_peers(
|
|
20
|
+
self, bearer_token: str
|
|
21
|
+
) -> AsyncGenerator[dict[str, Any], None]:
|
|
22
|
+
response = await self.api_client.request_stream(
|
|
23
|
+
"/discoverykit/peers/stream",
|
|
24
|
+
headers=_auth(bearer_token),
|
|
25
|
+
)
|
|
26
|
+
async for event in iter_sse(response):
|
|
27
|
+
if event.data:
|
|
28
|
+
yield json.loads(event.data)
|
|
29
|
+
|
|
30
|
+
async def get_self(self, bearer_token: str) -> dict[str, Any]:
|
|
31
|
+
return await self.api_client.request(
|
|
32
|
+
"/discoverykit/self",
|
|
33
|
+
headers=_auth(bearer_token),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
async def register(
|
|
37
|
+
self, bearer_token: str, request: Mapping[str, Any] | None = None
|
|
38
|
+
) -> dict[str, Any]:
|
|
39
|
+
return await self.api_client.request(
|
|
40
|
+
"/discoverykit/register",
|
|
41
|
+
method="POST",
|
|
42
|
+
headers=_auth(bearer_token),
|
|
43
|
+
data=dict(request) if request else {},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
async def unregister(self, bearer_token: str) -> dict[str, Any]:
|
|
47
|
+
return await self.api_client.request(
|
|
48
|
+
"/discoverykit/unregister",
|
|
49
|
+
method="POST",
|
|
50
|
+
headers=_auth(bearer_token),
|
|
51
|
+
data={},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
getPeers = get_peers
|
|
55
|
+
streamPeers = stream_peers
|
|
56
|
+
getSelf = get_self
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _auth(token: str) -> dict[str, str]:
|
|
60
|
+
return {"authorization": f"Bearer {token}"}
|