agentos-sdk-python 0.2.0__tar.gz → 1.0.0__tar.gz

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.
Files changed (34) hide show
  1. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/CHANGELOG.md +15 -0
  2. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/PKG-INFO +112 -10
  3. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/README-zh_CN.md +108 -7
  4. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/README.md +109 -7
  5. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/RELEASE.md +2 -2
  6. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/__init__.py +4 -0
  7. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/__init__.py +6 -0
  8. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/agentkit.py +2 -37
  9. agentos_sdk_python-1.0.0/agentos_sdk/clients/authkit.py +60 -0
  10. agentos_sdk_python-1.0.0/agentos_sdk/clients/discoverykit.py +60 -0
  11. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/toolkit.py +8 -2
  12. agentos_sdk_python-1.0.0/agentos_sdk/clients/transferkit.py +149 -0
  13. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/normalizers.py +0 -5
  14. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/protocol.py +14 -6
  15. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/sdk.py +172 -32
  16. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/transport.py +1 -0
  17. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/pyproject.toml +2 -2
  18. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_agentkit.py +55 -0
  19. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_normalizers.py +21 -0
  20. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_sdk_facade.py +39 -11
  21. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_toolkit.py +18 -3
  22. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/.gitignore +0 -0
  23. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/LICENSE +0 -0
  24. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/appkit.py +0 -0
  25. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/cronkit.py +0 -0
  26. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/modelkit.py +0 -0
  27. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/clients/systemkit.py +0 -0
  28. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/handlers.py +0 -0
  29. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/agentos_sdk/py.typed +0 -0
  30. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_cronkit.py +0 -0
  31. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_modelkit.py +0 -0
  32. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_protocol.py +0 -0
  33. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/test_transport.py +0 -0
  34. {agentos_sdk_python-0.2.0 → agentos_sdk_python-1.0.0}/tests/typecheck/toolkit_usage.py +0 -0
@@ -1,7 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0 - 2026-09-01
4
+
5
+ - Updated AgentKit for the LiteAgent SDK 0.4 gateway contract.
6
+ - Added support and coverage for recursively nested inline agents through
7
+ `Capability.subAgentList`.
8
+ - **Breaking:** Removed the AgentKit agent CRUD methods because the corresponding
9
+ gateway routes no longer exist.
10
+ - **Breaking:** `init_session` now requires a Capability request body and no
11
+ longer accepts the removed `agent_id` argument.
12
+ - Removed the obsolete `agentId` field from AgentKit message type declarations.
13
+
3
14
  ## 0.2.0 - 2026-07-17
4
15
 
16
+ - **Breaking:** Updated OpenTool server identities to daemon 0.5
17
+ `namespace` / `name` / `version` fields.
18
+ - Added public `ToolContentState` and `ToolLifecycleEventDto` types.
19
+ - Added `materializedArtifactDigest` and `contentState` ToolKit metadata.
5
20
  - Added OpenTool server declarations, registration statuses, and AppKit provisioning/availability events.
6
21
  - Added paginated AgentKit history, summary history, and process history APIs.
7
22
  - Added child-session routing and structured function-call lifecycle errors.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: agentos-sdk-python
3
- Version: 0.2.0
3
+ Version: 1.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
@@ -29,7 +29,7 @@ Requires-Dist: mypy<2,>=1.10; extra == 'dev'
29
29
  Requires-Dist: pytest-asyncio<1,>=0.23; extra == 'dev'
30
30
  Requires-Dist: pytest<9,>=8; extra == 'dev'
31
31
  Requires-Dist: ruff<1,>=0.5; extra == 'dev'
32
- Requires-Dist: twine<7,>=6; extra == 'dev'
32
+ Requires-Dist: twine<8,>=7; extra == 'dev'
33
33
  Description-Content-Type: text/markdown
34
34
 
35
35
  # AgentOS SDK for Python
@@ -75,7 +75,7 @@ async def main():
75
75
  print(tasks)
76
76
  ```
77
77
 
78
- `AgentOSSDK` also exposes TS-style camelCase aliases for common migration paths, such as `registerBundle`, `listTasks`, `chatSimple`, `listModels`, and `loadTool`.
78
+ `AgentOSSDK` also exposes TS-style camelCase aliases for common migration paths, such as `registerBundle`, `listTasks`, `chatSimple`, `listModels`, `loadTool`, `getPeers`, and `listTransfers`.
79
79
 
80
80
  ## Transport
81
81
 
@@ -95,7 +95,7 @@ Use `async with AgentOSSDK(...)` or call `await sdk.aclose()` when done.
95
95
 
96
96
  ## Token Handling
97
97
 
98
- `sdk.agentos.register_bundle(...)` stores the active app token. Protected facade methods in `sdk.agentkit` and `sdk.cronkit` use that token automatically.
98
+ `sdk.agentos.register_bundle(...)` stores the active app token. Protected facade methods in `sdk.agentkit`, `sdk.cronkit`, `sdk.authkit`, `sdk.discoverykit`, and `sdk.transferkit` use that token automatically.
99
99
 
100
100
  If a protected call fails with HTTP `401`, HTTP `403`, or recognizable invalid-token text, the SDK re-runs registration for the same bundle once and retries the call. The cached bundle is a defensive copy and retains its `opentoolServers` declarations during refresh.
101
101
 
@@ -163,7 +163,9 @@ class ChatHandler(AgentMessageHandler):
163
163
 
164
164
  async with AgentOSSDK() as sdk:
165
165
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
166
- session = await sdk.agentkit.init_session()
166
+ session = await sdk.agentkit.init_session(
167
+ capability={"systemPrompt": "You are a helpful assistant."}
168
+ )
167
169
  await sdk.agentkit.chat(
168
170
  session,
169
171
  {"content": [{"type": "text", "message": "Hello"}]},
@@ -185,7 +187,27 @@ messages = await sdk.agentkit.history_process(
185
187
 
186
188
  Message, chunk, and function-call handlers receive a child `sessionId` when the event supplies one, otherwise the root session ID. Function-call failures passed to `on_error` use `FunctionCallLifecycleError` with `stage` equal to `function_call_parse_failed`, `function_call_handler_failed`, or `function_call_callback_failed`.
187
189
 
188
- Direct AgentKit methods include `get_agent`, `create_agent`, `update_agent`, `delete_agent`, `init_session`, `init_simple`, `chat`, `chat_simple`, `history`, `history_summary`, `history_process`, `stop`, `clear`, `callback`, and `stream_callback`.
190
+ AgentKit 1.0.0 follows the session-only gateway contract. Agent CRUD methods and
191
+ the `init_session(agent_id=...)` form have been removed. Define sub-agents inline
192
+ with `Capability.subAgentList`:
193
+
194
+ ```python
195
+ session = await sdk.agentkit.init_session(
196
+ capability={
197
+ "systemPrompt": "Coordinate the task.",
198
+ "subAgentList": [
199
+ {
200
+ "name": "researcher",
201
+ "capability": {"systemPrompt": "Research the requested topic."},
202
+ }
203
+ ],
204
+ }
205
+ )
206
+ ```
207
+
208
+ Direct AgentKit methods include `init_session`, `init_simple`, `chat`,
209
+ `chat_simple`, `history`, `history_summary`, `history_process`, `stop`, `clear`,
210
+ `callback`, and `stream_callback`.
189
211
 
190
212
  ## CronKit
191
213
 
@@ -287,14 +309,16 @@ async with AgentOSSDK() as sdk:
287
309
  )
288
310
  print(result)
289
311
 
290
- async for event in sdk.toolkit.subscribe_tool_events("daemon-api-key"):
291
- print(event)
292
312
  ```
293
313
 
294
314
  `registration["opentoolServers"]` also contains the resolved `id` when its
295
315
  status is `running`; the example uses `list_tool()` so it can select the running
296
316
  tool by `server.name`.
297
317
 
318
+ `subscribe_tool_events()` is retained for legacy direct-daemon deployments.
319
+ The deprecated `/toolkit/events` endpoint is not exposed by the AgentOS API
320
+ gateway.
321
+
298
322
  `stream_call()` is only appropriate for functions whose tool server explicitly
299
323
  supports `streamCall`. For such a function, retain the stream and close it when
300
324
  consumer work ends early:
@@ -317,6 +341,81 @@ token returned by `register_bundle()` and refresh it once after a 401/403
317
341
  response. `load_tool()` returns an `OpenToolDefinition` wrapper that preserves
318
342
  the raw JSON definition.
319
343
 
344
+ ## AuthKit
345
+
346
+ ```python
347
+ async with AgentOSSDK() as sdk:
348
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
349
+
350
+ auth = await sdk.authkit.authorize({"scopes": ["profile"], "appName": "Demo"})
351
+ print(auth["requestId"], auth["status"])
352
+
353
+ status = await sdk.authkit.get_status(request_id=auth["requestId"])
354
+ if status.get("authCode"):
355
+ token_resp = await sdk.authkit.exchange_token(
356
+ request={"authCode": status["authCode"]}
357
+ )
358
+ user = await sdk.authkit.get_user_info(access_token=token_resp["accessToken"])
359
+ print(user["name"])
360
+
361
+ await sdk.authkit.revoke({"bundleId": "com.other.app"})
362
+ ```
363
+
364
+ ## DiscoveryKit
365
+
366
+ ```python
367
+ async with AgentOSSDK() as sdk:
368
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
369
+
370
+ await sdk.discoverykit.register({"receivePolicy": "autoAccept"})
371
+
372
+ peers = await sdk.discoverykit.get_peers()
373
+ print(peers)
374
+
375
+ self_info = await sdk.discoverykit.get_self()
376
+ print(self_info["deviceName"], self_info["registered"])
377
+
378
+ async for event in sdk.discoverykit.stream_peers():
379
+ print(event["type"], event["device"]["name"])
380
+
381
+ await sdk.discoverykit.unregister()
382
+ ```
383
+
384
+ ## TransferKit
385
+
386
+ ```python
387
+ async with AgentOSSDK() as sdk:
388
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
389
+
390
+ session = await sdk.transferkit.send(
391
+ request={
392
+ "targetDeviceId": "device-abc",
393
+ "files": [
394
+ {"fileName": "photo.jpg", "size": 1024, "filePath": "/tmp/photo.jpg"}
395
+ ],
396
+ }
397
+ )
398
+ print(session["transferId"], session["state"])
399
+
400
+ transfers = await sdk.transferkit.list_transfers()
401
+
402
+ async for progress in sdk.transferkit.stream_progress(
403
+ transfer_id=session["transferId"]
404
+ ):
405
+ print(progress["progress"])
406
+
407
+ await sdk.transferkit.set_policy(request={"policy": "autoAccept"})
408
+ policy = await sdk.transferkit.get_policy()
409
+
410
+ history = await sdk.transferkit.get_history()
411
+ await sdk.transferkit.clear_history()
412
+ ```
413
+
414
+ `list_tool()` is typed as `list[ToolDto]` and exposes daemon 0.5 metadata. Its
415
+ optional `server` identity uses `namespace`, `name`, and `version`;
416
+ `materializedArtifactDigest` identifies installed content when available, and
417
+ `contentState` reports whether it is current.
418
+
320
419
  ## Direct Clients
321
420
 
322
421
  The low-level clients are available for explicit-token or custom transport usage:
@@ -327,7 +426,10 @@ from agentos_sdk.transport import ApiClient
327
426
 
328
427
  api = ApiClient(base_url="http://localhost:8888")
329
428
  agentkit = AgentKitClient(api)
330
- agent = await agentkit.get_agent("bearer-token", "agent-id")
429
+ session = await agentkit.init_session(
430
+ "bearer-token",
431
+ capability={"systemPrompt": "You are a helpful assistant."},
432
+ )
331
433
  ```
332
434
 
333
435
  ## Development
@@ -41,7 +41,7 @@ async def main():
41
41
  print(tasks)
42
42
  ```
43
43
 
44
- SDK 默认使用 snake_case 方法名,同时为常用迁移场景提供 camelCase 别名,例如 `registerBundle`、`listTasks`、`chatSimple`、`listModels` 和 `loadTool`。
44
+ SDK 默认使用 snake_case 方法名,同时为常用迁移场景提供 camelCase 别名,例如 `registerBundle`、`listTasks`、`chatSimple`、`listModels`、`loadTool`、`getPeers` 和 `listTransfers`。
45
45
 
46
46
  ## 传输层
47
47
 
@@ -61,7 +61,7 @@ sdk = AgentOSSDK(
61
61
 
62
62
  ## Token 处理
63
63
 
64
- `sdk.agentos.register_bundle(...)` 会保存当前 app token。`sdk.agentkit` 和 `sdk.cronkit` 下的受保护 facade 方法会自动使用该 token。
64
+ `sdk.agentos.register_bundle(...)` 会保存当前 app token。`sdk.agentkit`、`sdk.cronkit`、`sdk.authkit`、`sdk.discoverykit` 和 `sdk.transferkit` 下的受保护 facade 方法会自动使用该 token。
65
65
 
66
66
  如果请求遇到 HTTP `401`、HTTP `403`,或响应文本包含可识别的 token 失效信息,SDK 会使用同一个 bundle 重新注册一次,并重试当前请求一次。SDK 会保存 bundle 的防御性副本,因此刷新 token 时会保留原始 `opentoolServers` 声明。
67
67
 
@@ -129,7 +129,9 @@ class ChatHandler(AgentMessageHandler):
129
129
 
130
130
  async with AgentOSSDK() as sdk:
131
131
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
132
- session = await sdk.agentkit.init_session()
132
+ session = await sdk.agentkit.init_session(
133
+ capability={"systemPrompt": "你是一个乐于助人的助手。"}
134
+ )
133
135
  await sdk.agentkit.chat(
134
136
  session,
135
137
  {"content": [{"type": "text", "message": "Hello"}]},
@@ -151,7 +153,27 @@ messages = await sdk.agentkit.history_process(
151
153
 
152
154
  message、chunk 和 function-call handler 会优先收到事件中的子 `sessionId`,缺失时回退到根 session。function-call 错误会通过 `FunctionCallLifecycleError` 传给 `on_error`,其 `stage` 为 `function_call_parse_failed`、`function_call_handler_failed` 或 `function_call_callback_failed`。
153
155
 
154
- AgentKit facade 包含 `get_agent`、`create_agent`、`update_agent`、`delete_agent`、`init_session`、`init_simple`、`chat`、`chat_simple`、`history`、`history_summary`、`history_process`、`stop`、`clear`、`callback` 和 `stream_callback`。
156
+ AgentKit 1.0.0 对齐了仅以 session 为中心的网关契约。Agent CRUD 方法和
157
+ `init_session(agent_id=...)` 调用方式已移除。子智能体应通过
158
+ `Capability.subAgentList` 内联定义:
159
+
160
+ ```python
161
+ session = await sdk.agentkit.init_session(
162
+ capability={
163
+ "systemPrompt": "协调任务。",
164
+ "subAgentList": [
165
+ {
166
+ "name": "researcher",
167
+ "capability": {"systemPrompt": "研究用户指定的主题。"},
168
+ }
169
+ ],
170
+ }
171
+ )
172
+ ```
173
+
174
+ AgentKit facade 包含 `init_session`、`init_simple`、`chat`、`chat_simple`、
175
+ `history`、`history_summary`、`history_process`、`stop`、`clear`、`callback`
176
+ 和 `stream_callback`。
155
177
 
156
178
  ## CronKit
157
179
 
@@ -253,13 +275,14 @@ async with AgentOSSDK() as sdk:
253
275
  )
254
276
  print(result)
255
277
 
256
- async for event in sdk.toolkit.subscribe_tool_events("daemon-api-key"):
257
- print(event)
258
278
  ```
259
279
 
260
280
  当 `registration["opentoolServers"]` 中的记录状态为 `running` 时,它也会包含
261
281
  解析后的 `id`;上例使用 `list_tool()`,以便按 `server.name` 选择正在运行的工具。
262
282
 
283
+ `subscribe_tool_events()` 仅为旧版直连 daemon 的部署方式保留。AgentOS API
284
+ 网关不公开已弃用的 `/toolkit/events` 端点。
285
+
263
286
  `stream_call()` 只适用于工具服务明确支持 `streamCall` 的函数。调用这类函数时,
264
287
  应保留 stream,并在 consumer 提前结束时将其关闭:
265
288
 
@@ -280,6 +303,81 @@ async def consume_streaming_function(sdk, streaming_tool_id):
280
303
  `register_bundle()` 返回的 Bearer token,遇到 401/403 时会刷新 token 并重试
281
304
  一次。`load_tool()` 返回 `OpenToolDefinition` 包装对象,用于保留原始 JSON 定义。
282
305
 
306
+ ## AuthKit
307
+
308
+ ```python
309
+ async with AgentOSSDK() as sdk:
310
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
311
+
312
+ auth = await sdk.authkit.authorize({"scopes": ["profile"], "appName": "Demo"})
313
+ print(auth["requestId"], auth["status"])
314
+
315
+ status = await sdk.authkit.get_status(request_id=auth["requestId"])
316
+ if status.get("authCode"):
317
+ token_resp = await sdk.authkit.exchange_token(
318
+ request={"authCode": status["authCode"]}
319
+ )
320
+ user = await sdk.authkit.get_user_info(access_token=token_resp["accessToken"])
321
+ print(user["name"])
322
+
323
+ await sdk.authkit.revoke({"bundleId": "com.other.app"})
324
+ ```
325
+
326
+ ## DiscoveryKit
327
+
328
+ ```python
329
+ async with AgentOSSDK() as sdk:
330
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
331
+
332
+ await sdk.discoverykit.register({"receivePolicy": "autoAccept"})
333
+
334
+ peers = await sdk.discoverykit.get_peers()
335
+ print(peers)
336
+
337
+ self_info = await sdk.discoverykit.get_self()
338
+ print(self_info["deviceName"], self_info["registered"])
339
+
340
+ async for event in sdk.discoverykit.stream_peers():
341
+ print(event["type"], event["device"]["name"])
342
+
343
+ await sdk.discoverykit.unregister()
344
+ ```
345
+
346
+ ## TransferKit
347
+
348
+ ```python
349
+ async with AgentOSSDK() as sdk:
350
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
351
+
352
+ session = await sdk.transferkit.send(
353
+ request={
354
+ "targetDeviceId": "device-abc",
355
+ "files": [
356
+ {"fileName": "photo.jpg", "size": 1024, "filePath": "/tmp/photo.jpg"}
357
+ ],
358
+ }
359
+ )
360
+ print(session["transferId"], session["state"])
361
+
362
+ transfers = await sdk.transferkit.list_transfers()
363
+
364
+ async for progress in sdk.transferkit.stream_progress(
365
+ transfer_id=session["transferId"]
366
+ ):
367
+ print(progress["progress"])
368
+
369
+ await sdk.transferkit.set_policy(request={"policy": "autoAccept"})
370
+ policy = await sdk.transferkit.get_policy()
371
+
372
+ history = await sdk.transferkit.get_history()
373
+ await sdk.transferkit.clear_history()
374
+ ```
375
+
376
+ `list_tool()` 的返回类型为 `list[ToolDto]`,并暴露 daemon 0.5 元数据。可选
377
+ `server` 标识使用 `namespace`、`name` 和 `version`;
378
+ `materializedArtifactDigest` 在可用时标识已安装内容,`contentState` 表示内容
379
+ 是否为最新状态。
380
+
283
381
  ## 直接使用低层 Client
284
382
 
285
383
  低层 client 可用于显式 token 或自定义传输层场景:
@@ -290,7 +388,10 @@ from agentos_sdk.transport import ApiClient
290
388
 
291
389
  api = ApiClient(base_url="http://localhost:8888")
292
390
  agentkit = AgentKitClient(api)
293
- agent = await agentkit.get_agent("bearer-token", "agent-id")
391
+ session = await agentkit.init_session(
392
+ "bearer-token",
393
+ capability={"systemPrompt": "你是一个乐于助人的助手。"},
394
+ )
294
395
  ```
295
396
 
296
397
  ## 开发验证
@@ -41,7 +41,7 @@ async def main():
41
41
  print(tasks)
42
42
  ```
43
43
 
44
- `AgentOSSDK` also exposes TS-style camelCase aliases for common migration paths, such as `registerBundle`, `listTasks`, `chatSimple`, `listModels`, and `loadTool`.
44
+ `AgentOSSDK` also exposes TS-style camelCase aliases for common migration paths, such as `registerBundle`, `listTasks`, `chatSimple`, `listModels`, `loadTool`, `getPeers`, and `listTransfers`.
45
45
 
46
46
  ## Transport
47
47
 
@@ -61,7 +61,7 @@ Use `async with AgentOSSDK(...)` or call `await sdk.aclose()` when done.
61
61
 
62
62
  ## Token Handling
63
63
 
64
- `sdk.agentos.register_bundle(...)` stores the active app token. Protected facade methods in `sdk.agentkit` and `sdk.cronkit` use that token automatically.
64
+ `sdk.agentos.register_bundle(...)` stores the active app token. Protected facade methods in `sdk.agentkit`, `sdk.cronkit`, `sdk.authkit`, `sdk.discoverykit`, and `sdk.transferkit` use that token automatically.
65
65
 
66
66
  If a protected call fails with HTTP `401`, HTTP `403`, or recognizable invalid-token text, the SDK re-runs registration for the same bundle once and retries the call. The cached bundle is a defensive copy and retains its `opentoolServers` declarations during refresh.
67
67
 
@@ -129,7 +129,9 @@ class ChatHandler(AgentMessageHandler):
129
129
 
130
130
  async with AgentOSSDK() as sdk:
131
131
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
132
- session = await sdk.agentkit.init_session()
132
+ session = await sdk.agentkit.init_session(
133
+ capability={"systemPrompt": "You are a helpful assistant."}
134
+ )
133
135
  await sdk.agentkit.chat(
134
136
  session,
135
137
  {"content": [{"type": "text", "message": "Hello"}]},
@@ -151,7 +153,27 @@ messages = await sdk.agentkit.history_process(
151
153
 
152
154
  Message, chunk, and function-call handlers receive a child `sessionId` when the event supplies one, otherwise the root session ID. Function-call failures passed to `on_error` use `FunctionCallLifecycleError` with `stage` equal to `function_call_parse_failed`, `function_call_handler_failed`, or `function_call_callback_failed`.
153
155
 
154
- Direct AgentKit methods include `get_agent`, `create_agent`, `update_agent`, `delete_agent`, `init_session`, `init_simple`, `chat`, `chat_simple`, `history`, `history_summary`, `history_process`, `stop`, `clear`, `callback`, and `stream_callback`.
156
+ AgentKit 1.0.0 follows the session-only gateway contract. Agent CRUD methods and
157
+ the `init_session(agent_id=...)` form have been removed. Define sub-agents inline
158
+ with `Capability.subAgentList`:
159
+
160
+ ```python
161
+ session = await sdk.agentkit.init_session(
162
+ capability={
163
+ "systemPrompt": "Coordinate the task.",
164
+ "subAgentList": [
165
+ {
166
+ "name": "researcher",
167
+ "capability": {"systemPrompt": "Research the requested topic."},
168
+ }
169
+ ],
170
+ }
171
+ )
172
+ ```
173
+
174
+ Direct AgentKit methods include `init_session`, `init_simple`, `chat`,
175
+ `chat_simple`, `history`, `history_summary`, `history_process`, `stop`, `clear`,
176
+ `callback`, and `stream_callback`.
155
177
 
156
178
  ## CronKit
157
179
 
@@ -253,14 +275,16 @@ async with AgentOSSDK() as sdk:
253
275
  )
254
276
  print(result)
255
277
 
256
- async for event in sdk.toolkit.subscribe_tool_events("daemon-api-key"):
257
- print(event)
258
278
  ```
259
279
 
260
280
  `registration["opentoolServers"]` also contains the resolved `id` when its
261
281
  status is `running`; the example uses `list_tool()` so it can select the running
262
282
  tool by `server.name`.
263
283
 
284
+ `subscribe_tool_events()` is retained for legacy direct-daemon deployments.
285
+ The deprecated `/toolkit/events` endpoint is not exposed by the AgentOS API
286
+ gateway.
287
+
264
288
  `stream_call()` is only appropriate for functions whose tool server explicitly
265
289
  supports `streamCall`. For such a function, retain the stream and close it when
266
290
  consumer work ends early:
@@ -283,6 +307,81 @@ token returned by `register_bundle()` and refresh it once after a 401/403
283
307
  response. `load_tool()` returns an `OpenToolDefinition` wrapper that preserves
284
308
  the raw JSON definition.
285
309
 
310
+ ## AuthKit
311
+
312
+ ```python
313
+ async with AgentOSSDK() as sdk:
314
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
315
+
316
+ auth = await sdk.authkit.authorize({"scopes": ["profile"], "appName": "Demo"})
317
+ print(auth["requestId"], auth["status"])
318
+
319
+ status = await sdk.authkit.get_status(request_id=auth["requestId"])
320
+ if status.get("authCode"):
321
+ token_resp = await sdk.authkit.exchange_token(
322
+ request={"authCode": status["authCode"]}
323
+ )
324
+ user = await sdk.authkit.get_user_info(access_token=token_resp["accessToken"])
325
+ print(user["name"])
326
+
327
+ await sdk.authkit.revoke({"bundleId": "com.other.app"})
328
+ ```
329
+
330
+ ## DiscoveryKit
331
+
332
+ ```python
333
+ async with AgentOSSDK() as sdk:
334
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
335
+
336
+ await sdk.discoverykit.register({"receivePolicy": "autoAccept"})
337
+
338
+ peers = await sdk.discoverykit.get_peers()
339
+ print(peers)
340
+
341
+ self_info = await sdk.discoverykit.get_self()
342
+ print(self_info["deviceName"], self_info["registered"])
343
+
344
+ async for event in sdk.discoverykit.stream_peers():
345
+ print(event["type"], event["device"]["name"])
346
+
347
+ await sdk.discoverykit.unregister()
348
+ ```
349
+
350
+ ## TransferKit
351
+
352
+ ```python
353
+ async with AgentOSSDK() as sdk:
354
+ await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
355
+
356
+ session = await sdk.transferkit.send(
357
+ request={
358
+ "targetDeviceId": "device-abc",
359
+ "files": [
360
+ {"fileName": "photo.jpg", "size": 1024, "filePath": "/tmp/photo.jpg"}
361
+ ],
362
+ }
363
+ )
364
+ print(session["transferId"], session["state"])
365
+
366
+ transfers = await sdk.transferkit.list_transfers()
367
+
368
+ async for progress in sdk.transferkit.stream_progress(
369
+ transfer_id=session["transferId"]
370
+ ):
371
+ print(progress["progress"])
372
+
373
+ await sdk.transferkit.set_policy(request={"policy": "autoAccept"})
374
+ policy = await sdk.transferkit.get_policy()
375
+
376
+ history = await sdk.transferkit.get_history()
377
+ await sdk.transferkit.clear_history()
378
+ ```
379
+
380
+ `list_tool()` is typed as `list[ToolDto]` and exposes daemon 0.5 metadata. Its
381
+ optional `server` identity uses `namespace`, `name`, and `version`;
382
+ `materializedArtifactDigest` identifies installed content when available, and
383
+ `contentState` reports whether it is current.
384
+
286
385
  ## Direct Clients
287
386
 
288
387
  The low-level clients are available for explicit-token or custom transport usage:
@@ -293,7 +392,10 @@ from agentos_sdk.transport import ApiClient
293
392
 
294
393
  api = ApiClient(base_url="http://localhost:8888")
295
394
  agentkit = AgentKitClient(api)
296
- agent = await agentkit.get_agent("bearer-token", "agent-id")
395
+ session = await agentkit.init_session(
396
+ "bearer-token",
397
+ capability={"systemPrompt": "You are a helpful assistant."},
398
+ )
297
399
  ```
298
400
 
299
401
  ## Development
@@ -47,8 +47,8 @@ Upload to PyPI:
47
47
  Tag the released commit:
48
48
 
49
49
  ```bash
50
- git tag v0.1.0
51
- git push origin v0.1.0
50
+ git tag v1.0.0
51
+ git push origin v1.0.0
52
52
  ```
53
53
 
54
54
  ## Authentication
@@ -22,7 +22,9 @@ from .protocol import (
22
22
  OpenToolResolvedServer,
23
23
  OpenToolServerDeclaration,
24
24
  TaskStatus,
25
+ ToolContentState,
25
26
  ToolDto,
27
+ ToolLifecycleEventDto,
26
28
  ToolServerDto,
27
29
  ToolStream,
28
30
  ToolStreamEvent,
@@ -55,7 +57,9 @@ __all__ = [
55
57
  "OpenToolServerDeclaration",
56
58
  "SseEvent",
57
59
  "TaskStatus",
60
+ "ToolContentState",
58
61
  "ToolDto",
62
+ "ToolLifecycleEventDto",
59
63
  "ToolReturn",
60
64
  "ToolServerDto",
61
65
  "ToolStream",
@@ -1,15 +1,21 @@
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
4
6
  from .modelkit import ModelKitClient
5
7
  from .systemkit import SystemKitClient
6
8
  from .toolkit import ToolKitClient
9
+ from .transferkit import TransferKitClient
7
10
 
8
11
  __all__ = [
9
12
  "AgentKitClient",
10
13
  "AppKitClient",
14
+ "AuthKitClient",
11
15
  "CronKitClient",
16
+ "DiscoveryKitClient",
12
17
  "ModelKitClient",
13
18
  "SystemKitClient",
14
19
  "ToolKitClient",
20
+ "TransferKitClient",
15
21
  ]
@@ -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
- agent_id: str | None = None,
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) if capability else None,
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