smarta2a 0.4.3__py3-none-any.whl → 0.4.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.
- smarta2a/client/mcp_client.py +14 -11
- smarta2a/model_providers/openai_provider.py +4 -2
- smarta2a/server/server.py +0 -11
- smarta2a/server/state_manager.py +3 -0
- smarta2a/utils/tools_manager.py +6 -0
- {smarta2a-0.4.3.dist-info → smarta2a-0.4.5.dist-info}/METADATA +1 -1
- {smarta2a-0.4.3.dist-info → smarta2a-0.4.5.dist-info}/RECORD +9 -9
- {smarta2a-0.4.3.dist-info → smarta2a-0.4.5.dist-info}/WHEEL +0 -0
- {smarta2a-0.4.3.dist-info → smarta2a-0.4.5.dist-info}/licenses/LICENSE +0 -0
smarta2a/client/mcp_client.py
CHANGED
@@ -37,27 +37,30 @@ class MCPClient:
|
|
37
37
|
command = None
|
38
38
|
args = [server_script_path]
|
39
39
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
command =
|
40
|
+
# Split the path to check for package manager commands
|
41
|
+
split_args = shlex.split(server_script_path)
|
42
|
+
if split_args and split_args[0] in ("npm", "npx", "uv", "uvx"):
|
43
|
+
# Handle package manager command
|
44
|
+
is_javascript = True # Assuming uv/uvx are JS-related tools
|
45
|
+
command = split_args[0]
|
46
|
+
args = split_args[1:] if len(split_args) > 1 else []
|
46
47
|
else:
|
47
|
-
#
|
48
|
+
# Check file extensions
|
48
49
|
is_python = server_script_path.endswith(".py")
|
49
50
|
is_javascript = server_script_path.endswith(".js")
|
50
51
|
if not (is_python or is_javascript):
|
51
|
-
raise ValueError(
|
52
|
-
|
53
|
-
|
52
|
+
raise ValueError(
|
53
|
+
"Server script must be a .py, .js file, or a npm/npx/uv/uvx command."
|
54
|
+
)
|
54
55
|
|
56
|
+
command = "python" if is_python else "node"
|
57
|
+
args = [server_script_path]
|
58
|
+
|
55
59
|
server_params = StdioServerParameters(
|
56
60
|
command=command,
|
57
61
|
args=args,
|
58
62
|
env=None
|
59
63
|
)
|
60
|
-
print(server_params)
|
61
64
|
|
62
65
|
# Start the server
|
63
66
|
stdio_transport = await self.exit_stack.enter_async_context(stdio_client(server_params))
|
@@ -147,6 +147,7 @@ class OpenAIProvider(BaseLLMProvider):
|
|
147
147
|
"description": tool.description,
|
148
148
|
"parameters": tool.inputSchema,
|
149
149
|
})
|
150
|
+
|
150
151
|
return functions
|
151
152
|
|
152
153
|
|
@@ -192,9 +193,10 @@ class OpenAIProvider(BaseLLMProvider):
|
|
192
193
|
try:
|
193
194
|
override_args = {
|
194
195
|
'id': state.task_id,
|
195
|
-
'sessionId': state.task.sessionId
|
196
|
+
'sessionId': state.task.sessionId,
|
197
|
+
'metadata': state.task.metadata
|
196
198
|
}
|
197
|
-
|
199
|
+
|
198
200
|
tool_result = await self.tools_manager.call_tool(fn_name, fn_args, override_args)
|
199
201
|
except Exception as e:
|
200
202
|
tool_result = {"content": f"Error calling {fn_name}: {e}"}
|
smarta2a/server/server.py
CHANGED
@@ -134,17 +134,6 @@ class SmartA2A:
|
|
134
134
|
|
135
135
|
return response.model_dump()
|
136
136
|
|
137
|
-
|
138
|
-
'''
|
139
|
-
|
140
|
-
if self.has_frontend:
|
141
|
-
if not os.path.exists("frontend/index.html"):
|
142
|
-
raise FileNotFoundError("frontend/index.html does not exist")
|
143
|
-
|
144
|
-
@self.app.get("/")
|
145
|
-
async def get_frontend():
|
146
|
-
return FileResponse("frontend/index.html")
|
147
|
-
'''
|
148
137
|
|
149
138
|
'''
|
150
139
|
Setup the decorators for the various A2A methods.
|
smarta2a/server/state_manager.py
CHANGED
@@ -166,6 +166,9 @@ class StateManager:
|
|
166
166
|
|
167
167
|
def _prepare_update_payload(self, state: StateData) -> Dict[str, Any]:
|
168
168
|
"""Prepare NATS message payload from state data"""
|
169
|
+
print("--- state.task ---")
|
170
|
+
print(state.task)
|
171
|
+
print("--- end of state.task ---")
|
169
172
|
return {
|
170
173
|
"taskId": state.task_id,
|
171
174
|
"taskName": state.task.metadata.get("taskName", ""),
|
smarta2a/utils/tools_manager.py
CHANGED
@@ -91,7 +91,13 @@ class ToolsManager:
|
|
91
91
|
client = self.get_client(tool_key)
|
92
92
|
tool_name = self._get_tool_name(tool_key)
|
93
93
|
new_args = self._replace_with_override_args(args, override_args)
|
94
|
+
print("--- new_args ---")
|
95
|
+
print(new_args)
|
96
|
+
print("--- end of new_args ---")
|
94
97
|
result = await client.call_tool(tool_name, new_args)
|
98
|
+
print("--- result ---")
|
99
|
+
print(result)
|
100
|
+
print("--- end of result ---")
|
95
101
|
return result
|
96
102
|
|
97
103
|
except Exception as e:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: smarta2a
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.5
|
4
4
|
Summary: a Python framework that helps you build servers and AI agents that communicate using the A2A protocol
|
5
5
|
Project-URL: Homepage, https://github.com/siddharthsma/smarta2a
|
6
6
|
Project-URL: Bug Tracker, https://github.com/siddharthsma/smarta2a/issues
|
@@ -7,22 +7,22 @@ smarta2a/archive/subscription_service.py,sha256=vftmZD94HbdjPFa_1UBvsBm-WkW-s3ZC
|
|
7
7
|
smarta2a/archive/task_service.py,sha256=ptf-oMHy98Rw4XSxyK1-lpqc1JtkCkEEHTmwAaunet4,8199
|
8
8
|
smarta2a/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
smarta2a/client/a2a_client.py,sha256=apDkKFtq61T79LpkbkzVTKWA0mSjR_eTNdGPUYozyvk,12100
|
10
|
-
smarta2a/client/mcp_client.py,sha256=
|
10
|
+
smarta2a/client/mcp_client.py,sha256=JeXhBqxM9TYAArpExLRtEr3lZeQZMcnTmGFl6XKsdu8,3797
|
11
11
|
smarta2a/history_update_strategies/__init__.py,sha256=x5WtiE9rG5ze8d8hA6E6wJOciBhWHa_ZgGgoIAZcXEQ,213
|
12
12
|
smarta2a/history_update_strategies/append_strategy.py,sha256=j7Qbhs69Wwr-HBLB8GJ3-mEPaBSHiBV2xz9ZZi86k2w,312
|
13
13
|
smarta2a/history_update_strategies/history_update_strategy.py,sha256=n2sfIGu8ztKI7gJTwRX26m4tZr28B8Xdhrk6RlBFlI8,373
|
14
14
|
smarta2a/history_update_strategies/rolling_window_strategy.py,sha256=7Ch042JWt4TM_r1-sFKlSIxHj8VX1P3ZoqjCvIdeSqA,540
|
15
15
|
smarta2a/model_providers/__init__.py,sha256=hJj0w00JjqTiBgJmHmOWwL6MU_hwmro9xTiX3XYf6ts,148
|
16
16
|
smarta2a/model_providers/base_llm_provider.py,sha256=iQUqjnypl0f2M929iU0WhHoxAE4ek-NUFJPbEnNQ8-4,412
|
17
|
-
smarta2a/model_providers/openai_provider.py,sha256=
|
17
|
+
smarta2a/model_providers/openai_provider.py,sha256=bkB40syLlRJXdh6J4XbfPpWmimygtEaL3hc5qF-L8uI,12166
|
18
18
|
smarta2a/server/__init__.py,sha256=f2X454Ll4vJc02V4JLJHTN-h8u0TBm4d_FkiO4t686U,53
|
19
19
|
smarta2a/server/handler_registry.py,sha256=OVRG5dTvxB7qUNXgsqWxVNxIyRljUShSYxb1gtbi5XM,820
|
20
20
|
smarta2a/server/json_rpc_request_processor.py,sha256=qRB3sfj_n9ImkIOCdaUKMsDmKcO7CiMhaZ4VdQS7Mb4,6993
|
21
21
|
smarta2a/server/nats_client.py,sha256=akyNg1hLd9XYoLSH_qQVs8uoiTQerztgvqu_3TifSgE,1617
|
22
22
|
smarta2a/server/request_handler.py,sha256=5KMtfpHQX6bOgk1DJbhs1fUCQ5tSvMYXWzheT3IW2Bo,26374
|
23
23
|
smarta2a/server/send_task_handler.py,sha256=fiBeCCHCu9c2H4EJOUc0t3EZgpHVFJy4B_6qZOC140s,6336
|
24
|
-
smarta2a/server/server.py,sha256=
|
25
|
-
smarta2a/server/state_manager.py,sha256=
|
24
|
+
smarta2a/server/server.py,sha256=A0AC5hhgYv9xwpO3s6K1M8ETQztrurWD9UP1_xUT8Z4,6741
|
25
|
+
smarta2a/server/state_manager.py,sha256=omjN3C9Sl4hqw5FepnX2qBm1do6QTSE5P9uip78dvEI,6807
|
26
26
|
smarta2a/server/webhook_request_processor.py,sha256=_0XoUDmueSl9CvFQE-1zgKRSts-EW8QxbmolPTfFER8,5306
|
27
27
|
smarta2a/state_stores/__init__.py,sha256=vafxAqpwvag_cYFH2XKGk3DPmJIWJr4Ioey30yLFkVQ,220
|
28
28
|
smarta2a/state_stores/base_state_store.py,sha256=_3LInM-qepKwwdypJTDNs9-DozBNrKVycwPwUm7bYdU,512
|
@@ -32,9 +32,9 @@ smarta2a/utils/agent_discovery_manager.py,sha256=6KpRSQH_EDUOZbF4wFRsZneZGIPLXFP
|
|
32
32
|
smarta2a/utils/prompt_helpers.py,sha256=M3UUjFQEspEAnNm54Dip0-D7mMFFZLrP_s_89ZPe6fs,1438
|
33
33
|
smarta2a/utils/task_builder.py,sha256=wqSyfVHNTaXuGESu09dhlaDi7D007gcN3-8tH-nPQ40,5159
|
34
34
|
smarta2a/utils/task_request_builder.py,sha256=6cOGOqj2Rg43xWM03GRJQzlIZHBptsMCJRp7oD-TDAQ,3362
|
35
|
-
smarta2a/utils/tools_manager.py,sha256=
|
35
|
+
smarta2a/utils/tools_manager.py,sha256=B-lW55qUw2ZX9oJ4--L4ozhN83t742BmIuqGza64YQs,4535
|
36
36
|
smarta2a/utils/types.py,sha256=kzA6Vv5xXfu1sJuxhEXrglI9e9S6eZVIljMnsrQVyN0,13650
|
37
|
-
smarta2a-0.4.
|
38
|
-
smarta2a-0.4.
|
39
|
-
smarta2a-0.4.
|
40
|
-
smarta2a-0.4.
|
37
|
+
smarta2a-0.4.5.dist-info/METADATA,sha256=YBTsM4vXjhqf8-7rUXquIHpu5GbfrZGO6yNfBgYL-0E,12987
|
38
|
+
smarta2a-0.4.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
39
|
+
smarta2a-0.4.5.dist-info/licenses/LICENSE,sha256=lDbqrxVnzDMY5KJ8JS1WhvkWE8TJaw-O-CHDy-ecsJA,2095
|
40
|
+
smarta2a-0.4.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|