smarta2a 0.4.16__py3-none-any.whl → 0.4.18__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.
@@ -41,7 +41,7 @@ class A2AHuman:
41
41
 
42
42
  @self.app.webhook()
43
43
  async def on_webhook(request: WebhookRequest, state: StateData):
44
- pass
44
+ return "Acknowledgement received"
45
45
 
46
46
  def get_app(self):
47
47
  return self.app
@@ -54,15 +54,6 @@ class A2AClient:
54
54
  metadata: dict[str, Any] | None = None,
55
55
  ):
56
56
  """Send a task to another Agent."""
57
-
58
- # Auto-create PushNotificationConfig if not provided and we have a URL
59
- if push_notification is None and self.url:
60
- push_notification = PushNotificationConfig(
61
- url=f"{self.url}/webhook",
62
- token=None,
63
- authentication=None
64
- )
65
-
66
57
  params = TaskRequestBuilder.build_send_task_request(
67
58
  id=id,
68
59
  role=role,
@@ -93,15 +84,6 @@ class A2AClient:
93
84
  metadata: dict[str, Any] | None = None,
94
85
  ):
95
86
  """Send to another Agent and receive a stream of responses."""
96
-
97
- # Auto-create PushNotificationConfig if not provided and we have a URL
98
- if push_notification is None and self.url:
99
- push_notification = PushNotificationConfig(
100
- url=f"{self.url}/webhook",
101
- token=None,
102
- authentication=None
103
- )
104
-
105
87
  params = TaskRequestBuilder.build_send_task_request(
106
88
  id=id,
107
89
  role=role,
@@ -207,6 +189,9 @@ class A2AClient:
207
189
  webhook_url, json=request.model_dump(), timeout=30
208
190
  )
209
191
  response.raise_for_status()
192
+ print("--- response from webhook ---")
193
+ print(response.json())
194
+ print("--- end of response from webhook ---")
210
195
  return response.json()
211
196
  except httpx.HTTPStatusError as e:
212
197
  raise A2AClientHTTPError(e.response.status_code, str(e)) from e
@@ -193,10 +193,12 @@ class OpenAIProvider(BaseLLMProvider):
193
193
 
194
194
  # Call the actual tool
195
195
  try:
196
+
196
197
  override_args = {
197
198
  'id': state.task_id,
198
199
  'sessionId': state.task.sessionId,
199
- 'metadata': state.task.metadata
200
+ 'metadata': state.task.metadata,
201
+ 'pushNotification': state.push_notification_config
200
202
  }
201
203
 
202
204
  tool_result = await self.tools_manager.call_tool(fn_name, fn_args, override_args)
@@ -158,6 +158,9 @@ class RequestHandler:
158
158
  if push_notification_config and forward_to_webhook:
159
159
  try:
160
160
  print("call to send_to_webhook")
161
+ print(push_notification_config.url)
162
+ print(task.model_dump())
163
+ print("--- end ---")
161
164
  self.a2a_aclient.send_to_webhook(webhook_url=push_notification_config.url,id=task_id,task=task.model_dump())
162
165
  except Exception as e:
163
166
  print(f"Error sending task to webhook: {e}")
smarta2a/server/server.py CHANGED
@@ -37,7 +37,6 @@ class SmartA2A:
37
37
  name: str,
38
38
  agent_card: Optional[AgentCard] = None,
39
39
  state_manager: Optional[StateManager] = None,
40
- has_frontend: bool = False,
41
40
  **fastapi_kwargs
42
41
  ):
43
42
  self.name = name
@@ -46,7 +45,6 @@ class SmartA2A:
46
45
  self.state_mgr = state_manager
47
46
  self.app = FastAPI(title=name, **fastapi_kwargs)
48
47
  self.router = APIRouter()
49
- self.has_frontend = has_frontend
50
48
  self._setup_cors()
51
49
  self._setup_routes()
52
50
  self.server_config = {
@@ -10,11 +10,12 @@ from smarta2a.utils.types import Message, StateData, Task, TaskStatus, TaskState
10
10
  from smarta2a.server.nats_client import NATSClient
11
11
 
12
12
  class StateManager:
13
- def __init__(self, state_store: BaseStateStore, file_store: BaseFileStore, history_strategy: HistoryUpdateStrategy, nats_server_url: Optional[str] = "nats://localhost:4222"):
13
+ def __init__(self, state_store: BaseStateStore, file_store: BaseFileStore, history_strategy: HistoryUpdateStrategy, nats_server_url: Optional[str] = "nats://localhost:4222", push_notification_config: Optional[PushNotificationConfig] = None):
14
14
  self.state_store = state_store
15
15
  self.file_store = file_store
16
16
  self.strategy = history_strategy
17
17
  self.nats_client = NATSClient(server_url=nats_server_url)
18
+ self.push_notification_config = push_notification_config
18
19
 
19
20
  async def load(self):
20
21
  await self.nats_client.connect()
@@ -40,11 +41,15 @@ class StateManager:
40
41
  history=[],
41
42
  metadata={}
42
43
  )
44
+
45
+ # Use self.push_notification_config if push_notification_config is None
46
+ notification_config = push_notification_config if push_notification_config is not None else self.push_notification_config
47
+
43
48
  state = StateData(
44
49
  task_id=task_id,
45
50
  task=initial_task,
46
51
  context_history=[],
47
- push_notification_config=push_notification_config
52
+ push_notification_config=notification_config
48
53
  )
49
54
  self.state_store.initialize_state(state)
50
55
  return state
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smarta2a
3
- Version: 0.4.16
3
+ Version: 0.4.18
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
@@ -1,12 +1,12 @@
1
1
  smarta2a/__init__.py,sha256=T_EECYqWrxshix0FbgUv22zlKRX22HFU-HKXcYTOb3w,175
2
2
  smarta2a/agent/a2a_agent.py,sha256=EurcxpV14e3OPWCMutYL0EXMHb5ZKQqAHEGZZF6pNgg,1892
3
- smarta2a/agent/a2a_human.py,sha256=3Zco6cQfNtPRV7f-Qe68Kui2ZvagJdFPY6RTI9SCJik,1642
3
+ smarta2a/agent/a2a_human.py,sha256=yAW9naxyqStQhWwDamXRZIlw-mT_7RW2wcHyhy3rR6Y,1671
4
4
  smarta2a/agent/a2a_mcp_server.py,sha256=X_mxkgYgCA_dSNtCvs0rSlOoWYc-8d3Qyxv0e-a7NKY,1015
5
5
  smarta2a/archive/smart_mcp_client.py,sha256=0s2OWFKWSv-_UF7rb9fOrsh1OIYsYOsGukkXXp_E1cU,4158
6
6
  smarta2a/archive/subscription_service.py,sha256=vftmZD94HbdjPFa_1UBvsBm-WkW-s3ZCVq60fF7OCgA,4109
7
7
  smarta2a/archive/task_service.py,sha256=ptf-oMHy98Rw4XSxyK1-lpqc1JtkCkEEHTmwAaunet4,8199
8
8
  smarta2a/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- smarta2a/client/a2a_client.py,sha256=Tl9FLADlK5n_y_0C3qcFB25T6Uu02iXDSxopm40LbKs,12726
9
+ smarta2a/client/a2a_client.py,sha256=MGhqcIx8reo-HCvgABFiFm8SGjKV7OIjzCdAwYZmDOw,12256
10
10
  smarta2a/client/mcp_client.py,sha256=JeXhBqxM9TYAArpExLRtEr3lZeQZMcnTmGFl6XKsdu8,3797
11
11
  smarta2a/file_stores/base_file_store.py,sha256=fcwFIOoFjLQiIKb8lIRVujnV6udyuI9Dq8cEc2ldmIQ,591
12
12
  smarta2a/file_stores/local_file_store.py,sha256=4GLDrsKxSoLWn2Oha4OD-P2r5vBpfV-8ePvZ5bhP1e8,2616
@@ -16,15 +16,15 @@ smarta2a/history_update_strategies/history_update_strategy.py,sha256=n2sfIGu8ztK
16
16
  smarta2a/history_update_strategies/rolling_window_strategy.py,sha256=7Ch042JWt4TM_r1-sFKlSIxHj8VX1P3ZoqjCvIdeSqA,540
17
17
  smarta2a/model_providers/__init__.py,sha256=hJj0w00JjqTiBgJmHmOWwL6MU_hwmro9xTiX3XYf6ts,148
18
18
  smarta2a/model_providers/base_llm_provider.py,sha256=iQUqjnypl0f2M929iU0WhHoxAE4ek-NUFJPbEnNQ8-4,412
19
- smarta2a/model_providers/openai_provider.py,sha256=dGVnQ94H6-pohUYwT_IzmUf0Nc7BDMJtI_dpjHLL2ak,12131
19
+ smarta2a/model_providers/openai_provider.py,sha256=2i7TJkhDefvDKCrWNLXmVif9yQ4LZuIouZvY6R9LY2c,12220
20
20
  smarta2a/server/__init__.py,sha256=f2X454Ll4vJc02V4JLJHTN-h8u0TBm4d_FkiO4t686U,53
21
21
  smarta2a/server/handler_registry.py,sha256=OVRG5dTvxB7qUNXgsqWxVNxIyRljUShSYxb1gtbi5XM,820
22
22
  smarta2a/server/json_rpc_request_processor.py,sha256=qRB3sfj_n9ImkIOCdaUKMsDmKcO7CiMhaZ4VdQS7Mb4,6993
23
23
  smarta2a/server/nats_client.py,sha256=akyNg1hLd9XYoLSH_qQVs8uoiTQerztgvqu_3TifSgE,1617
24
- smarta2a/server/request_handler.py,sha256=lptvOvptJR7zDNNUFsGmYYGyDIvrjAWCBbikqsRsL7U,26427
24
+ smarta2a/server/request_handler.py,sha256=QPVWWEKAzMAf4TiwXSEuPBiKGn8_f4ahTRs0mo3qjEE,26569
25
25
  smarta2a/server/send_task_handler.py,sha256=fiBeCCHCu9c2H4EJOUc0t3EZgpHVFJy4B_6qZOC140s,6336
26
- smarta2a/server/server.py,sha256=Xdj3WN-Zgxf9RQDoN8_qGMXJgkADb8Dzk3QwgjDDKb4,6882
27
- smarta2a/server/state_manager.py,sha256=mFh0r002sUAzgASkQKEv3ffAAiMtI8kxHxtfGWwVxwA,7666
26
+ smarta2a/server/server.py,sha256=E58tvOjAvHf_gYjST76sPEC5piaNyrHePa9k-fSadZA,6797
27
+ smarta2a/server/state_manager.py,sha256=uSRF-DbfEuV7QtUJqKej53qHg1xADiDPs2a5BiZuU8k,8005
28
28
  smarta2a/server/webhook_request_processor.py,sha256=LAVA4FiICci-6R2htxRf4bSnKFYoNoaQ3zKI83380ZE,5634
29
29
  smarta2a/state_stores/__init__.py,sha256=vafxAqpwvag_cYFH2XKGk3DPmJIWJr4Ioey30yLFkVQ,220
30
30
  smarta2a/state_stores/base_state_store.py,sha256=_3LInM-qepKwwdypJTDNs9-DozBNrKVycwPwUm7bYdU,512
@@ -36,7 +36,7 @@ smarta2a/utils/task_builder.py,sha256=wqSyfVHNTaXuGESu09dhlaDi7D007gcN3-8tH-nPQ4
36
36
  smarta2a/utils/task_request_builder.py,sha256=6cOGOqj2Rg43xWM03GRJQzlIZHBptsMCJRp7oD-TDAQ,3362
37
37
  smarta2a/utils/tools_manager.py,sha256=igKYeSi0SaYzd36jUqOMPvnYd5kK55EPQ0X_pdTo5e4,4857
38
38
  smarta2a/utils/types.py,sha256=kzA6Vv5xXfu1sJuxhEXrglI9e9S6eZVIljMnsrQVyN0,13650
39
- smarta2a-0.4.16.dist-info/METADATA,sha256=hQF-hc0ggOlNkO2J-eQOBwu43gmg8GXRhKj3RO2Dbvs,13051
40
- smarta2a-0.4.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
41
- smarta2a-0.4.16.dist-info/licenses/LICENSE,sha256=lDbqrxVnzDMY5KJ8JS1WhvkWE8TJaw-O-CHDy-ecsJA,2095
42
- smarta2a-0.4.16.dist-info/RECORD,,
39
+ smarta2a-0.4.18.dist-info/METADATA,sha256=8Pw03g1wAFMF8To-DyGX3fEzxZFcP805-jyjliIocR8,13051
40
+ smarta2a-0.4.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
41
+ smarta2a-0.4.18.dist-info/licenses/LICENSE,sha256=lDbqrxVnzDMY5KJ8JS1WhvkWE8TJaw-O-CHDy-ecsJA,2095
42
+ smarta2a-0.4.18.dist-info/RECORD,,