feat(host-agent): default planner transport to cloud
Tests / Test passed: 794

This commit is contained in:
2026-07-14 20:42:27 +08:00
parent 6e511111c4
commit 30f09b6268
10 changed files with 98 additions and 78 deletions
+14 -10
View File
@@ -46,7 +46,7 @@
## 3. Host Agent: cloud-proxy transport
- [x] 3.1 Add `AI_PLANNER_TRANSPORT` (`direct` default | `cloud`) to
- [x] 3.1 Add `AI_PLANNER_TRANSPORT` (`cloud` default | `direct`) to
`apps/device-host-agent/host_agent/config.py`.
Done: `HostAgentConfig.ai_planner_transport` +
`_parse_ai_planner_transport`.
@@ -70,11 +70,10 @@
- [x] 4.1 Update `apps/device-host-agent/host_agent/execution.py`'s
`_host_agent_planner_config()`/`create_task_runner()` so that when
`AI_PLANNER_TRANSPORT=cloud`, the constructed `TaskRunner`'s
`AI_PLANNER_TRANSPORT` is unset or set to `cloud`, the constructed `TaskRunner`'s
`AIPlanner` is built with a `CloudProxyToolCallingClient` instead of
the default local provider client, while leaving the existing
default-enabled/direct-transport behavior unchanged when
`AI_PLANNER_TRANSPORT` is unset or `direct`.
the local provider client, while `AI_PLANNER_TRANSPORT=direct` remains
an explicit direct-to-provider fallback.
Done: new `_host_agent_planner()` helper + `host_agent_config` param
threaded through `create_execution_factories()` from
`app.py::create_application()`. Manually verified both transports
@@ -106,11 +105,10 @@
(7 tests, using `httpx.MockTransport` -- success, screenshot
base64-encoding, network error, structured 502 error, unstructured
error response, and client-ownership on `close()`).
- [x] 5.4 Unit tests for Host Agent wiring: `AI_PLANNER_TRANSPORT=cloud`
constructs an `AIPlanner` using `CloudProxyToolCallingClient`;
`AI_PLANNER_TRANSPORT` unset or `direct` preserves existing
direct-to-provider construction (no regression to the
already-implemented default-enabled behavior).
- [x] 5.4 Unit tests for Host Agent wiring: `AI_PLANNER_TRANSPORT` unset or
set to `cloud` constructs an `AIPlanner` using
`CloudProxyToolCallingClient`; explicit `direct` preserves local
provider construction.
Done: added to `apps/device-host-agent/tests/test_execution.py`
(2 new tests, one parametrized over `None`/`"direct"`).
- [x] 5.5 Full non-integration suite (`uv run --all-packages pytest -m
@@ -136,3 +134,9 @@
full non-integration suite (492 passed); `python -m compileall` clean
for `packages/cloud-platform/cloud`, `apps/cloud-api`,
`apps/device-host-agent`.
## 8. Default transport amendment
- [x] 8.1 Make `cloud` the Host Agent default for
`AI_PLANNER_TRANSPORT`, retain `direct` as an explicit fallback, and
update the runtime contract, deployment guidance, and regression tests.