Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ updates:
# patch 级更新仍然放行,用于接收缺陷修复和安全修复。
ignore:
# OTLP 三件套(api / sdk / exporter-otlp)由 google-adk 1.34.x 与
# 2.x 的 otel 版本交集决定,当前窗口为 >=1.39.0,<=1.41.1。
# 2.x 的 otel 版本交集决定,最低为 1.39.0;具体上限由所选 ADK 版本决定。
- dependency-name: "opentelemetry-*"
update-types:
- "version-update:semver-minor"
Expand Down
76 changes: 72 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
tests/plugins/test_teams_postgres.py \
tests/a2a/test_selected_kernel_database.py \
tests/server/test_checkpoint_resume_audit.py \
tests/runners/test_langgraph_tunnel_history.py::test_postgres_recovery_matches_delayed_receipt_to_its_call \
tests/server/test_postgres_jsonb_codec_guard.py \
tests/server/test_checkpoint_resume_attempt_audit.py \
tests/test_tool_receipt_claim_concurrency.py \
Expand Down Expand Up @@ -143,6 +144,17 @@ jobs:
if [ "$test_code" -eq 0 ]; then test_code=$grants_code; fi
exit "$test_code"

tunnel-tls:
name: Tunnel TLS on Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- run: uv run --python ${{ matrix.python }} --extra dev python -m pytest -q tests/test_tunnel_tls.py

test:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -284,6 +296,8 @@ jobs:
--health-retries 5
env:
KSADK_TEST_EXPECTED_ADK_VERSION: ${{ matrix.google-adk }}
# Older ADK imports MCP 1.x private modules; its 2.5 metadata omits this upper bound.
MCP_REQUIREMENT: ${{ matrix.google-adk == '2.14.0' && 'mcp>=2.3.0' || 'mcp>=1.26.0,<2' }}
KSADK_WEB_VERSION: "0.3.18"
KSADK_TEST_POSTGRES_DSN: postgresql://ksadk_ci:ksadk_ci_password@127.0.0.1:5432/ksadk_ci
KSADK_TEST_FRAMEWORK_DSN: postgresql://ksadk_ci:ksadk_ci_password@127.0.0.1:5432/ksadk_ci
Expand Down Expand Up @@ -339,7 +353,7 @@ jobs:
# 常规测试用 xdist 并行;真实进程测试在下方独立 job 中执行,
# 避免进程表和内存累积,两个分组都必须通过。
- name: Pin google-adk for this matrix leg
run: uv pip install "google-adk==${{ matrix.google-adk }}"
run: uv pip install ".[all,dev]" "google-adk==${{ matrix.google-adk }}" "$MCP_REQUIREMENT"

- name: Install disposable PostgreSQL test server
run: uv pip install "pgserver==0.1.4"
Expand All @@ -348,9 +362,61 @@ jobs:
env:
EXPECTED_GOOGLE_ADK: ${{ matrix.google-adk }}
run: |
uv run --no-sync python -c 'import os; from importlib.metadata import version; actual = version("google-adk"); expected = os.environ["EXPECTED_GOOGLE_ADK"]; print("google-adk under test:", actual); assert actual == expected, (actual, expected); print("resolved packages:", {name: version(name) for name in ("google-adk", "pydantic", "openai", "langchain-core", "langgraph", "asyncpg", "psycopg")})'
uv run --no-sync python -c 'import os; from importlib.metadata import version; actual = version("google-adk"); expected = os.environ["EXPECTED_GOOGLE_ADK"]; print("google-adk under test:", actual); assert actual == expected, (actual, expected); print("resolved packages:", {name: version(name) for name in ("google-adk", "mcp", "fastmcp", "pydantic", "openai", "langchain-core", "langgraph", "asyncpg", "psycopg")})'
uv run --no-sync pytest tests/ -q -m "not local_process_heavy" -n auto

# MCP SDK 版本兼容性。
#
# `ksadk/_mcp_compat.py` 声称同时支持 mcp 1.x / 2.x,但 `fastmcp 4.2.1`
# 硬性要求 `mcp>=2.3.0`——常规测试全部 `from fastmcp import FastMCP`,
# **1.x 路径永远跑不到**。
#
# 这里只跑 `tests/test_mcp_compat.py`(**不依赖 fastmcp**),
# 用它 pin 双版本做真实回归。
#
# 踩过的坑(2026-11-19):`httpx_module()` 曾用「能否 import
# `streamable_http_client`」判断版本,但 mcp 1.26 **同时导出了新旧两个名字**,
# 导致 1.26 被误判成 2.x → `import httpx2` → `ModuleNotFoundError`。
# 只跑 2.3 的 CI 发现不了。
test-mcp-compat:
name: MCP compat (mcp ${{ matrix.mcp }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mcp: ["1.26.0", "2.3.0"]
env:
KSADK_TEST_EXPECTED_MCP_VERSION: ${{ matrix.mcp }}
steps:
- uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"

# 只装 `mcp` + `pytest`,**不装 fastmcp**——fastmcp 4.x 要求 mcp>=2.3.0,
# 装了就没法测 1.x。
- name: Install minimal MCP test deps
run: uv pip install --system "mcp==${{ matrix.mcp }}" "pytest>=7" "pytest-asyncio>=0.21"

- name: Verify resolved MCP version
run: |
python -c '
import os
from importlib.metadata import version
actual = version("mcp")
expected = os.environ["KSADK_TEST_EXPECTED_MCP_VERSION"]
print(f"mcp under test: {actual}")
assert actual == expected, (actual, expected)
'

- name: Run MCP compat tests
run: python -m pytest tests/test_mcp_compat.py -q

# 真实 fork 子进程的 sandbox/skill/browser 测试(local_process_heavy)。
# 使用独立 job 和串行 pytest,避免常规测试累积的资源占用。
# 版本矩阵及默认依赖解析与主套件保持一致。
Expand All @@ -359,6 +425,8 @@ jobs:
runs-on: ubuntu-latest
env:
KSADK_TEST_EXPECTED_ADK_VERSION: ${{ matrix.google-adk }}
# Older ADK imports MCP 1.x private modules; its 2.5 metadata omits this upper bound.
MCP_REQUIREMENT: ${{ matrix.google-adk == '2.14.0' && 'mcp>=2.3.0' || 'mcp>=1.26.0,<2' }}
KSADK_WEB_VERSION: "0.3.18"
strategy:
fail-fast: false
Expand Down Expand Up @@ -404,7 +472,7 @@ jobs:
run: uv pip install --upgrade ".[all,dev]"

- name: Pin google-adk for this matrix leg
run: uv pip install "google-adk==${{ matrix.google-adk }}"
run: uv pip install ".[all,dev]" "google-adk==${{ matrix.google-adk }}" "$MCP_REQUIREMENT"

# Default resolution can upgrade Playwright, so install its matching browser
# afterward and keep the verified ADK pin with --no-sync.
Expand All @@ -417,7 +485,7 @@ jobs:
# Native recovery regressions must remain in the public candidate.
# Missing tests and zero collection must fail this gate.
run: |
uv run --no-sync python -c 'import os; from importlib.metadata import version; actual = version("google-adk"); expected = os.environ["EXPECTED_GOOGLE_ADK"]; print("google-adk under test:", actual); assert actual == expected, (actual, expected); print("resolved packages:", {name: version(name) for name in ("google-adk", "pydantic", "openai", "langchain-core", "langgraph", "asyncpg", "psycopg")})'
uv run --no-sync python -c 'import os; from importlib.metadata import version; actual = version("google-adk"); expected = os.environ["EXPECTED_GOOGLE_ADK"]; print("google-adk under test:", actual); assert actual == expected, (actual, expected); print("resolved packages:", {name: version(name) for name in ("google-adk", "mcp", "fastmcp", "pydantic", "openai", "langchain-core", "langgraph", "asyncpg", "psycopg")})'
test -f tests/harness/native/test_partial_summary_process.py
test -f tests/harness/native/test_summary_recovery_process.py
test -f tests/harness/native/test_compaction_reserve_process_recovery.py
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ on:
- "tests/packaging/test_alias_distribution.py"
- "tests/test_cloud_headers.py"
- "tests/test_prepare_ksadk_python_export.py"
- "tests/studio/test_native_default_install.py"
- "tests/studio/e2e/**"
- "scripts/open_source_audit.py"
- "scripts/audit_release_artifacts.py"
- "scripts/build_alias_distribution.py"
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@

## [未发布]

## [0.8.8]

### 新增与修复

- 知识库与 KSmem 支持 `KSADK_COMPONENT_ENV=pre` 组件路由;隔离资源 Worker 传递初始化快照,签名前加入路由头,其他云客户端沿用既有环境选择。
- mem0 插件配置增加 `extraHeaders`,传递来源及组件路由;要求目标插件支持该字段,旧 `openclaw-mem0` 1.0.6 不兼容。

- 统一社区 Tunnel 与内部工具隧道:同一 Connector 支持 MCP 和自定义 HTTP API、ADK 与 LangGraph,并补齐多 Pod 路由、弹性 peer 发现、断线与在途调用恢复。失败或结果不确定的业务调用不自动重放。
- 隧道通过导出 Agent 的 `enable_tunnel=True` 启用;企业 Connector 与云端使用同版 SDK。旧 YAML/CLI 配置和旧协议包迁移到统一入口,原文档 URL 保留迁移说明。
- 修复 Code/Container 构建器为 Tunnel 强制追加旧 MCP `<2` 上限的问题;保留 MCP 1.26 支持,并允许使用 SDK 已验证的 MCP 2.3 依赖组合。
- Code 包保留 Node 插件的 `.mjs` 入口及相对导入资产,避免从 wheel 打包托管运行时时遗漏插件文件。
- 构建时通过真实 MCP `list_tools()` 探测工具;修复 OAuth 授权后等待恢复、原生 ToolNode 绑定及 MCP 1.x/2.x HTTP 客户端选择和字段差异。
- 修复 MCP 2 的 OAuth HTTP 403 分类和工具结果字段别名;隔离后台 GET 拒绝与业务 POST 结果,保留调用结果不确定时禁止自动重放的边界。
- 修复 AG-UI 原生 session 身份、恢复与 Hosted admission 归属校验,支持配置首选聊天传输。
- 同步 Harness 服务装配、平台资源、历史与 Memory 上下文支持;保留既有 A2A、AG-UI、A2UI、OAuth 与 API key MCP 能力。

- 修复云端长期记忆的 `AgentUserId` 格式;仅在 AICP 请求边界编码,保留本地 SQLite/PostgreSQL 已有 Agent × User 命名空间和历史记录,所有云端操作使用一致身份。
- 补齐 API key MCP 的 MCP 1.x/2.3 客户端选择、RunAgent 回退与无 Kernel Agent 的接入边界。

### 依赖、构建与验证

- MCP 核心兼容窗口为 `>=1.26.0`;开发测试使用 FastMCP 4.x 与 MCP 2.x,独立矩阵验证 MCP 1.26/2.3。OpenTelemetry 组件随所选 ADK/FastMCP 成组解析,保留旧 ADK 的兼容安装窗口。
- 旧 ADK 1.34.3 / 2.5.0 明确搭配 MCP 1.x(最低 1.26);ADK 2.14.x 与 MCP 2.3 独立验证,避免上游遗漏版本上限导致安装成功但工具导入失败。
- 不再依赖不兼容 MCP 2.x 的 `langchain-mcp-adapters`,原生 MCP ToolNode 使用 SDK 适配。
- 保留社区 Dependabot 的受控依赖升级策略;公开导出补齐新回归和共享 fixture,排除旧 Tunnel 重复协议与退休的 Studio 测试。
- SDK 本地发布证据升级为 schema v3,移除已迁出的 Studio 浏览器状态,避免空测试列表误报通过。该变化不代表独立 Studio 已完成浏览器验收。
- 主包与兼容发行包版本同为 0.8.8;Web 保持官方 0.3.18。实际发布状态与日期以 GitHub Release 和 PyPI 记录为准;本条记录版本变更,不触发正式发布。

## [0.8.7] - 2026-11-12

主包 `ksadk` 与兼容发行包 `agentengine-sdk-python` 同步为 `0.8.7`;最低 Python 版本继续为 3.12,Web companion 固定为已发布的 `@kingsoftcloud/ksadk-web@0.3.18`。
Expand Down
34 changes: 26 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,23 @@ studio-react-test: build-studio-static
npm --prefix ksadk/studio/react-ui run test:ui; \
(cd ksadk/studio/react-ui && npx tsc --noEmit); \
npm --prefix ksadk/studio/react-ui run build; \
uv run pytest tests/studio/test_style_system.py -q; \
else \
echo "React Studio source is not part of this public candidate; testing reviewed compiled assets"; \
test -f "ksadk/studio/static/index.html"; \
fi
PYTHONPATH=. uv run python tests/studio/e2e/studio_browser_smoke.py
PYTHONPATH=. uv run python tests/studio/e2e/studio_workspace_navigation_smoke.py --output "$$(mktemp -d)"
PYTHONPATH=. uv run python tests/studio/e2e/studio_responsive_smoke.py

# MCP 兼容性:在临时 venv 里跑 mcp 1.26 / 2.3 双版本
test-mcp-compat:
@for v in 1.26.0 2.3.0; do \
echo "=== mcp $$v ==="; \
uv venv --quiet /tmp/ksadk-mcp-compat >/dev/null 2>&1; \
uv pip install --quiet --python /tmp/ksadk-mcp-compat/bin/python \
"mcp==$$v" "pytest>=7" "pytest-asyncio>=0.21" >/dev/null 2>&1; \
PYTHONPATH=. /tmp/ksadk-mcp-compat/bin/python -m pytest \
tests/test_mcp_compat.py -q || exit 1; \
done
@rm -rf /tmp/ksadk-mcp-compat
@echo "✅ mcp 1.26 / 2.3 双版本通过"

# ============================================================
# 构建和发布
Expand Down Expand Up @@ -380,10 +389,17 @@ PUBLIC_DOCS_URL ?= https://kingsoftcloud.github.io/ksadk-python/
PUBLIC_PYPI_PROJECT ?= ksadk
PUBLIC_ALIAS_PYPI_PROJECT ?= agentengine-sdk-python
PUBLIC_RELEASE_TAG ?= v$(V)
PUBLIC_TEST_TARGETS ?= tests/test_check_release_version.py tests/studio/test_scheduler_runtime.py tests/studio/test_shared_web.py tests/test_public_release_positioning.py tests/test_docs_site_output_audit.py tests/test_config_env_registry.py tests/test_managed_runtime_builder.py tests/test_managed_runtime_resolution.py tests/cli/test_cmd_create_codex.py tests/runners/test_adapter_contract.py tests/test_deploy_env_forward.py tests/server/test_historical_agent_approval_and_blocks.py
PUBLIC_TEST_TARGETS += tests/a2a/test_public_imports.py tests/studio/test_shared_web_final_snapshot.py
PUBLIC_TEST_TARGETS ?= tests/test_check_release_version.py tests/test_public_release_positioning.py tests/test_docs_site_output_audit.py tests/test_config_env_registry.py tests/test_managed_runtime_builder.py tests/test_managed_runtime_resolution.py tests/cli/test_cmd_create_codex.py tests/runners/test_adapter_contract.py tests/test_deploy_env_forward.py tests/server/test_historical_agent_approval_and_blocks.py
PUBLIC_TEST_TARGETS += tests/a2a/test_public_imports.py
PUBLIC_TEST_TARGETS += tests/test_cloud_headers.py
PUBLIC_TEST_TARGETS += tests/cli/test_cmd_config_tunnel.py
PUBLIC_TEST_TARGETS += tests/test_runtime_common_memory_backend.py
PUBLIC_TEST_TARGETS += tests/cli/test_web_tracing.py tests/runtime/test_harness_service_runtime.py
PUBLIC_TEST_TARGETS += tests/server/test_runtime_tracing_bootstrap.py tests/test_mcp_detector_entry.py tests/test_tracing_session_identity.py
PUBLIC_TEST_TARGETS += tests/test_mcp_tunnel.py tests/test_langgraph_tunnel.py
PUBLIC_TEST_TARGETS += tests/test_tunnel_peers.py tests/test_tunnel_scaling.py tests/test_tunnel_peer_keys.py
PUBLIC_TEST_TARGETS += tests/test_tunnel_connector_errors.py tests/test_tunnel_failure_responses.py tests/test_tunnel_tls.py
PUBLIC_TEST_TARGETS += tests/test_adk_stream_delta_types.py
PUBLIC_TEST_TARGETS += tests/runners/test_adk_composite_tunnel.py tests/runners/test_langgraph_tunnel_history.py
PUBLIC_TEST_TARGETS += tests/test_prepare_ksadk_python_export.py
PUBLIC_TEST_TARGETS += tests/packaging/test_alias_distribution.py
# Public protocol contracts must remain in the local release gate as well as CI.
Expand All @@ -392,11 +408,13 @@ PUBLIC_TEST_TARGETS += tests/agui/test_protocol_contract.py
PUBLIC_TEST_TARGETS += tests/agui/test_native_cold_resume.py
PUBLIC_TEST_TARGETS += tests/test_mcp_oauth_declarations.py
PUBLIC_TEST_TARGETS += tests/test_mcp_oauth_local.py
PUBLIC_TEST_TARGETS += tests/test_mcp_oauth_catalog.py tests/test_mcp_oauth_extension.py tests/test_mcp_oauth_transport.py
PUBLIC_TEST_TARGETS += tests/test_mcp_oauth_documented_graph.py
PUBLIC_TEST_TARGETS += tests/a2a/test_workload_token_public_compat.py
PUBLIC_TEST_TARGETS += tests/runners/test_adk_a2a_stream_review.py
PUBLIC_TEST_TARGETS += tests/events/adapters/test_adk.py
PUBLIC_TEST_TARGETS += tests/agui/test_foreground_local_interactions.py
PUBLIC_TEST_TARGETS += tests/memory/test_agent_user_scope_id.py tests/memory/test_memory_namespace_compat.py

public-status:
@echo "==> internal worktree"
Expand Down Expand Up @@ -505,7 +523,7 @@ public-test: sync-ksadk-web-static build-studio-static
@echo "==> test"
@# The SDK compatibility tests explicitly exercise the optional Managed engine.
@# Native cold-install tests separately reject all agent-framework imports.
@uv sync --extra dev --extra langgraph --extra skills --extra agui --extra a2a
@uv sync --extra dev --extra adk --extra tracing --extra langgraph --extra skills --extra agui --extra a2a
@uv run --no-sync pytest $(PUBLIC_TEST_TARGETS)

public-sync-ksadk-web-static: sync-ksadk-web-static
Expand Down
10 changes: 8 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ Start the local debugging Web UI:
agentengine web . --no-open
```

## 0.8.7: Capabilities and Integration
## 0.8.8: Capabilities and Integration

0.8.7 requires Python 3.12+ and bundles Web companion `0.3.18`.
0.8.8 requires Python 3.12+ and bundles Web companion `0.3.18`.
This table describes this version. Before installing, check that the GitHub Release and both PyPI
distributions use the expected version.

See the [0.8.8 upgrade guide](https://kingsoftcloud.github.io/ksadk-python/en/docs/framework/guides/upgrade-0-8-8/) for Tunnel migration, Memory compatibility, dependency choices, and transport settings. Version 0.8.8 remains a candidate until its GitHub Release is published; use the reviewed wheel for evaluation.

| Capability | Integration |
| --- | --- |
| AG-UI / A2UI | Install the `agui` extra and add structured input, business Schema, and durable checkpoints to your graph. |
Expand All @@ -57,6 +59,10 @@ See [Integration and Configuration](https://kingsoftcloud.github.io/ksadk-python
Model-generated A2UI must pass registered-catalog validation; complex styles can fail. Never present
a generation failure as business success.

## Private tools

Google ADK and LangGraph agents can use one enterprise Connector to call private MCP tools and HTTP APIs. See the [tool tunnel guide and Connector example](https://kingsoftcloud.github.io/ksadk-python/en/docs/framework/guides/tool-tunnel/).

## Runtime Architecture

KsADK converges framework adaptation into stable runtime layers while preserving each framework's native execution semantics:
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ agentengine run -i
agentengine web . --no-open
```

## 0.8.7:能力与接入
## 0.8.8:能力与接入

0.8.7 要求 Python 3.12+,内置 Web companion 为 `0.3.18`。
0.8.8 要求 Python 3.12+,内置 Web companion 为 `0.3.18`。
下表介绍本版本能力;安装前核对 GitHub Release 与两个 PyPI 发行包的版本。

[0.8.8 升级指南](https://kingsoftcloud.github.io/ksadk-python/cn/docs/framework/guides/upgrade-0-8-8/)说明 Tunnel 迁移、Memory 历史兼容、依赖选择和聊天传输配置。正式 GitHub Release 发布前,0.8.8 仍为候选,评估时使用经过审核的 wheel。

| 能力 | 如何接入 |
| --- | --- |
| AG-UI / A2UI | 安装 `agui` extra,在自有图中接入结构化输入、业务 Schema 与持久化 checkpoint。 |
Expand All @@ -57,6 +59,10 @@ agentengine web . --no-open
[A2A](https://kingsoftcloud.github.io/ksadk-python/cn/docs/framework/guides/a2a-runtime/)。
模型生成的 A2UI 仍需通过注册目录校验,复杂样式可能失败;不把生成失败包装为业务成功。

## 企业内网工具

Google ADK 和 LangGraph Agent 可通过同一个企业侧 Connector 调用内网 MCP 工具和 HTTP API。见[工具隧道接入指南与 Connector 示例](https://kingsoftcloud.github.io/ksadk-python/cn/docs/framework/guides/tool-tunnel/)。

## 运行时架构

KsADK 把“框架适配”收敛为稳定的运行时分层,同时保留各框架的原生执行语义:
Expand Down
Loading
Loading