Skip to content

feat(a2a): upgrade to a2a-sdk 1.4.0 with dual-stack v0.3/v1.0 support - #1244

Merged
yaozheng-fang merged 22 commits into
mainfrom
feat/a2a-sdk-1.4-upgrade
Dec 4, 2026
Merged

yaozheng-fang merged 22 commits into
mainfrom
feat/a2a-sdk-1.4-upgrade

Conversation

@wujiaming-ai

@wujiaming-ai wujiaming-ai commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Upgrade veadk-python to a2a-sdk 1.4.0 with a default dual-stack (v0.3 + v1.0) compatibility layer, so existing v0.3 peers keep working without configuration changes.

This PR also completes the FaaS public-URL injection flow and fixes three issues found during real cloud smoke testing.

Changes

  • Depend on a2a-sdk[http-server]>=1.4.0,<1.5.0 and agentkit-sdk-python>=0.9.3.
  • Advertise both 0.3 and 1.0 JSON-RPC interfaces and serve both card paths from VeA2AServer, init_app and to_a2a.
  • Keep v0.3 JSON-RPC compatibility via enable_v0_3_compat=True.
  • Add CloudMessage/CloudPart so CloudApp.message_send keeps the historical parts[0].root.text access while supporting a2a 1.x flat parts.
  • Fix the shared httpx client lifecycle in CloudApp and add aclose / close / async with.
  • Migrate TaskStore, executor, identity auth processor, hub client, RemoteVeAgent and the remote Skill transport to a2a 1.x APIs.
  • Require VEADK_A2A_PUBLIC_URL in the FaaS template and use the fastmcp 3.x enable(tags=..., only=True) API.
  • Inject the public URL after deploy, seed a placeholder before the first release, and make repeated deploys idempotent.
  • Fix the code-update path for already-rendered src projects.
  • Keep Runner.run_async introspectable for ADK 2.14.x's A2A executor.
  • Update uv.lock: a2a-sdk 1.4.0, agentkit-sdk-python 0.9.3 from PyPI (no local path).
  • Align the agentkit baseline assertions to >=0.9.3 in the runtime-dependency, Studio TOS and sidecar-wheel metadata tests.
  • Advertise streaming=true on VeA2AServer's AgentCard (the server serves message/stream for both 0.3 and 1.0).
  • Make CloudApp default mode auto-resolve the card from both well-known paths, preferring 1.0, with a v0.3-only fallback when no card is published.

Testing

  • Changed-line coverage: 327/327 = 100% (13 changed modules, base main@ea78f82b).
  • Relevant suite with published agentkit-sdk-python 0.9.3 + a2a-sdk 1.4.0: 131 passed, 16 deselected (14 network upload cases + 2 pre-existing 403 cases).
  • ADK matrix: 2.7.0 / 2.11.0 / 2.14.1, A2A tests 48 passed on each version.
  • Real VeFaaS cloud smoke: first deploy, public URL injection, code update, repeated deploy idempotency, 0.3.26 and 1.4.0 clients (non-streaming + streaming), CloudApp default/card modes, RemoteVeAgent, skill.py, MCP, and A2AHubClient all passed.
  • CloudApp default-mode matrix against real servers: dual-stack veadk → 1.0, 1.0-only → 1.0, 0.3-only via legacy card path → 0.3, no-card endpoint → 0.3 fallback. All returned the expected text.
  • pre-commit passed (ruff, format, secret scanning, dependency policy).

Compatibility notes

  • Public Python signatures are preserved.
  • CloudApp.message_send returns a CloudMessage wrapper that supports both parts[0].root.text and parts[0].text.
  • New FaaS projects must set VEADK_A2A_PUBLIC_URL; existing generated projects need to sync the new src/app.py and deploy.py before redeploying.
  • The template starts with a placeholder public URL for the first release, then the real URL is injected and the function is released again.
  • agentkit 0.9.3 keeps AgentkitA2aApp compatible with both a2a 0.3.x and 1.x.

Remaining before release

  • Full regression, performance baseline and Python 3.10 install matrix (full regression runs in this PR's CI).
  • Existing FaaS projects need the template sync described above.

Links

- depend on a2a-sdk[http-server]>=1.4.0,<1.5.0 and agentkit-sdk-python>=0.9.3
- advertise both 0.3 and 1.0 JSON-RPC interfaces and serve both card paths
  from VeA2AServer, init_app and to_a2a
- keep v0.3 JSON-RPC compatibility via enable_v0_3_compat
- add CloudMessage/CloudPart so CloudApp.message_send keeps the historical
  parts[0].root.text access while supporting a2a 1.x flat parts
- fix CloudApp httpx client lifecycle and add aclose/close/context manager
- migrate TaskStore, executor, identity auth processor, hub client and
  remote agents to a2a 1.x APIs
- require VEADK_A2A_PUBLIC_URL in the FaaS template and enable MCP routes
  with the fastmcp 3.x API
- add tests/a2a/test_a2a_sdk_14.py covering the migration contract
- add VeFaaS.merge_function_envs_and_release, which preserves the
  function's existing env vars and is idempotent
- inject the public URL after a new deploy and after a code update so the
  AgentCard advertises a reachable endpoint instead of 0.0.0.0
- cover merge, skip and platform-env preservation with unit tests
The template validates VEADK_A2A_PUBLIC_URL at import time, but the real
public URL is only known after the first release. Seed a placeholder env on
function creation so the first release can boot, then replace it with the
real URL and release again. This closes the chicken-and-egg gap in the
two-phase FaaS deploy.
ADK 2.14.x's A2A executor calls inspect.signature on the bound
runner.run_async. The interceptor wrapper exposes keyword-only parameters,
which Python rejects for a bound method with 'invalid method signature'.
Wrap the interceptor with a positional *args/**kwargs function so the
signature is introspectable while preserving the interceptor contract.
CloudAgentEngine.update_function_code is called with the rendered `src`
directory by the template's deploy.py, but _update_function_code assumed a
project root and nested it under src/<name>. That broke relative
requirements paths such as local wheels. Detect the rendered src layout and
copy it over the template src directory instead.
The runtime, studio TOS and sidecar wheel metadata tests still asserted the
historical agentkit-sdk-python>=0.8.5 floor. veadk now requires >=0.9.3 so
that a2a-sdk 1.4.0 resolves, so the assertions are updated to the new floor
while still proving the TOS-capable lower bound is preserved.
VeA2AServer serves message/stream for both the 0.3 and 1.0 JSON-RPC
bindings, but its AgentCard advertised streaming=false. A 1.0 client that
honours the card could therefore downgrade to non-streaming message/send.
Advertise the capability that the server actually has.

CloudApp's default mode built a v0.3-only synthetic card, so it could not
reach a 1.0-only peer. Default to auto card resolution instead: try
/.well-known/agent-card.json, then the legacy /.well-known/agent.json, and
let the SDK pick the best interface. If neither path publishes a card, fall
back to the historical v0.3-only card so existing deployments keep working.
use_agent_card=False preserves the old no-fetch behavior; True requires a
card. A successful resolution is cached per instance.

Verified against real servers: dual-stack veadk (1.0), 1.0-only (1.0),
0.3-only with the legacy card path (0.3), and a no-card endpoint (0.3).
Introduce A2AServerConfig with opt-in knobs for the 1.x capabilities and
an AgentCard signer supporting local JWK/PEM keys and Volcano Engine KMS
asymmetric keys. The signer produces a detached JWS over the JCS-canonicalised
card and can publish the matching JWKS to TOS.

Signed-off-by: Codex <codex@openai.com>
Add a bearer-token middleware that validates JWTs against an OIDC issuer/JWKS,
a tenant transport decorator for clients, and task/event/push stores that
scope data by caller and tenant. In-memory mode keeps the historical
single-process behaviour while enforcing per-owner isolation; database mode
uses the SDK's versioned SQLAlchemy stores for multi-replica deployments.

Signed-off-by: Codex <codex@openai.com>
Add a push sender with the SDK's SSRF screen, a store wrapper that applies a
server-wide default webhook while honouring per-task overrides, and the
OpenTelemetry plugin manager. All are opt-in through A2AServerConfig.

Signed-off-by: Codex <codex@openai.com>
Wire REST, OpenTelemetry, input-mode and required-extension validation,
extended card, signing, security schemes, OIDC auth, cluster stores, push
delivery and tenant routing into VeA2AServer. Everything is opt-in and the
default configuration keeps the dual-stack v0.3 + v1.0 behaviour, so existing
callers and VeFaaS deployments are unchanged.

Also attach the tenant to CloudApp and RemoteVeAgent so client-side routing
works with the same server configuration.

Signed-off-by: Codex <codex@openai.com>
@wujiaming-ai
wujiaming-ai force-pushed the feat/a2a-sdk-1.4-upgrade branch 4 times, most recently from a28e6ef to 3ad9a55 Compare December 3, 2026 09:23
Add unit and HTTP contract tests for the config surface, REST transport,
OpenTelemetry spans, input-mode and extension validation, extended card,
signing, tenant scoping, owner isolation and push delivery (default webhook,
SSRF rejection and per-task override).

Signed-off-by: Codex <codex@openai.com>
Cover multi-replica task visibility and cross-replica streaming on AIDAP
Serverless PostgreSQL, database-backed push delivery, OIDC client-credentials
auth with the real Identity Service JWKS, tenant isolation, and AgentCard
signature verification against a TOS-hosted JWKS. The KMS path is included
but skipped until the account activates the KMS service.

Signed-off-by: Codex <codex@openai.com>
@wujiaming-ai
wujiaming-ai force-pushed the feat/a2a-sdk-1.4-upgrade branch from 3ad9a55 to dbb1b5c Compare December 3, 2026 09:27
Volcano Engine KMS returns ASN.1 DER SEQUENCE(r, s) for ECDSA, while JWS
ES256 requires the fixed-width r||s concatenation. Convert the signature
before base64url encoding so KMS-signed cards verify with standard JWKS.

Extend the unit test to assert the request shape and the 64-byte raw
signature, and make the real-cloud KMS test fetch the public key and
verify both a valid and a tampered card.

Signed-off-by: Codex <codex@openai.com>
- Forward initialize() in DefaultingPushNotificationConfigStore so a server
  with both database_url and push_webhook_url starts instead of raising
  AttributeError during lifespan startup.
- Apply the RemoteVeAgent tenant inside _ensure_resolved, after the ADK
  client exists, instead of in __init__ where _a2a_client is still None.
- Unwrap TenantTransportDecorator before auth-header injection so TIP and
  bearer credentials are still applied when tenant routing is enabled.
- Pass the tenant-aware owner resolver into InMemoryTaskStore so tasks are
  filtered before pagination, not after.
- Seed the placeholder VEADK_A2A_PUBLIC_URL before releasing an updated code
  bundle, so apps created before the env existed can boot the new template.

All five findings are covered by unit tests; the DB+push startup path was
also verified against a real AIDAP workspace.

Signed-off-by: Codex <codex@openai.com>
@wujiaming-ai

Copy link
Copy Markdown
Collaborator Author

补充验证(2026-12-04)

新增两个提交:

  • 63902c4a: VeA2AServer 标准路径输出 1.x 形态 card,legacy 路径保留 0.3 card,解决 AgentKit A2A Center 注册时报 protocolVersion and supportedInterfaces cannot be used together。
  • 16c90b36: 新增 A2AServerConfig.card_version,允许本地/dev wheel 使用合法 semver 注册 A2A Center。

真实云端验证(cn-shanghai):

  • 新/旧 client × 新/旧 server 全部 PASS(a2a 1.4.0 ↔ 0.3.26)。
  • A2A Center Runtime 方式注册 PASS,agent a-yf0wd35beonqx7ji6maq status=running;通过 A2A Center card 调用返回 ve-center-ok。
  • Wheel 回归:tests/a2a 146 passed / 6 skipped;tests/test_cloud.py + tests/cli/test_studio_update.py 96 passed;合计 242 passed / 6 skipped。

测试报告:https://bytedance.larkoffice.com/docx/Vd7xdo6A5o15NCxuxbyc6t3rnCn(第 13 章)

@wujiaming-ai

Copy link
Copy Markdown
Collaborator Author

依赖更新

agentkit-sdk-python 0.9.5 已发版(包含 A2A Center card 修复)。本分支已将依赖从 >=0.9.3 提升到 >=0.9.5(f0c83cd9),并同步更新 uv.lock。

验证:

  • 使用 PyPI 发布的 agentkit-sdk-python 0.9.5 + a2a-sdk 1.4.0,运行 tests/a2a + tests/test_cloud.py + tests/cli/test_studio_update.py:242 passed / 6 skipped。
  • 重新构建 veadk wheel veadk_python-1.1.34.dev23+g16c90b362.d20261204,同样 242 passed / 6 skipped。

关联:

@wujiaming-ai

Copy link
Copy Markdown
Collaborator Author

CI 已全绿:26 success / 4 skipped / 0 failure。

依赖基线测试已同步到 agentkit-sdk-python 0.9.5(8a6855ae):

  • test_runtime_dependency_compatibility.py / test_sidecar_wheel.py / test_studio_tos_sdk_dependency.py:6 passed
  • 最终回归:248 passed / 6 skipped

@wujiaming-ai

Copy link
Copy Markdown
Collaborator Author

to_a2a 双路径 card 同步修复

新增提交 ed3de7f9:veadk.a2a.utils.agent_to_a2a.to_a2a 与 VeA2AServer 保持一致。

  • 标准路径 /.well-known/agent-card.json 改为输出 1.x 形态 card(supportedInterfaces + url,去掉顶层 protocolVersion),带 ETag/304。
  • legacy 路径 /.well-known/agent.json 仍输出 0.3 合并 card,protocolVersion=0.3。
  • 修复前:to_a2a 两条路径都输出合并 card,用于 AgentKit A2A Center 注册时会报 protocolVersion and supportedInterfaces cannot be used together。

验证:

  • 真实本地协议矩阵:a2a 1.4.0 client → to_a2a server 返回 pong;a2a 0.3.26 client → 同一 server 返回 pong。
  • 单测 test_to_a2a_serves_dual_stack_card 覆盖两条路径的 card 形态。
  • 回归:源码 248 passed / 6 skipped;wheel tests/a2a 146 passed / 6 skipped。
  • CI 全绿:Unit Tests 3.10 / 3.12 + codex-smoke 全部 success(25 success / 4 skipped)。注:3.12 首次运行遇到 xdist worker gw14 node down(runner 收到 shutdown 信号),属基础设施偶发,重跑同一 commit 通过。

测试报告(第 13.12 节):https://bytedance.larkoffice.com/docx/Vd7xdo6A5o15NCxuxbyc6t3rnCn

@yaozheng-fang
yaozheng-fang merged commit 0f942ea into main Dec 4, 2026
30 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants