agentkit-sdk-python 0.9.3__py3-none-any.whl → 0.9.5__py3-none-any.whl

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.
@@ -12,10 +12,12 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import hashlib
16
+ import inspect
17
+ import json
15
18
  import logging
16
19
  import os
17
20
  import uvicorn
18
- import inspect
19
21
 
20
22
  from typing import Callable
21
23
  from typing_extensions import override
@@ -47,6 +49,26 @@ except ImportError: # a2a-sdk 0.3.x
47
49
  _A2A_1X = False
48
50
 
49
51
 
52
+ def _agent_card_1x_payload(agent_card: AgentCard) -> dict:
53
+ """Return a 1.x-shaped AgentCard payload accepted by AgentKit A2A Center.
54
+
55
+ a2a-sdk's compatibility layer injects a top-level ``protocolVersion`` next
56
+ to ``supportedInterfaces``. AgentKit A2A Center rejects that combination
57
+ with ``protocolVersion and supportedInterfaces cannot be used together``.
58
+ Keep the legacy shape on ``/.well-known/agent.json`` and serve this 1.x
59
+ shape on the standard card path.
60
+ """
61
+ from a2a.server.request_handlers.response_helpers import agent_card_to_dict
62
+
63
+ payload = agent_card_to_dict(agent_card)
64
+ payload.pop("protocolVersion", None)
65
+ # Keep the legacy ``url`` for clients that do not understand
66
+ # ``supportedInterfaces`` yet (for example a 1.0-only card).
67
+ if not payload.get("url") and payload.get("supportedInterfaces"):
68
+ payload["url"] = payload["supportedInterfaces"][0]["url"]
69
+ return payload
70
+
71
+
50
72
  def _wrap_agent_executor_execute_func(execute_func: Callable) -> Callable:
51
73
  async def wrapper(*args, **kwargs):
52
74
  executor_instance: AgentExecutor = args[0]
@@ -242,9 +264,26 @@ class AgentkitA2aApp(BaseAgentkitApp):
242
264
  task_store=task_store,
243
265
  agent_card=agent_card,
244
266
  )
267
+
268
+ async def _serve_1x_card(request: Request) -> Response:
269
+ payload = _agent_card_1x_payload(agent_card)
270
+ body = json.dumps(payload, ensure_ascii=False, separators=(",", ":"))
271
+ etag = f'"{hashlib.sha256(body.encode("utf-8")).hexdigest()[:32]}"'
272
+ if request.headers.get("if-none-match") == etag:
273
+ return Response(status_code=304, headers={"ETag": etag})
274
+ return Response(
275
+ content=body,
276
+ media_type="application/json",
277
+ headers={"ETag": etag},
278
+ )
279
+
245
280
  return Starlette(
246
281
  routes=[
247
- *create_agent_card_routes(agent_card),
282
+ Route(
283
+ "/.well-known/agent-card.json",
284
+ endpoint=_serve_1x_card,
285
+ methods=["GET"],
286
+ ),
248
287
  *create_agent_card_routes(
249
288
  agent_card, card_url="/.well-known/agent.json"
250
289
  ),
agentkit/version.py CHANGED
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- VERSION = "0.9.3"
15
+ VERSION = "0.9.5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentkit-sdk-python
3
- Version: 0.9.3
3
+ Version: 0.9.5
4
4
  Summary: Python SDK for transforming any AI agent into a production-ready application. Framework-agnostic primitives for runtime, memory, authentication, and tools with volcengine-managed infrastructure.
5
5
  Author-email: Xiangrui Cheng <innsdcc@gmail.com>, Yumeng Bao <baoyumeng.123@gmail.com>, Yaozheng Fang <fangyozheng@gmail.com>, Guodong Li <cu.eric.lee@gmail.com>
6
6
  License: Apache License
@@ -1,11 +1,11 @@
1
1
  agentkit/__init__.py,sha256=g-oF63KFkVpw7_JJ142RIrW9o5ThR8N28VaMFaFsZjQ,1071
2
2
  agentkit/errors.py,sha256=UWlXv0ZsXd_oLTMlxuf4u9-XkTdRYeVZueE--Z3JsHU,1214
3
- agentkit/version.py,sha256=5fy5kHzvh-kP4Z0MRTFYGaGkBIm9PHRn0hIaKeJGraY,653
3
+ agentkit/version.py,sha256=iJLEbgNMuC1YqERRDnZ_nWxskNDc5x5GEzodoPAn_AA,653
4
4
  agentkit/apps/__init__.py,sha256=_Na1A4NSaMbVfPbsFKj2U-yI5mytD7W5skMaAOGbauY,2328
5
5
  agentkit/apps/base_app.py,sha256=3hZZExL1wyTGWveJEZZoqXN086MzmkVS_WU1vyulIWg,754
6
6
  agentkit/apps/utils.py,sha256=IzimIDmT6FS6PV9MLimPh46mq5zT-EjVmnYPxBdyEq0,1934
7
7
  agentkit/apps/a2a_app/__init__.py,sha256=pkSabKw7_ai4NOo56pXKL40EcaxIDh6HYxPXOY7qWbo,634
8
- agentkit/apps/a2a_app/a2a_app.py,sha256=0HeN4J36aSTYePyVOObt68IjnY7KOrftpmck5EdFMkg,9744
8
+ agentkit/apps/a2a_app/a2a_app.py,sha256=oV6dZysD_WnICOGdU5nq3liMlFqQB_xYpYnpeDdFZkc,11418
9
9
  agentkit/apps/a2a_app/telemetry.py,sha256=vR8tf7EHLor62cxs5PBx4mrfHeOaV1a7Xryqlu8nGCU,4290
10
10
  agentkit/apps/agent_server_app/__init__.py,sha256=pkSabKw7_ai4NOo56pXKL40EcaxIDh6HYxPXOY7qWbo,634
11
11
  agentkit/apps/agent_server_app/agent_server_app.py,sha256=ZNhmBtazxQKyfHsLPl8GDJsausziXtYfAsdO3be06jQ,28620
@@ -303,9 +303,9 @@ agentkit_identity/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
303
303
  agentkit_identity/runtime.py,sha256=hQHLvbAK760teFPTGZ0RG9Ed5DQAXAqIdaAm9ojzS34,14423
304
304
  agentkit_identity/transport.py,sha256=kwGHSEQ5Qcn1kIu6N6DVid7MdDUMj5uaIRIUA_tJ3cM,7693
305
305
  agentkit_identity/types.py,sha256=lT8KQz1pG0rgdy5Gh6WnM0mq9VqCsWSE41Z8Fw3DHZo,7358
306
- agentkit_sdk_python-0.9.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
307
- agentkit_sdk_python-0.9.3.dist-info/METADATA,sha256=lXM3_n75dOTN9qSLbUs3xtEMPrnUXPVD-vjm5ylHnlE,21540
308
- agentkit_sdk_python-0.9.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
309
- agentkit_sdk_python-0.9.3.dist-info/entry_points.txt,sha256=fhzZUsvsLXeB4mPaa0SBQiTBqFT404uDAKPaePAOUAE,58
310
- agentkit_sdk_python-0.9.3.dist-info/top_level.txt,sha256=Kw8DVx7vzg-oUh7xC_hBZw7OwKW3Y_fo_8rkWOL1d5o,27
311
- agentkit_sdk_python-0.9.3.dist-info/RECORD,,
306
+ agentkit_sdk_python-0.9.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
307
+ agentkit_sdk_python-0.9.5.dist-info/METADATA,sha256=Qp5BI23cBUu3qVZ-VZRONipfhvgz1aGuxIm8yJ2GBd0,21540
308
+ agentkit_sdk_python-0.9.5.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
309
+ agentkit_sdk_python-0.9.5.dist-info/entry_points.txt,sha256=fhzZUsvsLXeB4mPaa0SBQiTBqFT404uDAKPaePAOUAE,58
310
+ agentkit_sdk_python-0.9.5.dist-info/top_level.txt,sha256=Kw8DVx7vzg-oUh7xC_hBZw7OwKW3Y_fo_8rkWOL1d5o,27
311
+ agentkit_sdk_python-0.9.5.dist-info/RECORD,,