agentos-sdk-python 1.1.1__py3-none-any.whl → 3.0.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/clients/discoverykit.py +1 -19
- agentos_sdk/clients/modelkit.py +3 -2
- agentos_sdk/clients/transferkit.py +0 -85
- agentos_sdk/normalizers.py +14 -13
- agentos_sdk/protocol.py +11 -7
- agentos_sdk/sdk.py +4 -71
- {agentos_sdk_python-1.1.1.dist-info → agentos_sdk_python-3.0.0.dist-info}/METADATA +25 -26
- {agentos_sdk_python-1.1.1.dist-info → agentos_sdk_python-3.0.0.dist-info}/RECORD +10 -10
- {agentos_sdk_python-1.1.1.dist-info → agentos_sdk_python-3.0.0.dist-info}/WHEEL +0 -0
- {agentos_sdk_python-1.1.1.dist-info → agentos_sdk_python-3.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
from typing import Any, AsyncGenerator
|
|
4
|
+
from typing import Any, AsyncGenerator
|
|
5
5
|
|
|
6
6
|
from agentos_sdk.transport import ApiClient, iter_sse
|
|
7
7
|
|
|
@@ -33,24 +33,6 @@ class DiscoveryKitClient:
|
|
|
33
33
|
headers=_auth(bearer_token),
|
|
34
34
|
)
|
|
35
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
36
|
getPeers = get_peers
|
|
55
37
|
streamPeers = stream_peers
|
|
56
38
|
getSelf = get_self
|
agentos_sdk/clients/modelkit.py
CHANGED
|
@@ -10,6 +10,7 @@ from agentos_sdk.normalizers import (
|
|
|
10
10
|
normalize_model_info,
|
|
11
11
|
serialize_chat_request,
|
|
12
12
|
)
|
|
13
|
+
from agentos_sdk.protocol import AppModelRegistration, AppModelUpdate
|
|
13
14
|
from agentos_sdk.transport import ApiClient, iter_sse
|
|
14
15
|
|
|
15
16
|
|
|
@@ -163,7 +164,7 @@ class ModelKitClient:
|
|
|
163
164
|
return [normalize_app_model(item) for item in data]
|
|
164
165
|
|
|
165
166
|
async def register_app_model(
|
|
166
|
-
self, bearer_token: str, request:
|
|
167
|
+
self, bearer_token: str, request: AppModelRegistration
|
|
167
168
|
) -> dict[str, Any]:
|
|
168
169
|
"""Register (or replace) an app model (``POST /modelkit/app-models``).
|
|
169
170
|
|
|
@@ -187,7 +188,7 @@ class ModelKitClient:
|
|
|
187
188
|
)
|
|
188
189
|
|
|
189
190
|
async def update_app_model(
|
|
190
|
-
self, bearer_token: str, model_id: str, request:
|
|
191
|
+
self, bearer_token: str, model_id: str, request: AppModelUpdate
|
|
191
192
|
) -> dict[str, Any]:
|
|
192
193
|
"""Partially update an owned app model (``PUT /modelkit/app-models/<id>``).
|
|
193
194
|
|
|
@@ -55,94 +55,9 @@ class TransferKitClient:
|
|
|
55
55
|
data={},
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
async def respond(
|
|
59
|
-
self, bearer_token: str, transfer_id: str, request: Mapping[str, Any]
|
|
60
|
-
) -> dict[str, Any]:
|
|
61
|
-
return await self.api_client.request(
|
|
62
|
-
f"/transferkit/transfers/{transfer_id}/respond",
|
|
63
|
-
method="POST",
|
|
64
|
-
headers=_auth(bearer_token),
|
|
65
|
-
data=dict(request),
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
async def receive_stream(
|
|
69
|
-
self, bearer_token: str
|
|
70
|
-
) -> AsyncGenerator[dict[str, Any], None]:
|
|
71
|
-
response = await self.api_client.request_stream(
|
|
72
|
-
"/transferkit/receive/stream",
|
|
73
|
-
headers=_auth(bearer_token),
|
|
74
|
-
)
|
|
75
|
-
async for event in iter_sse(response):
|
|
76
|
-
if event.data:
|
|
77
|
-
yield json.loads(event.data)
|
|
78
|
-
|
|
79
|
-
async def set_policy(
|
|
80
|
-
self, bearer_token: str, request: Mapping[str, Any]
|
|
81
|
-
) -> dict[str, Any]:
|
|
82
|
-
return await self.api_client.request(
|
|
83
|
-
"/transferkit/receive/policy",
|
|
84
|
-
method="PUT",
|
|
85
|
-
headers=_auth(bearer_token),
|
|
86
|
-
data=dict(request),
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
async def get_policy(self, bearer_token: str) -> dict[str, Any]:
|
|
90
|
-
return await self.api_client.request(
|
|
91
|
-
"/transferkit/receive/policy",
|
|
92
|
-
headers=_auth(bearer_token),
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
async def get_history(
|
|
96
|
-
self,
|
|
97
|
-
bearer_token: str,
|
|
98
|
-
*,
|
|
99
|
-
device_id: str | None = None,
|
|
100
|
-
user_id: str | None = None,
|
|
101
|
-
) -> list[dict[str, Any]]:
|
|
102
|
-
return await self.api_client.request(
|
|
103
|
-
"/transferkit/history",
|
|
104
|
-
query={"deviceId": device_id, "userId": user_id},
|
|
105
|
-
headers=_auth(bearer_token),
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
async def delete_history(
|
|
109
|
-
self,
|
|
110
|
-
bearer_token: str,
|
|
111
|
-
record_id: str,
|
|
112
|
-
*,
|
|
113
|
-
device_id: str | None = None,
|
|
114
|
-
user_id: str | None = None,
|
|
115
|
-
) -> dict[str, Any]:
|
|
116
|
-
return await self.api_client.request(
|
|
117
|
-
f"/transferkit/history/{record_id}",
|
|
118
|
-
method="DELETE",
|
|
119
|
-
query={"deviceId": device_id, "userId": user_id},
|
|
120
|
-
headers=_auth(bearer_token),
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
async def clear_history(
|
|
124
|
-
self,
|
|
125
|
-
bearer_token: str,
|
|
126
|
-
*,
|
|
127
|
-
device_id: str | None = None,
|
|
128
|
-
user_id: str | None = None,
|
|
129
|
-
) -> dict[str, Any]:
|
|
130
|
-
return await self.api_client.request(
|
|
131
|
-
"/transferkit/history",
|
|
132
|
-
method="DELETE",
|
|
133
|
-
query={"deviceId": device_id, "userId": user_id},
|
|
134
|
-
headers=_auth(bearer_token),
|
|
135
|
-
)
|
|
136
|
-
|
|
137
58
|
listTransfers = list_transfers
|
|
138
59
|
getStatus = get_status
|
|
139
60
|
streamProgress = stream_progress
|
|
140
|
-
receiveStream = receive_stream
|
|
141
|
-
setPolicy = set_policy
|
|
142
|
-
getPolicy = get_policy
|
|
143
|
-
getHistory = get_history
|
|
144
|
-
deleteHistory = delete_history
|
|
145
|
-
clearHistory = clear_history
|
|
146
61
|
|
|
147
62
|
|
|
148
63
|
def _auth(token: str) -> dict[str, str]:
|
agentos_sdk/normalizers.py
CHANGED
|
@@ -94,11 +94,11 @@ def normalize_agent_event_name(event_type: str) -> str:
|
|
|
94
94
|
return event_type
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
MODEL_TASKS = {"chat", "embedding", "asr", "tts", "decision"}
|
|
97
|
+
MODEL_TASKS = {"chat", "embedding", "asr", "tts", "decision", "image", "video", "music"}
|
|
98
98
|
MODALITIES = {"text", "image", "audio", "video", "decisions"}
|
|
99
99
|
MODEL_SOURCES = {"local", "platform", "custom", "app"}
|
|
100
|
-
# Wire values of ``billingType
|
|
101
|
-
MODEL_BILLING_TYPES = {"free"
|
|
100
|
+
# Wire values of ``billingType`` (the same as the AgentOS server's model list); parsing is case-insensitive.
|
|
101
|
+
MODEL_BILLING_TYPES = {"free", "in plan", "pay as you go", "benefit card"}
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def _model_task(value: Any) -> str:
|
|
@@ -166,19 +166,18 @@ def normalize_model_info(item: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
166
166
|
app_name = str(item["appName"]).strip() if item.get("appName") is not None else ""
|
|
167
167
|
if app_name:
|
|
168
168
|
result["appName"] = app_name
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
# The billing fields are the server's own: only system models carry them, and missing, blank and
|
|
170
|
+
# unknown values are dropped. Benefit card models keep source "platform"; ``cardName`` names the card.
|
|
171
|
+
billing_type = str(item.get("billingType") or "").strip().lower()
|
|
172
|
+
if billing_type in MODEL_BILLING_TYPES:
|
|
173
|
+
result["billingType"] = billing_type
|
|
174
|
+
for key in ("cardName", "planNameZh", "planNameEn"):
|
|
174
175
|
value = str(item[key]).strip() if item.get(key) is not None else ""
|
|
175
176
|
if value:
|
|
176
177
|
result[key] = value
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if billing_type:
|
|
181
|
-
result["billingType"] = billing_type
|
|
178
|
+
for key in ("endpointProtocol", "provider"):
|
|
179
|
+
if item.get(key):
|
|
180
|
+
result[key] = str(item[key])
|
|
182
181
|
return result
|
|
183
182
|
|
|
184
183
|
|
|
@@ -209,6 +208,8 @@ def normalize_app_model(item: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
209
208
|
result["contextWindowSize"] = item["contextWindowSize"]
|
|
210
209
|
if item.get("maxOutputTokens") is not None:
|
|
211
210
|
result["maxOutputTokens"] = item["maxOutputTokens"]
|
|
211
|
+
if item.get("endpointProtocol"):
|
|
212
|
+
result["endpointProtocol"] = str(item["endpointProtocol"])
|
|
212
213
|
return result
|
|
213
214
|
|
|
214
215
|
|
agentos_sdk/protocol.py
CHANGED
|
@@ -6,12 +6,12 @@ from typing_extensions import NotRequired
|
|
|
6
6
|
|
|
7
7
|
JsonMap = dict[str, Any]
|
|
8
8
|
ContentType = Literal["text", "imageUrl"]
|
|
9
|
-
ModelTask = Literal["chat", "embedding", "asr", "tts", "decision"]
|
|
9
|
+
ModelTask = Literal["chat", "embedding", "asr", "tts", "decision", "image", "video", "music"]
|
|
10
10
|
Modality = Literal["text", "image", "audio", "video", "decisions"]
|
|
11
11
|
# 模型互斥的来源,对应网关 ``/modelkit/models`` 的 ``source`` 字段。
|
|
12
12
|
ModelSource = Literal["local", "platform", "custom", "app"]
|
|
13
|
-
# 系统模型的计费类型,对应网关 ``/modelkit/models`` 的 ``billingType``
|
|
14
|
-
ModelBillingType = Literal["free", "plan", "
|
|
13
|
+
# 系统模型的计费类型,对应网关 ``/modelkit/models`` 的 ``billingType`` 字段,取值与服务端模型列表一致。
|
|
14
|
+
ModelBillingType = Literal["free", "in plan", "pay as you go", "benefit card"]
|
|
15
15
|
ToolContentState = Literal["unknown", "current", "updatePending", "broken"]
|
|
16
16
|
OpenToolRegistrationStatusValue = Literal["running", "starting", "notFound"]
|
|
17
17
|
HistoryTurnStatusValue = Literal["running", "done", "error", "stopped"]
|
|
@@ -321,6 +321,7 @@ class AppModel(TypedDict):
|
|
|
321
321
|
alias: str
|
|
322
322
|
description: str
|
|
323
323
|
task: ModelTask
|
|
324
|
+
endpointProtocol: NotRequired[str]
|
|
324
325
|
provider: str
|
|
325
326
|
input: list[Modality]
|
|
326
327
|
output: list[Modality]
|
|
@@ -338,7 +339,7 @@ class AppModel(TypedDict):
|
|
|
338
339
|
class AppModelRegistration(TypedDict):
|
|
339
340
|
"""Request body of ``register_app_model``.
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
``name``, ``endpointProtocol`` and ``baseUrl`` are required; unset fields are omitted so the server applies
|
|
342
343
|
its own defaults. The model id is not part of the request: the gateway
|
|
343
344
|
generates it and returns it in ``AppModelWriteResult.id``.
|
|
344
345
|
|
|
@@ -351,11 +352,13 @@ class AppModelRegistration(TypedDict):
|
|
|
351
352
|
alias: NotRequired[str]
|
|
352
353
|
description: NotRequired[str]
|
|
353
354
|
task: NotRequired[ModelTask]
|
|
355
|
+
endpointProtocol: str
|
|
356
|
+
adapterSettings: NotRequired[JsonMap]
|
|
354
357
|
provider: NotRequired[str]
|
|
355
358
|
input: NotRequired[list[Modality]]
|
|
356
359
|
output: NotRequired[list[Modality]]
|
|
357
360
|
capabilities: NotRequired[dict[str, bool]]
|
|
358
|
-
baseUrl:
|
|
361
|
+
baseUrl: str
|
|
359
362
|
apiKey: NotRequired[str]
|
|
360
363
|
contextWindowSize: NotRequired[int]
|
|
361
364
|
# Maximum number of tokens the model can generate in one response.
|
|
@@ -367,8 +370,7 @@ class AppModelRegistration(TypedDict):
|
|
|
367
370
|
class AppModelUpdate(TypedDict, total=False):
|
|
368
371
|
"""Request body of ``update_app_model`` (partial update).
|
|
369
372
|
|
|
370
|
-
|
|
371
|
-
non-empty. When ``task`` changes, input/output/capabilities that are not
|
|
373
|
+
Changing provider or origin clears the saved key unless a new one is supplied. When ``task`` changes, input/output/capabilities that are not
|
|
372
374
|
provided are reset to the new task's defaults. The owning ``appBundleId``
|
|
373
375
|
cannot be changed.
|
|
374
376
|
"""
|
|
@@ -377,6 +379,8 @@ class AppModelUpdate(TypedDict, total=False):
|
|
|
377
379
|
alias: str
|
|
378
380
|
description: str
|
|
379
381
|
task: ModelTask
|
|
382
|
+
endpointProtocol: str
|
|
383
|
+
adapterSettings: JsonMap
|
|
380
384
|
provider: str
|
|
381
385
|
input: list[Modality]
|
|
382
386
|
output: list[Modality]
|
agentos_sdk/sdk.py
CHANGED
|
@@ -33,6 +33,8 @@ from agentos_sdk.handlers import (
|
|
|
33
33
|
from agentos_sdk.protocol import (
|
|
34
34
|
AccessToken,
|
|
35
35
|
AgentMessage,
|
|
36
|
+
AppModelRegistration,
|
|
37
|
+
AppModelUpdate,
|
|
36
38
|
HarnessKitCommandReceipt,
|
|
37
39
|
HarnessKitEngineId,
|
|
38
40
|
HarnessKitEngineSwitchResult,
|
|
@@ -693,7 +695,7 @@ class ModelKitModule:
|
|
|
693
695
|
"""List models registered by apps. No app registration needed."""
|
|
694
696
|
return await self._sdk.modelKit.list_app_models()
|
|
695
697
|
|
|
696
|
-
async def register_app_model(self, *, request:
|
|
698
|
+
async def register_app_model(self, *, request: AppModelRegistration) -> dict[str, Any]:
|
|
697
699
|
"""Register (or replace) a model owned by the current app.
|
|
698
700
|
|
|
699
701
|
Requires ``register_bundle`` first; the app token is attached automatically.
|
|
@@ -703,7 +705,7 @@ class ModelKitModule:
|
|
|
703
705
|
)
|
|
704
706
|
|
|
705
707
|
async def update_app_model(
|
|
706
|
-
self, *, model_id: str, request:
|
|
708
|
+
self, *, model_id: str, request: AppModelUpdate
|
|
707
709
|
) -> dict[str, Any]:
|
|
708
710
|
"""Partially update a model owned by the current app."""
|
|
709
711
|
return await self._sdk._with_app_auth_retry(
|
|
@@ -843,16 +845,6 @@ class DiscoveryKitModule:
|
|
|
843
845
|
lambda token: self._sdk.discoveryKit.get_self(token)
|
|
844
846
|
)
|
|
845
847
|
|
|
846
|
-
async def register(self, request: Mapping[str, Any] | None = None) -> dict[str, Any]:
|
|
847
|
-
return await self._sdk._with_app_auth_retry(
|
|
848
|
-
lambda token: self._sdk.discoveryKit.register(token, request)
|
|
849
|
-
)
|
|
850
|
-
|
|
851
|
-
async def unregister(self) -> dict[str, Any]:
|
|
852
|
-
return await self._sdk._with_app_auth_retry(
|
|
853
|
-
lambda token: self._sdk.discoveryKit.unregister(token)
|
|
854
|
-
)
|
|
855
|
-
|
|
856
848
|
getPeers = get_peers
|
|
857
849
|
streamPeers = stream_peers
|
|
858
850
|
getSelf = get_self
|
|
@@ -889,68 +881,9 @@ class TransferKitModule:
|
|
|
889
881
|
lambda token: self._sdk.transferKit.cancel(token, transfer_id)
|
|
890
882
|
)
|
|
891
883
|
|
|
892
|
-
async def respond(
|
|
893
|
-
self, *, transfer_id: str, request: Mapping[str, Any]
|
|
894
|
-
) -> dict[str, Any]:
|
|
895
|
-
return await self._sdk._with_app_auth_retry(
|
|
896
|
-
lambda token: self._sdk.transferKit.respond(token, transfer_id, request)
|
|
897
|
-
)
|
|
898
|
-
|
|
899
|
-
async def receive_stream(self) -> AsyncGenerator[dict[str, Any], None]:
|
|
900
|
-
context = await self._sdk._require_auth_context()
|
|
901
|
-
async for event in self._sdk.transferKit.receive_stream(context.token):
|
|
902
|
-
yield event
|
|
903
|
-
|
|
904
|
-
async def set_policy(self, *, request: Mapping[str, Any]) -> dict[str, Any]:
|
|
905
|
-
return await self._sdk._with_app_auth_retry(
|
|
906
|
-
lambda token: self._sdk.transferKit.set_policy(token, request)
|
|
907
|
-
)
|
|
908
|
-
|
|
909
|
-
async def get_policy(self) -> dict[str, Any]:
|
|
910
|
-
return await self._sdk._with_app_auth_retry(
|
|
911
|
-
lambda token: self._sdk.transferKit.get_policy(token)
|
|
912
|
-
)
|
|
913
|
-
|
|
914
|
-
async def get_history(
|
|
915
|
-
self, *, device_id: str | None = None, user_id: str | None = None
|
|
916
|
-
) -> list[dict[str, Any]]:
|
|
917
|
-
return await self._sdk._with_app_auth_retry(
|
|
918
|
-
lambda token: self._sdk.transferKit.get_history(
|
|
919
|
-
token, device_id=device_id, user_id=user_id
|
|
920
|
-
)
|
|
921
|
-
)
|
|
922
|
-
|
|
923
|
-
async def delete_history(
|
|
924
|
-
self,
|
|
925
|
-
*,
|
|
926
|
-
record_id: str,
|
|
927
|
-
device_id: str | None = None,
|
|
928
|
-
user_id: str | None = None,
|
|
929
|
-
) -> dict[str, Any]:
|
|
930
|
-
return await self._sdk._with_app_auth_retry(
|
|
931
|
-
lambda token: self._sdk.transferKit.delete_history(
|
|
932
|
-
token, record_id, device_id=device_id, user_id=user_id
|
|
933
|
-
)
|
|
934
|
-
)
|
|
935
|
-
|
|
936
|
-
async def clear_history(
|
|
937
|
-
self, *, device_id: str | None = None, user_id: str | None = None
|
|
938
|
-
) -> dict[str, Any]:
|
|
939
|
-
return await self._sdk._with_app_auth_retry(
|
|
940
|
-
lambda token: self._sdk.transferKit.clear_history(
|
|
941
|
-
token, device_id=device_id, user_id=user_id
|
|
942
|
-
)
|
|
943
|
-
)
|
|
944
|
-
|
|
945
884
|
listTransfers = list_transfers
|
|
946
885
|
getStatus = get_status
|
|
947
886
|
streamProgress = stream_progress
|
|
948
|
-
receiveStream = receive_stream
|
|
949
|
-
setPolicy = set_policy
|
|
950
|
-
getPolicy = get_policy
|
|
951
|
-
getHistory = get_history
|
|
952
|
-
deleteHistory = delete_history
|
|
953
|
-
clearHistory = clear_history
|
|
954
887
|
|
|
955
888
|
|
|
956
889
|
class HarnessKitModule:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentos-sdk-python
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Async Python SDK for AgentOS APIs.
|
|
5
5
|
Project-URL: Repository, https://gitlab.litevar.com/litevar/agentos/agentos-sdk-python
|
|
6
6
|
Project-URL: Issues, https://gitlab.litevar.com/litevar/agentos/agentos-sdk-python/-/issues
|
|
@@ -262,7 +262,7 @@ Every model also carries `source`, the mutually exclusive origin of the model
|
|
|
262
262
|
| `source` | Meaning | Suggested group |
|
|
263
263
|
| --- | --- | --- |
|
|
264
264
|
| `"local"` | Runs on this device | Local Models |
|
|
265
|
-
| `"platform"` | Remote model provided by the AgentOS platform | Platform Models, plus `Remote · System · {
|
|
265
|
+
| `"platform"` | Remote model provided by the AgentOS platform | Platform Models, plus `Remote · System · {cardName}` for each benefit card (see below) |
|
|
266
266
|
| `"custom"` | Remote model configured by the user | Custom Models |
|
|
267
267
|
| `"app"` | Registered by a third-party app | `App · {appName}` (one group per app) |
|
|
268
268
|
|
|
@@ -282,24 +282,25 @@ one, so fall back to `appBundleId`). Against gateways that predate `source`, or
|
|
|
282
282
|
when it holds an unknown value, `source` is derived from the legacy flags with
|
|
283
283
|
the gateway's rules.
|
|
284
284
|
|
|
285
|
+
Platform models also carry the billing fields of the AgentOS server's model list,
|
|
286
|
+
with the same names and values: `billingType` (`"free"`, `"in plan"`,
|
|
287
|
+
`"pay as you go"` or `"benefit card"`), `cardName` (the benefit card, only for
|
|
288
|
+
`"benefit card"`) and `planNameZh` / `planNameEn` (the plan, only for `"free"` and
|
|
289
|
+
`"in plan"`). They are omitted when unknown and for local, custom and app models.
|
|
290
|
+
|
|
285
291
|
Models served through a benefit card keep `source` `"platform"` and their plain
|
|
286
|
-
`name` / `alias
|
|
287
|
-
`
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
each card as its own group:
|
|
292
|
+
`name` / `alias`. The same model can be listed once for the plan and once per
|
|
293
|
+
card, so tell them apart by `id`, `billingType` or `cardName`. `cardName` is the
|
|
294
|
+
only identifier of a card: show each card as its own group named after it, and
|
|
295
|
+
mark each billing type with a small badge:
|
|
291
296
|
|
|
292
297
|
```python
|
|
293
298
|
def system_group_title(model: dict) -> str:
|
|
294
|
-
if model.get("
|
|
295
|
-
return f"Remote · System · {model.get('
|
|
299
|
+
if model.get("billingType") == "benefit card":
|
|
300
|
+
return f"Remote · System · {model.get('cardName') or 'Benefit card'}"
|
|
296
301
|
return "Remote · System"
|
|
297
302
|
```
|
|
298
303
|
|
|
299
|
-
System models that are not benefit card models also report `billingType`
|
|
300
|
-
(`"free"`, `"plan"` or `"payAsYouGo"`; omitted when unknown and for every other
|
|
301
|
-
model), so a picker can mark each type with a small badge.
|
|
302
|
-
|
|
303
304
|
Model dicts also carry `contextWindowSize` and `maxOutputTokens` (the maximum
|
|
304
305
|
number of tokens the model can generate in one response); `maxOutputTokens` is
|
|
305
306
|
only present when the gateway reports it. Only chat models report
|
|
@@ -307,7 +308,7 @@ only present when the gateway reports it. Only chat models report
|
|
|
307
308
|
text, so the key is absent for them); a chat model that reports
|
|
308
309
|
`contextWindowSize` reports `maxOutputTokens` too, using the same number when it
|
|
309
310
|
has no value of its own. Apps can set both when registering a model
|
|
310
|
-
(`register_app_model(request={"name": ..., "contextWindowSize": 32768,
|
|
311
|
+
(`register_app_model(request={"name": ..., "baseUrl": ..., "endpointProtocol": ..., "contextWindowSize": 32768,
|
|
311
312
|
"maxOutputTokens": 4096})`); app model records report them back, and
|
|
312
313
|
`update_app_model` can change them.
|
|
313
314
|
|
|
@@ -387,11 +388,12 @@ your model. A `name` is unique within your app; different apps may use the same
|
|
|
387
388
|
async with AgentOSSDK() as sdk:
|
|
388
389
|
await sdk.agentos.register_bundle({"bundleId": "com.example.app"})
|
|
389
390
|
|
|
390
|
-
# Register (or replace) a model.
|
|
391
|
+
# Register (or replace) a model. The required fields are `name`, `baseUrl` and `endpointProtocol`.
|
|
391
392
|
result = await sdk.modelkit.register_app_model(
|
|
392
393
|
request={
|
|
393
394
|
"name": "my-router",
|
|
394
395
|
"task": "decision",
|
|
396
|
+
"endpointProtocol": "/v1/systemone",
|
|
395
397
|
"baseUrl": "http://127.0.0.1:9000",
|
|
396
398
|
"apiKey": "upstream-secret", # stored by the server, never returned
|
|
397
399
|
}
|
|
@@ -533,26 +535,29 @@ async with AgentOSSDK() as sdk:
|
|
|
533
535
|
|
|
534
536
|
## DiscoveryKit
|
|
535
537
|
|
|
538
|
+
Device-level discovery of nearby AgentOS devices. Apps can query nearby devices
|
|
539
|
+
and the current device's info; they are never advertised to other devices.
|
|
540
|
+
|
|
536
541
|
```python
|
|
537
542
|
async with AgentOSSDK() as sdk:
|
|
538
543
|
await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
|
|
539
544
|
|
|
540
|
-
await sdk.discoverykit.register({"receivePolicy": "autoAccept"})
|
|
541
|
-
|
|
542
545
|
peers = await sdk.discoverykit.get_peers()
|
|
543
546
|
print(peers)
|
|
544
547
|
|
|
545
548
|
self_info = await sdk.discoverykit.get_self()
|
|
546
|
-
print(self_info["deviceName"], self_info["
|
|
549
|
+
print(self_info["deviceName"], self_info["nearbyTransferEnabled"])
|
|
547
550
|
|
|
548
551
|
async for event in sdk.discoverykit.stream_peers():
|
|
549
552
|
print(event["type"], event["device"]["name"])
|
|
550
|
-
|
|
551
|
-
await sdk.discoverykit.unregister()
|
|
552
553
|
```
|
|
553
554
|
|
|
554
555
|
## TransferKit
|
|
555
556
|
|
|
557
|
+
Sends files to a nearby AgentOS device. The receiving device handles the
|
|
558
|
+
incoming files in its built-in nearby transfer UI. Apps can send files and track
|
|
559
|
+
or cancel their own transfers.
|
|
560
|
+
|
|
556
561
|
```python
|
|
557
562
|
async with AgentOSSDK() as sdk:
|
|
558
563
|
await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
|
|
@@ -573,12 +578,6 @@ async with AgentOSSDK() as sdk:
|
|
|
573
578
|
transfer_id=session["transferId"]
|
|
574
579
|
):
|
|
575
580
|
print(progress["progress"])
|
|
576
|
-
|
|
577
|
-
await sdk.transferkit.set_policy(request={"policy": "autoAccept"})
|
|
578
|
-
policy = await sdk.transferkit.get_policy()
|
|
579
|
-
|
|
580
|
-
history = await sdk.transferkit.get_history()
|
|
581
|
-
await sdk.transferkit.clear_history()
|
|
582
581
|
```
|
|
583
582
|
|
|
584
583
|
`list_tool()` is typed as `list[ToolDto]` and exposes daemon 0.5 metadata. Its
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
agentos_sdk/__init__.py,sha256=MDJAptD0tCknYk1HYeHKLtrrw3MnI8EVEp2qQoShlUo,3741
|
|
2
2
|
agentos_sdk/handlers.py,sha256=0LVT-IQlu-bNbRRxMp4Ei3nMwT1OuQcuvsF4cDQKYTM,3435
|
|
3
|
-
agentos_sdk/normalizers.py,sha256=
|
|
4
|
-
agentos_sdk/protocol.py,sha256=
|
|
3
|
+
agentos_sdk/normalizers.py,sha256=GNuiaV4ZRHLGx6ZpQvjW2dpa5qo35AgSJZnJtccnej0,8555
|
|
4
|
+
agentos_sdk/protocol.py,sha256=RkoDN4u0FLk9Pa28NjulweHSnCmzT_tfeUiWd5ogsM0,18495
|
|
5
5
|
agentos_sdk/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
6
|
-
agentos_sdk/sdk.py,sha256=
|
|
6
|
+
agentos_sdk/sdk.py,sha256=U2Y32KUMrMNt1SMqj7QAILMLfM56QysWMunZXJ6xmhs,41203
|
|
7
7
|
agentos_sdk/transport.py,sha256=MHUOdejTmTzJuS1TXYK4J5wd-LORyg54Q4FAfF3bm3w,6995
|
|
8
8
|
agentos_sdk/clients/__init__.py,sha256=rhutJ_h6C8omVjul-Z-JVS1xjf-Utfq295HGk2_SV2s,682
|
|
9
9
|
agentos_sdk/clients/agentkit.py,sha256=D83yaccY2W1ZgHb-XDTlAoqzSlx5Y47x2iVoFgdOZog,5991
|
|
10
10
|
agentos_sdk/clients/appkit.py,sha256=4j5VRuxiX88y7y2rlVQoJCRUxj2pKox9Tvt9zhBoCls,867
|
|
11
11
|
agentos_sdk/clients/authkit.py,sha256=9TYDwQUxO9HDS7qrTUMnSerlP2p-LCda3zmcLaA5UDg,1849
|
|
12
12
|
agentos_sdk/clients/cronkit.py,sha256=DiprjNhV3VEXXY5i15Ghgj5WgjHeoVfIEqs2zhuTRcY,4858
|
|
13
|
-
agentos_sdk/clients/discoverykit.py,sha256=
|
|
13
|
+
agentos_sdk/clients/discoverykit.py,sha256=KdkkCC_BNNbnqNfHBxe0UPuwMOHq7zyqZYNoOvm_nHk,1245
|
|
14
14
|
agentos_sdk/clients/harnesskit.py,sha256=Mp01B9ifyj9E4AE5DcugkDS6apM8xj9Cx5X2vOQTux8,15265
|
|
15
|
-
agentos_sdk/clients/modelkit.py,sha256=
|
|
15
|
+
agentos_sdk/clients/modelkit.py,sha256=wCExCcT0p-kYi-r5CRGBsFEPOfHIv0536eBEn3bPA2M,8908
|
|
16
16
|
agentos_sdk/clients/notifykit.py,sha256=YClS7r4TsndTLceAXD_EG-ZPr2E3_xd5r5pSzseTvGI,1795
|
|
17
17
|
agentos_sdk/clients/systemkit.py,sha256=1afOdJ_SUuMLP6b28FG2E2POf9OZisNHHBcm8YW0b6s,641
|
|
18
18
|
agentos_sdk/clients/toolkit.py,sha256=wWv4AJYlJfOrC9eVqxSAAYm-xYNca-lvT49SwxWp8VY,5277
|
|
19
|
-
agentos_sdk/clients/transferkit.py,sha256=
|
|
20
|
-
agentos_sdk_python-
|
|
21
|
-
agentos_sdk_python-
|
|
22
|
-
agentos_sdk_python-
|
|
23
|
-
agentos_sdk_python-
|
|
19
|
+
agentos_sdk/clients/transferkit.py,sha256=IpTy56HD-xv509w--SXfTQZgDKgKPFlWfrkaTdrCa14,1978
|
|
20
|
+
agentos_sdk_python-3.0.0.dist-info/METADATA,sha256=UqlbhL3f5sZJ6i-ldnRIxrjCLg6RZYHn36zp-c_gqdA,31918
|
|
21
|
+
agentos_sdk_python-3.0.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
22
|
+
agentos_sdk_python-3.0.0.dist-info/licenses/LICENSE,sha256=oarEto4UtUv6Y2Yeph34qL9zLBJEp0ZjuXrrwQ9uVdg,1064
|
|
23
|
+
agentos_sdk_python-3.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|