agentos-sdk-python 1.1.1__py3-none-any.whl → 2.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.
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json
4
- from typing import Any, AsyncGenerator, Mapping
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
@@ -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]:
@@ -97,8 +97,8 @@ def normalize_agent_event_name(event_type: str) -> str:
97
97
  MODEL_TASKS = {"chat", "embedding", "asr", "tts", "decision"}
98
98
  MODALITIES = {"text", "image", "audio", "video", "decisions"}
99
99
  MODEL_SOURCES = {"local", "platform", "custom", "app"}
100
- # Wire values of ``billingType``, keyed by their lower-case form so parsing is case-insensitive.
101
- MODEL_BILLING_TYPES = {"free": "free", "plan": "plan", "payasyougo": "payAsYouGo"}
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,15 @@ 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
- # Benefit card models keep source "platform" and are flagged by isBenefitCard;
170
- # the card fields are only present when set, blank values are dropped.
171
- if item.get("isBenefitCard") is True:
172
- result["isBenefitCard"] = True
173
- for key in ("benefitCardId", "benefitCardName"):
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
- # Only system models that are not benefit card models carry a billing type; missing,
178
- # blank and unknown values are dropped.
179
- billing_type = MODEL_BILLING_TYPES.get(str(item.get("billingType") or "").strip().lower())
180
- if billing_type:
181
- result["billingType"] = billing_type
182
178
  return result
183
179
 
184
180
 
agentos_sdk/protocol.py CHANGED
@@ -10,8 +10,8 @@ ModelTask = Literal["chat", "embedding", "asr", "tts", "decision"]
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", "payAsYouGo"]
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"]
agentos_sdk/sdk.py CHANGED
@@ -843,16 +843,6 @@ class DiscoveryKitModule:
843
843
  lambda token: self._sdk.discoveryKit.get_self(token)
844
844
  )
845
845
 
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
846
  getPeers = get_peers
857
847
  streamPeers = stream_peers
858
848
  getSelf = get_self
@@ -889,68 +879,9 @@ class TransferKitModule:
889
879
  lambda token: self._sdk.transferKit.cancel(token, transfer_id)
890
880
  )
891
881
 
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
882
  listTransfers = list_transfers
946
883
  getStatus = get_status
947
884
  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
885
 
955
886
 
956
887
  class HarnessKitModule:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentos-sdk-python
3
- Version: 1.1.1
3
+ Version: 2.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 · {benefitCardName}` for each benefit card (see below) |
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`, and additionally report `isBenefitCard`, `benefitCardId` and
287
- `benefitCardName` (`benefitCardName` is only present when the gateway reports
288
- one, so fall back to `benefitCardId`). The same model can be listed once for the
289
- plan and once per card, so tell them apart by `id` or the card fields, and show
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("isBenefitCard"):
295
- return f"Remote · System · {model.get('benefitCardName') or model.get('benefitCardId')}"
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
@@ -533,26 +534,29 @@ async with AgentOSSDK() as sdk:
533
534
 
534
535
  ## DiscoveryKit
535
536
 
537
+ Device-level discovery of nearby AgentOS devices. Apps can query nearby devices
538
+ and the current device's info; they are never advertised to other devices.
539
+
536
540
  ```python
537
541
  async with AgentOSSDK() as sdk:
538
542
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
539
543
 
540
- await sdk.discoverykit.register({"receivePolicy": "autoAccept"})
541
-
542
544
  peers = await sdk.discoverykit.get_peers()
543
545
  print(peers)
544
546
 
545
547
  self_info = await sdk.discoverykit.get_self()
546
- print(self_info["deviceName"], self_info["registered"])
548
+ print(self_info["deviceName"], self_info["nearbyTransferEnabled"])
547
549
 
548
550
  async for event in sdk.discoverykit.stream_peers():
549
551
  print(event["type"], event["device"]["name"])
550
-
551
- await sdk.discoverykit.unregister()
552
552
  ```
553
553
 
554
554
  ## TransferKit
555
555
 
556
+ Sends files to a nearby AgentOS device. The receiving device handles the
557
+ incoming files in its built-in nearby transfer UI. Apps can send files and track
558
+ or cancel their own transfers.
559
+
556
560
  ```python
557
561
  async with AgentOSSDK() as sdk:
558
562
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
@@ -573,12 +577,6 @@ async with AgentOSSDK() as sdk:
573
577
  transfer_id=session["transferId"]
574
578
  ):
575
579
  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
580
  ```
583
581
 
584
582
  `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=I5um-rNUyFVuzO-Sg1L90-SvWClDY4c2pQ7zCI4Del8,8466
4
- agentos_sdk/protocol.py,sha256=fg0dX9MiBVLu9WUSMKYMZsyXBFY7t7OoZpV43Bn6cbE,18229
3
+ agentos_sdk/normalizers.py,sha256=2vXefTdVPmhu2najeCmpAo17YrLBq4-4Y7ATt9ZaDmg,8308
4
+ agentos_sdk/protocol.py,sha256=Tq2YBqeYbvj-6lpY_AkeZGxgkZYHZJ36lH_fc33x0lw,18290
5
5
  agentos_sdk/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
6
- agentos_sdk/sdk.py,sha256=YTefFarYmH1059HfMLoz411SvKGGKSzrdogzAXJMfZM,43701
6
+ agentos_sdk/sdk.py,sha256=8Tw9X9LtU7o1HBhG2DIaEFJZV8jyhMFAMnjlHkoo2e0,41157
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=e_VZdGeRboP4rCegEiAnHPtw7lbbRJAwcdwN-RnoVt8,1846
13
+ agentos_sdk/clients/discoverykit.py,sha256=KdkkCC_BNNbnqNfHBxe0UPuwMOHq7zyqZYNoOvm_nHk,1245
14
14
  agentos_sdk/clients/harnesskit.py,sha256=Mp01B9ifyj9E4AE5DcugkDS6apM8xj9Cx5X2vOQTux8,15265
15
15
  agentos_sdk/clients/modelkit.py,sha256=ELy3-4_vS5RrKiMvE9sfOum6eNIPU49lafwP1s1Rv5Y,8838
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=8jGCZdwgJmz0hJ4Ox5sT1zIqbpzyA-GbzUrpNtwvT3M,4636
20
- agentos_sdk_python-1.1.1.dist-info/METADATA,sha256=ryIx4ltZJBdg4mVjWfvuI9uaKn3AGNhX0GOtjxIkMuo,31649
21
- agentos_sdk_python-1.1.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
22
- agentos_sdk_python-1.1.1.dist-info/licenses/LICENSE,sha256=oarEto4UtUv6Y2Yeph34qL9zLBJEp0ZjuXrrwQ9uVdg,1064
23
- agentos_sdk_python-1.1.1.dist-info/RECORD,,
19
+ agentos_sdk/clients/transferkit.py,sha256=IpTy56HD-xv509w--SXfTQZgDKgKPFlWfrkaTdrCa14,1978
20
+ agentos_sdk_python-2.0.0.dist-info/METADATA,sha256=s6renAJ2fPoZKoXOUbqR15UHwXZK6rhozVfDtaiaisw,31787
21
+ agentos_sdk_python-2.0.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
22
+ agentos_sdk_python-2.0.0.dist-info/licenses/LICENSE,sha256=oarEto4UtUv6Y2Yeph34qL9zLBJEp0ZjuXrrwQ9uVdg,1064
23
+ agentos_sdk_python-2.0.0.dist-info/RECORD,,