agentos-sdk-python 1.1.0__tar.gz → 2.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 (43) hide show
  1. agentos_sdk_python-2.0.0/CHANGELOG.md +134 -0
  2. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/PKG-INFO +163 -32
  3. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/README-zh_CN.md +144 -28
  4. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/README.md +162 -31
  5. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/RELEASE.md +7 -8
  6. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/__init__.py +10 -0
  7. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/discoverykit.py +1 -19
  8. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/harnesskit.py +18 -0
  9. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/modelkit.py +18 -5
  10. agentos_sdk_python-2.0.0/agentos_sdk/clients/transferkit.py +64 -0
  11. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/normalizers.py +53 -3
  12. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/protocol.py +59 -6
  13. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/sdk.py +27 -73
  14. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/pyproject.toml +1 -1
  15. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_harnesskit.py +121 -1
  16. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_modelkit.py +248 -19
  17. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_normalizers.py +137 -0
  18. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_sdk_facade.py +60 -7
  19. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/typecheck/harnesskit_usage.py +36 -1
  20. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/typecheck/modelkit_usage.py +14 -5
  21. agentos_sdk_python-1.1.0/CHANGELOG.md +0 -69
  22. agentos_sdk_python-1.1.0/agentos_sdk/clients/transferkit.py +0 -149
  23. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/.gitignore +0 -0
  24. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/LICENSE +0 -0
  25. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/__init__.py +0 -0
  26. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/agentkit.py +0 -0
  27. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/appkit.py +0 -0
  28. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/authkit.py +0 -0
  29. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/cronkit.py +0 -0
  30. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/notifykit.py +0 -0
  31. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/systemkit.py +0 -0
  32. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/clients/toolkit.py +0 -0
  33. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/handlers.py +0 -0
  34. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/py.typed +0 -0
  35. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/agentos_sdk/transport.py +0 -0
  36. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_agentkit.py +0 -0
  37. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_cronkit.py +0 -0
  38. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_notifykit.py +0 -0
  39. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_protocol.py +0 -0
  40. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_toolkit.py +0 -0
  41. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/test_transport.py +0 -0
  42. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/typecheck/notifykit_usage.py +0 -0
  43. {agentos_sdk_python-1.1.0 → agentos_sdk_python-2.0.0}/tests/typecheck/toolkit_usage.py +0 -0
@@ -0,0 +1,134 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0
4
+
5
+ - **Breaking:** Nearby discovery is device-level. Removed `register` and
6
+ `unregister` from `DiscoveryKitClient` and the authenticated
7
+ `sdk.discoverykit` facade. Apps can query nearby devices and the current
8
+ device, and watch discovery events without registering.
9
+ - **Breaking:** Incoming nearby transfers are handled by the receiving device's
10
+ built-in UI. Removed `respond`, `receive_stream`, `set_policy`, `get_policy`,
11
+ `get_history`, `delete_history`, and `clear_history` from `TransferKitClient`
12
+ and the authenticated `sdk.transferkit` facade, including their camelCase
13
+ aliases. Apps can send files and track or cancel their own transfers.
14
+ - **Breaking:** Model info now takes the billing fields of the AgentOS server's
15
+ model list as they are: `billingType` (`ModelBillingType`: `"free"`,
16
+ `"in plan"`, `"pay as you go"` or `"benefit card"`), `cardName` (the benefit
17
+ card, only for `"benefit card"`; it is the only identifier of a card) and
18
+ `planNameZh` / `planNameEn` (the plan, only for `"free"` and `"in plan"`).
19
+ The old `billingType` values `"plan"` and `"payAsYouGo"` are no longer
20
+ understood, and `isBenefitCard`, `benefitCardId` and `benefitCardName` are
21
+ removed: use `billingType == "benefit card"` and `cardName`. A benefit card
22
+ model still keeps `source` `"platform"` and its plain `name` / `alias`.
23
+
24
+ ## 1.1.1
25
+
26
+ - Added HarnessKit private App tool registration with `register_private_tools`
27
+ and `registerPrivateTools` on both the authenticated facade and explicit-token
28
+ client. Added registration, result and tool policy type declarations.
29
+ - Preserve the current AppKit token when HarnessKit returns
30
+ `harness_host_access_forbidden` for a restricted action.
31
+ - Added `billingType` (`ModelBillingType`: `"free"`, `"plan"` or `"payAsYouGo"`) to
32
+ model info for system models that are not benefit card models. It is omitted for
33
+ benefit card, local, custom and app models, and on gateways that predate the
34
+ field; blank and unknown values are dropped. Pickers can mark each type with a
35
+ badge.
36
+ - Added `isBenefitCard`, `benefitCardId` and `benefitCardName` to model info for
37
+ the models a benefit card serves. A card model keeps `source` `"platform"` and
38
+ its plain `name` / `alias`; the same model can be listed once for the plan and
39
+ once per card, and only `id` and the card fields tell them apart. Group card
40
+ models one group per card (for example `Remote · System · {benefitCardName}`,
41
+ falling back to `benefitCardId`). The fields are omitted for other models and
42
+ on gateways that predate them; blank values are dropped.
43
+ - Added `maxOutputTokens` (the maximum number of tokens a model can generate in
44
+ one response, the platform's `maxTokens`) to model info and app model
45
+ records/requests, next to `contextWindowSize`. It is omitted when the gateway
46
+ does not report it; the `AppModel*` type declarations include it.
47
+ - Model info now reports `source` (`ModelSource`: `"local"` / `"platform"` /
48
+ `"custom"` / `"app"`), the gateway's mutually exclusive model origin, and
49
+ `appName` for app models. Group and label models by `source` (for example
50
+ `App · {appName}`) instead of combining `isRemote` / `isCustom` /
51
+ `isAppModel`. `source` is always present: it is derived from those flags with
52
+ the gateway's rules when the gateway predates `source` or reports an unknown
53
+ value. `appName` is only present when the gateway reports a non-blank one.
54
+ The `ModelSource` type declaration was added.
55
+ - **Breaking:** The gateway generates app model IDs. `AppModelRegistration` takes
56
+ no `id`; the gateway derives a 12-character hashid from the app's bundle ID and
57
+ the model `name` and returns it as `AppModelWriteResult["id"]`. Store it: it is the
58
+ `model_id` of `update_app_model` / `unregister_app_model` /
59
+ `toggle_app_model` (looked up only among the calling app's models, otherwise
60
+ `404`) and the `model` of requests. `AppModel["id"]` and the model `id` in
61
+ `list_models()` report the same value. A model's `name` is unique within its
62
+ app: registering an existing `name` replaces that model and keeps its id
63
+ (`updated` is true), and renaming through `update_app_model` keeps the id.
64
+ `409` means the id derived from `name` is still held by a renamed model of the
65
+ same app, or `update_app_model` renames a model to a `name` another model of
66
+ the app already uses.
67
+
68
+ ## 1.1.0
69
+
70
+ - Added HarnessKit support for the authenticated `/harnesskit/*` Gateway routes:
71
+ `sdk.harnesskit` (with `health`, `get_runtime`, `switch_engine`,
72
+ `list_threads`, `get_thread`, `rename_thread`, `delete_thread`, `start_run`,
73
+ `submit_command`, `events`, `get_run_result`, `get_operational_snapshot`,
74
+ `request` and `request_stream`, plus camelCase aliases) and the explicit-token
75
+ `HarnessKitClient` (`sdk.harnessKit`). Calls use the app token from
76
+ `register_bundle` and refresh it once on `401`/`403`. `events()` is a
77
+ resumable SSE stream (`after_sequence`, `run_id`) that releases its connection
78
+ when finished or closed. Rejected commands (HTTP `400` with a receipt body) are
79
+ returned as receipts. Thread/run IDs and `request()` paths are validated so
80
+ they cannot escape the Harness API root. The `HarnessKit*` type declarations
81
+ were added.
82
+ - Added NotifyKit support: `sdk.notifykit.publish(request=...)` and the
83
+ explicit-token `NotifyKitClient` (`sdk.notifyKit`) for
84
+ `POST /notifykit/notifications`, with `NotifyKitEvent`, `NotifyKitNotification`,
85
+ `NotifyKitPublishResult` and `NotifyKitLevel` type declarations. Invalid events
86
+ and rate limits (`retryAfterSeconds`) surface as `ApiError`.
87
+ - Fixed a query string already present in a request path being dropped when no
88
+ `query` argument was given.
89
+ - Added ModelKit decision inference: task `"decision"`, modality `"decisions"`
90
+ and `sdk.modelkit.decision.create(...)` (`POST /modelkit/decision`), plus the
91
+ `DecisionRequest`, `DecisionQuestion`, `DecisionResponse`, `DecisionAnswer` and
92
+ `DecisionUsage` type declarations.
93
+ - Added app model registration: `list_app_models`, `register_app_model`,
94
+ `update_app_model`, `unregister_app_model` and `toggle_app_model` for
95
+ `/modelkit/app-models` (with camelCase aliases). Write calls reuse the app token
96
+ from `register_bundle` and refresh it once on `401`. `ModelKitClient` exposes
97
+ the same methods with an explicit `bearer_token` argument.
98
+ - Model info now reports `isAppModel` and `appBundleId` for models registered
99
+ by apps, and `AppModel*` type declarations were added.
100
+ - Fixed models with `decisions` output being reported as `text` output.
101
+
102
+ ## 1.0.0 - 2026-09-01
103
+
104
+ - Updated AgentKit for the LiteAgent SDK 0.4 gateway contract.
105
+ - Added support and coverage for recursively nested inline agents through
106
+ `Capability.subAgentList`.
107
+ - **Breaking:** Removed the AgentKit agent CRUD methods because the corresponding
108
+ gateway routes no longer exist.
109
+ - **Breaking:** `init_session` now requires a Capability request body and no
110
+ longer accepts the removed `agent_id` argument.
111
+ - Removed the obsolete `agentId` field from AgentKit message type declarations.
112
+
113
+ ## 0.2.0 - 2026-07-17
114
+
115
+ - **Breaking:** Updated OpenTool server identities to daemon 0.5
116
+ `namespace` / `name` / `version` fields.
117
+ - Added public `ToolContentState` and `ToolLifecycleEventDto` types.
118
+ - Added `materializedArtifactDigest` and `contentState` ToolKit metadata.
119
+ - Added OpenTool server declarations, registration statuses, and AppKit provisioning/availability events.
120
+ - Added paginated AgentKit history, summary history, and process history APIs.
121
+ - Added child-session routing and structured function-call lifecycle errors.
122
+ - Added ToolKit server metadata types and hardened SSE parsing.
123
+ - Added automatic app registration Bearer authentication to ToolKit list and load requests.
124
+ - Added one-time app token refresh and retry for ToolKit requests that return 401 or 403.
125
+ - Added `sdk.toolkit.call()` for non-streaming tool function calls.
126
+ - Added `sdk.toolkit.stream_call()` / `streamCall()` with typed stream events and safe
127
+ response closure after normal completion, errors, cancellation, or explicit early close.
128
+ - **Breaking:** Replaced `AgentOSEventHandler.on_call_app` / `onCallApp` with `on_app_event` / `onAppEvent`.
129
+
130
+ ## 0.1.0 - 2026-06-12
131
+
132
+ - Initial public release of the AgentOS Python SDK.
133
+ - Added async clients for AgentOS, AgentKit, CronKit, ModelKit, and ToolKit APIs.
134
+ - Added facade helpers for bearer token reuse, token refresh retry, stream callbacks, and TS-style alias compatibility.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentos-sdk-python
3
- Version: 1.1.0
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
@@ -255,6 +255,63 @@ Normalized model capabilities include `vision`, `tool_call`, `stream`, and
255
255
  `reasoning` booleans. `reasoning` reflects only the server-provided
256
256
  `capabilities.reasoning` value and defaults to `False` when omitted.
257
257
 
258
+ Every model also carries `source`, the mutually exclusive origin of the model
259
+ (`ModelSource`). Group and label models by it instead of combining `isRemote` /
260
+ `isCustom` / `isAppModel`:
261
+
262
+ | `source` | Meaning | Suggested group |
263
+ | --- | --- | --- |
264
+ | `"local"` | Runs on this device | Local Models |
265
+ | `"platform"` | Remote model provided by the AgentOS platform | Platform Models, plus `Remote · System · {cardName}` for each benefit card (see below) |
266
+ | `"custom"` | Remote model configured by the user | Custom Models |
267
+ | `"app"` | Registered by a third-party app | `App · {appName}` (one group per app) |
268
+
269
+ ```python
270
+ groups: dict[str, list[dict]] = {}
271
+ for model in await sdk.modelkit.list_models():
272
+ if model["source"] == "app":
273
+ title = f"App · {model.get('appName') or model.get('appBundleId')}"
274
+ else:
275
+ title = model["source"]
276
+ groups.setdefault(title, []).append(model)
277
+ ```
278
+
279
+ App models additionally report `appBundleId` and `appName` (the human-readable
280
+ app name, for group titles; `appName` is only present when the gateway reports
281
+ one, so fall back to `appBundleId`). Against gateways that predate `source`, or
282
+ when it holds an unknown value, `source` is derived from the legacy flags with
283
+ the gateway's rules.
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
+
291
+ Models served through a benefit card keep `source` `"platform"` and their plain
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:
296
+
297
+ ```python
298
+ def system_group_title(model: dict) -> str:
299
+ if model.get("billingType") == "benefit card":
300
+ return f"Remote · System · {model.get('cardName') or 'Benefit card'}"
301
+ return "Remote · System"
302
+ ```
303
+
304
+ Model dicts also carry `contextWindowSize` and `maxOutputTokens` (the maximum
305
+ number of tokens the model can generate in one response); `maxOutputTokens` is
306
+ only present when the gateway reports it. Only chat models report
307
+ `maxOutputTokens` (embedding, ASR, TTS and decision models do not generate
308
+ text, so the key is absent for them); a chat model that reports
309
+ `contextWindowSize` reports `maxOutputTokens` too, using the same number when it
310
+ has no value of its own. Apps can set both when registering a model
311
+ (`register_app_model(request={"name": ..., "contextWindowSize": 32768,
312
+ "maxOutputTokens": 4096})`); app model records report them back, and
313
+ `update_app_model` can change them.
314
+
258
315
  ModelKit also supports:
259
316
 
260
317
  - `sdk.modelkit.embedding.create(...)`
@@ -316,44 +373,58 @@ and related `TypedDict` definitions for annotations.
316
373
  ### App models
317
374
 
318
375
  Apps can register their own models into the gateway. Registered models show up
319
- in `list_models()` / `list_models_by_task()` with `isAppModel: True` and the
320
- owning `appBundleId`.
376
+ in `list_models()` / `list_models_by_task()` with `source: "app"`,
377
+ `isAppModel: True`, the owning `appBundleId` and its `appName`.
378
+
379
+ You do not choose the model id: the gateway generates a 12-character hashid from
380
+ your bundle ID and the model `name` and returns it when you register. That same
381
+ id is the model `id` in `list_models()` and `list_app_models()`. Store it: it
382
+ maintains the model (`update_app_model` / `toggle_app_model` /
383
+ `unregister_app_model`) and is the `model` of requests that must reach exactly
384
+ your model. A `name` is unique within your app; different apps may use the same
385
+ `name` and get different ids.
321
386
 
322
387
  ```python
323
388
  async with AgentOSSDK() as sdk:
324
389
  await sdk.agentos.register_bundle({"bundleId": "com.example.app"})
325
390
 
326
- # Register (or replace) a model. Only "id" and "name" are required.
391
+ # Register (or replace) a model. Only "name" is required.
327
392
  result = await sdk.modelkit.register_app_model(
328
393
  request={
329
- "id": "my-router",
330
394
  "name": "my-router",
331
395
  "task": "decision",
332
396
  "baseUrl": "http://127.0.0.1:9000",
333
397
  "apiKey": "upstream-secret", # stored by the server, never returned
334
398
  }
335
399
  )
400
+ model_id = result["id"] # e.g. "6f78dcce6717": maintain the model with it, or use it as `model` in requests
336
401
  print(result.get("updated")) # True when an existing model of this app was replaced
337
402
 
338
403
  # Partial update: unset fields stay unchanged.
339
404
  await sdk.modelkit.update_app_model(
340
- model_id="my-router", request={"description": "Routes support tickets"}
405
+ model_id=model_id, request={"description": "Routes support tickets"}
341
406
  )
342
407
 
343
408
  # Enable/disable without deleting.
344
- await sdk.modelkit.toggle_app_model(model_id="my-router")
409
+ await sdk.modelkit.toggle_app_model(model_id=model_id)
345
410
 
346
411
  # List every app-registered model (public, no token needed).
347
412
  for model in await sdk.modelkit.list_app_models():
348
- print(model["id"], model["appBundleId"], model["isDisabled"])
413
+ print(model["id"], model["isDisabled"])
349
414
 
350
- await sdk.modelkit.unregister_app_model(model_id="my-router")
415
+ await sdk.modelkit.unregister_app_model(model_id=model_id)
351
416
  ```
352
417
 
353
418
  Write calls attach the app token automatically and refresh it once on `401`.
354
419
  They raise `ApiError` carrying the server status: `401` invalid token, `403`
355
- not the owning app or `appBundleId` mismatch, `404` unknown id, `409` the id
356
- belongs to another app, `400` invalid body or unknown `task`.
420
+ `appBundleId` mismatch, `404` unknown id (`model_id` is looked up only among your
421
+ app's models), `409` the id derived from `name` is still held by a renamed model
422
+ of your app (or `update_app_model` renames a model to a `name` another model of
423
+ your app already uses), `400` invalid body, missing `name`, unknown `task`, or a
424
+ bundle ID outside the allowed characters or length.
425
+
426
+ Registering a `name` you already registered replaces that model and returns the
427
+ same id; renaming a model with `update_app_model` keeps its id.
357
428
 
358
429
  Decision models are normalized by the server: input `text` (+ optional
359
430
  `image`), output `decisions`, and `stream` / `tool_call` / `reasoning` all
@@ -463,26 +534,29 @@ async with AgentOSSDK() as sdk:
463
534
 
464
535
  ## DiscoveryKit
465
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
+
466
540
  ```python
467
541
  async with AgentOSSDK() as sdk:
468
542
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
469
543
 
470
- await sdk.discoverykit.register({"receivePolicy": "autoAccept"})
471
-
472
544
  peers = await sdk.discoverykit.get_peers()
473
545
  print(peers)
474
546
 
475
547
  self_info = await sdk.discoverykit.get_self()
476
- print(self_info["deviceName"], self_info["registered"])
548
+ print(self_info["deviceName"], self_info["nearbyTransferEnabled"])
477
549
 
478
550
  async for event in sdk.discoverykit.stream_peers():
479
551
  print(event["type"], event["device"]["name"])
480
-
481
- await sdk.discoverykit.unregister()
482
552
  ```
483
553
 
484
554
  ## TransferKit
485
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
+
486
560
  ```python
487
561
  async with AgentOSSDK() as sdk:
488
562
  await sdk.agentos.register_bundle({"bundleId": "com.demo.app"})
@@ -503,12 +577,6 @@ async with AgentOSSDK() as sdk:
503
577
  transfer_id=session["transferId"]
504
578
  ):
505
579
  print(progress["progress"])
506
-
507
- await sdk.transferkit.set_policy(request={"policy": "autoAccept"})
508
- policy = await sdk.transferkit.get_policy()
509
-
510
- history = await sdk.transferkit.get_history()
511
- await sdk.transferkit.clear_history()
512
580
  ```
513
581
 
514
582
  `list_tool()` is typed as `list[ToolDto]` and exposes daemon 0.5 metadata. Its
@@ -518,12 +586,10 @@ optional `server` identity uses `namespace`, `name`, and `version`;
518
586
 
519
587
  ## HarnessKit
520
588
 
521
- HarnessKit forwards requests through the Gateway to the Harness runtime selected
522
- for the currently registered AppKit bundle. Register the app with
523
- `sdk.agentos.register_bundle()` first. An installable process App must declare
524
- `harnessKit` to receive a Harness runtime; the built-in Harness App uses the
525
- host's default runtime. All `sdk.harnesskit` methods use the active AppKit token
526
- and retry once after an authentication failure.
589
+ HarnessKit forwards requests through the Gateway to the shared host runtime.
590
+ Register the app with `sdk.agentos.register_bundle()` first. The Gateway scopes
591
+ external Apps' threads, runs and events by their bundle ID. All `sdk.harnesskit`
592
+ methods use the active AppKit token and retry once after an authentication failure.
527
593
 
528
594
  | Method | Parameters | Description |
529
595
  | --- | --- | --- |
@@ -531,6 +597,7 @@ and retry once after an authentication failure.
531
597
  | `get_runtime()` / `switch_engine(engine=...)` | `engine` | Reads the runtime engine or requests an engine switch. |
532
598
  | `list_threads()` / `get_thread(thread_id=...)` | `thread_id` | Lists durable threads or reads one thread snapshot. |
533
599
  | `rename_thread(thread_id=..., title=...)` / `delete_thread(thread_id=...)` | `thread_id`, `title` | Updates a thread title or deletes an idle thread. |
600
+ | `register_private_tools(thread_id=..., registration=...)` | `thread_id`, `HarnessKitPrivateToolsRegistration` | Registers or replaces a local App's OpenTool callbacks for a thread. |
534
601
  | `start_run(thread_id=..., request=...)` | `thread_id`, run request | Starts a Harness run and returns its `runId`. |
535
602
  | `submit_command(thread_id=..., command=...)` | `thread_id`, command | Submits work or control commands; rejected commands return their receipt. |
536
603
  | `events(thread_id=..., after_sequence=0, run_id=None)` | `thread_id`, `after_sequence`, `run_id` | Opens a resumable SSE stream of typed events. |
@@ -596,10 +663,10 @@ through untouched; the exported `HarnessKit*` `TypedDict`s (for example
596
663
  - A command the Harness rejects comes back as HTTP `400` with a receipt body.
597
664
  `submit_command()` returns that receipt (`status == "rejected"`) instead of
598
665
  raising; every other error raises `ApiError`.
599
- - Runtime controls (`get_runtime()`, `switch_engine()`) and
600
- `get_operational_snapshot()` are reserved for the built-in Harness App; other
601
- Apps get an `ApiError` with status `403`. `get_operational_snapshot()` also
602
- answers `501` when the configured engine does not expose the optional reader.
666
+ - `switch_engine()` and `get_operational_snapshot()` are reserved for the
667
+ built-in Harness App. Other Apps receive an `ApiError` with status `403`.
668
+ `get_operational_snapshot()` also answers `501` when the configured engine
669
+ does not expose the optional reader.
603
670
  - Thread and run IDs are percent-encoded. Empty IDs and `.` / `..` raise
604
671
  `ValueError` before any request is sent.
605
672
  - `request()` and `request_stream()` accept paths relative to the Harness API
@@ -608,6 +675,70 @@ through untouched; the exported `HarnessKit*` `TypedDict`s (for example
608
675
  caller-supplied `authorization` header is replaced by the AppKit token. A query
609
676
  string in `path` is kept; keys in `query` override the same keys there.
610
677
 
678
+ ### Register private App tools
679
+
680
+ An external App can register OpenTool functions for its own thread over a direct
681
+ local connection to the Gateway. Start the App's HTTP callback service first and
682
+ use its UUID-shaped callback token in the registration. The callback token is
683
+ separate from the AppKit token used to authenticate the Gateway request.
684
+
685
+ ```python
686
+ import uuid
687
+
688
+ from agentos_sdk import AgentOSSDK
689
+
690
+
691
+ async def run_with_app_tools(callback_token: str):
692
+ async with AgentOSSDK(base_url="http://127.0.0.1:8888") as sdk:
693
+ await sdk.agentos.register_bundle({"bundleId": "com.example.app"})
694
+ binding = await sdk.harnesskit.register_private_tools(
695
+ thread_id="research-thread",
696
+ registration={
697
+ "endpoint": "http://127.0.0.1:8123/",
698
+ "token": callback_token,
699
+ "specification": {
700
+ "opentool": "1.0.0",
701
+ "info": {"title": "App tools", "version": "1.0.0"},
702
+ "functions": [{
703
+ "name": "list_assets",
704
+ "description": "List the app assets",
705
+ "parameters": [],
706
+ "return": {"name": "result", "schema": {"type": "object"}},
707
+ }],
708
+ },
709
+ },
710
+ )
711
+ return await sdk.harnesskit.start_run(
712
+ thread_id="research-thread",
713
+ request={
714
+ "requestId": str(uuid.uuid4()),
715
+ "goal": "List the app assets",
716
+ "llmConfig": {"model": "your-model"},
717
+ "toolPolicy": {"allowedToolIds": [binding["toolId"]]},
718
+ },
719
+ )
720
+ ```
721
+
722
+ The endpoint must be an `http://127.0.0.1:<port>/` root URL. The callback
723
+ service must accept `Authorization: Bearer <token>` and provide these routes.
724
+
725
+ - `GET /private-tools/opentool/version` returns HTTP `200` for health checks.
726
+ - `POST /private-tools/opentool/call` accepts JSON with `jsonrpc: "2.0.0"`,
727
+ `id`, `method` and `params`. Return HTTP `200` with the same `jsonrpc` and
728
+ `id`, plus a `result` or `error`.
729
+ - `POST /private-tools/opentool/streamCall` serves streaming functions as SSE
730
+ data events with the same JSON response format, followed by a `DONE` event.
731
+
732
+ The returned `toolId` identifies the thread's registered tools. Add it to
733
+ `toolPolicy.allowedToolIds` when using an allow-list. Omitting the allow-list or
734
+ setting it to `None` leaves tools unrestricted, while an empty list allows no
735
+ tools. A new registration replaces the thread's existing binding. Bindings are
736
+ removed when the thread is deleted or the callback repeatedly fails health
737
+ checks. Register again after a Harness restart or when a binding is removed.
738
+ The Gateway rejects remote registrations and registrations from the built-in
739
+ Harness App with HTTP `403` and `harness_host_access_forbidden`. That error does
740
+ not trigger an AppKit token refresh.
741
+
611
742
  ## NotifyKit
612
743
 
613
744
  NotifyKit lets an App submit user-facing events to the AgentOS notification