agentkit-sdk-python 0.4.3__py3-none-any.whl → 0.4.4__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.
@@ -24,6 +24,7 @@ from fastapi.responses import StreamingResponse
24
24
  from google.adk.a2a.utils.agent_to_a2a import to_a2a
25
25
  from google.adk.agents.base_agent import BaseAgent
26
26
  from google.adk.agents.run_config import RunConfig, StreamingMode
27
+ from google.adk.apps.app import App
27
28
  from google.adk.artifacts.in_memory_artifact_service import (
28
29
  InMemoryArtifactService,
29
30
  )
@@ -42,8 +43,8 @@ from google.adk.utils.context_utils import Aclosing
42
43
  from google.genai import types
43
44
  from opentelemetry import trace
44
45
  from veadk import Agent
45
- from veadk.memory.short_term_memory import ShortTermMemory
46
46
  from veadk.runner import Runner
47
+ from veadk.memory.short_term_memory import ShortTermMemory
47
48
 
48
49
  from agentkit.apps.agent_server_app.middleware import (
49
50
  AgentkitTelemetryHTTPMiddleware,
@@ -55,27 +56,37 @@ logger = logging.getLogger(__name__)
55
56
 
56
57
 
57
58
  class AgentKitAgentLoader(BaseAgentLoader):
58
- def __init__(self, agent: BaseAgent) -> None:
59
+ def __init__(self, agent_or_app: BaseAgent | App) -> None:
59
60
  super().__init__()
60
61
 
61
- self.agent = agent
62
+ self.agent_or_app = agent_or_app
63
+ if isinstance(agent_or_app, App):
64
+ self.root_agent = agent_or_app.root_agent
65
+ self.app_name = agent_or_app.name or self.root_agent.name
66
+ else:
67
+ self.root_agent = agent_or_app
68
+ self.app_name = agent_or_app.name
62
69
 
63
70
  @override
64
- def load_agent(self, agent_name: str) -> BaseAgent:
65
- return self.agent
71
+ def load_agent(self, agent_name: str) -> BaseAgent | App:
72
+ if agent_name != self.app_name:
73
+ raise ValueError(
74
+ f"Unknown agent '{agent_name}'. Expected '{self.app_name}'."
75
+ )
76
+ return self.agent_or_app
66
77
 
67
78
  @override
68
79
  def list_agents(self) -> list[str]:
69
- return [self.agent.name]
80
+ return [self.app_name]
70
81
 
71
82
  @override
72
83
  def list_agents_detailed(self) -> list[dict[str, Any]]:
73
- name = self.agent.name
74
- description = getattr(self.agent, "description", "") or ""
84
+ name = self.app_name
85
+ description = getattr(self.root_agent, "description", "") or ""
75
86
  return [
76
87
  {
77
88
  "name": name,
78
- "root_agent_name": name,
89
+ "root_agent_name": self.root_agent.name,
79
90
  "description": description,
80
91
  "language": "python",
81
92
  }
@@ -85,11 +96,25 @@ class AgentKitAgentLoader(BaseAgentLoader):
85
96
  class AgentkitAgentServerApp(BaseAgentkitApp):
86
97
  def __init__(
87
98
  self,
88
- agent: BaseAgent,
89
- short_term_memory: BaseSessionService | ShortTermMemory,
99
+ agent: BaseAgent | App | None = None,
100
+ short_term_memory: BaseSessionService | ShortTermMemory | None = None,
101
+ *,
102
+ app: App | None = None,
90
103
  ) -> None:
91
104
  super().__init__()
92
105
 
106
+ if short_term_memory is None:
107
+ raise TypeError("short_term_memory is required.")
108
+
109
+ if app is not None and agent is not None:
110
+ raise TypeError("Only one of 'agent' or 'app' can be provided.")
111
+
112
+ entry = app if app is not None else agent
113
+ if entry is None:
114
+ raise TypeError("Either 'agent' or 'app' must be provided.")
115
+
116
+ root_agent = entry.root_agent if isinstance(entry, App) else entry
117
+
93
118
  _artifact_service = InMemoryArtifactService()
94
119
  _credential_service = InMemoryCredentialService()
95
120
 
@@ -97,12 +122,12 @@ class AgentkitAgentServerApp(BaseAgentkitApp):
97
122
  _eval_set_results_manager = LocalEvalSetResultsManager(agents_dir=".")
98
123
 
99
124
  self.server = AdkWebServer(
100
- agent_loader=AgentKitAgentLoader(agent),
125
+ agent_loader=AgentKitAgentLoader(entry),
101
126
  session_service=short_term_memory
102
127
  if isinstance(short_term_memory, BaseSessionService)
103
128
  else short_term_memory.session_service,
104
- memory_service=agent.long_term_memory
105
- if isinstance(agent, Agent) and agent.long_term_memory
129
+ memory_service=root_agent.long_term_memory
130
+ if isinstance(root_agent, Agent) and root_agent.long_term_memory
106
131
  else InMemoryMemoryService(),
107
132
  artifact_service=_artifact_service,
108
133
  credential_service=_credential_service,
@@ -111,8 +136,8 @@ class AgentkitAgentServerApp(BaseAgentkitApp):
111
136
  agents_dir=".",
112
137
  )
113
138
 
114
- runner = Runner(agent=agent)
115
- _a2a_server_app = to_a2a(agent=agent, runner=runner)
139
+ runner = Runner(agent=root_agent)
140
+ _a2a_server_app = to_a2a(agent=root_agent, runner=runner)
116
141
 
117
142
  @asynccontextmanager
118
143
  async def lifespan(app: FastAPI):
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.4.3"
15
+ VERSION = "0.4.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentkit-sdk-python
3
- Version: 0.4.3
3
+ Version: 0.4.4
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,5 +1,5 @@
1
1
  agentkit/__init__.py,sha256=l27ZMDslc3VhmmnPZJyrqVvTDoZ0LqhCtM5hw0caHcU,1021
2
- agentkit/version.py,sha256=WWpi0MzdPmp_MuiTNwGjRNGOPRdyCUzfNHz9bivjHf4,653
2
+ agentkit/version.py,sha256=gzPlMiiIfnq-nXw3IJopMiKzEmgsppA5t46q-oQRpKY,653
3
3
  agentkit/apps/__init__.py,sha256=-oXTjxV3gejpJ8pffTUcUAXw0LfxKCYZJk-_hIJhtLM,1921
4
4
  agentkit/apps/base_app.py,sha256=3hZZExL1wyTGWveJEZZoqXN086MzmkVS_WU1vyulIWg,754
5
5
  agentkit/apps/utils.py,sha256=IzimIDmT6FS6PV9MLimPh46mq5zT-EjVmnYPxBdyEq0,1934
@@ -7,7 +7,7 @@ agentkit/apps/a2a_app/__init__.py,sha256=pkSabKw7_ai4NOo56pXKL40EcaxIDh6HYxPXOY7
7
7
  agentkit/apps/a2a_app/a2a_app.py,sha256=mFuPFuqRlGdQ2VIjQq2_gtQKWwnkwSjSmIMRnammWJU,7605
8
8
  agentkit/apps/a2a_app/telemetry.py,sha256=vR8tf7EHLor62cxs5PBx4mrfHeOaV1a7Xryqlu8nGCU,4290
9
9
  agentkit/apps/agent_server_app/__init__.py,sha256=pkSabKw7_ai4NOo56pXKL40EcaxIDh6HYxPXOY7qWbo,634
10
- agentkit/apps/agent_server_app/agent_server_app.py,sha256=G0RaXGHOMvdlsbU3aUjSWqqEPvQj55hVM6JCjJlaazc,8895
10
+ agentkit/apps/agent_server_app/agent_server_app.py,sha256=9PQWdhNK5A7d8gYvtHPDqs_lRzPw03DLVbjclFuBfyk,9975
11
11
  agentkit/apps/agent_server_app/middleware.py,sha256=2gLCRN-JYjYsTQzHqRBU69S2OI8gD5AdbrFeoGzDcM0,2962
12
12
  agentkit/apps/agent_server_app/telemetry.py,sha256=js3byvtdPr_anbrptSHtIS3R9MtSPqtKLkVC9kwL7LU,4160
13
13
  agentkit/apps/mcp_app/__init__.py,sha256=pkSabKw7_ai4NOo56pXKL40EcaxIDh6HYxPXOY7qWbo,634
@@ -169,9 +169,9 @@ agentkit/utils/misc.py,sha256=SEAk8e9DGfDm1bZSVbd5AM9EJKyoiIZeLzhg7ddC3w0,3437
169
169
  agentkit/utils/request.py,sha256=IVoat3EavR9rQ_fXi0eA2rZPCJ9lVZAXXn7uIIX6bY4,1614
170
170
  agentkit/utils/template_utils.py,sha256=Qjg9V6dEpjAd_yYezIIPwuDsDeeMmp6XTMn5ZECifNc,6336
171
171
  agentkit/utils/ve_sign.py,sha256=GC5xvcKXNZC-T0j3Klr8TYPItgWcURr7N7lVLPYnldE,8579
172
- agentkit_sdk_python-0.4.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
173
- agentkit_sdk_python-0.4.3.dist-info/METADATA,sha256=RSa1uVC9HcN2SQH6MZf99b218EkrZ9WbNdpei1tDNHY,19384
174
- agentkit_sdk_python-0.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
175
- agentkit_sdk_python-0.4.3.dist-info/entry_points.txt,sha256=fhzZUsvsLXeB4mPaa0SBQiTBqFT404uDAKPaePAOUAE,58
176
- agentkit_sdk_python-0.4.3.dist-info/top_level.txt,sha256=ipy8JF-QQ-V0C1oRFLxsyaW8zwrasfJ-zjAh9vgOc7U,9
177
- agentkit_sdk_python-0.4.3.dist-info/RECORD,,
172
+ agentkit_sdk_python-0.4.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
173
+ agentkit_sdk_python-0.4.4.dist-info/METADATA,sha256=tqk9nvlnE4GI3h9HCDT_taOSBkmne7ex4ZzFxfrFD7s,19384
174
+ agentkit_sdk_python-0.4.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
175
+ agentkit_sdk_python-0.4.4.dist-info/entry_points.txt,sha256=fhzZUsvsLXeB4mPaa0SBQiTBqFT404uDAKPaePAOUAE,58
176
+ agentkit_sdk_python-0.4.4.dist-info/top_level.txt,sha256=ipy8JF-QQ-V0C1oRFLxsyaW8zwrasfJ-zjAh9vgOc7U,9
177
+ agentkit_sdk_python-0.4.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5