solace-agent-mesh 1.4.12__py3-none-any.whl → 1.5.0__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.

Potentially problematic release.


This version of solace-agent-mesh might be problematic. Click here for more details.

Files changed (181) hide show
  1. solace_agent_mesh/agent/adk/adk_llm.txt +3 -4
  2. solace_agent_mesh/agent/adk/adk_llm_detail.txt +566 -0
  3. solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
  4. solace_agent_mesh/agent/adk/callbacks.py +51 -2
  5. solace_agent_mesh/agent/adk/models/lite_llm.py +1 -0
  6. solace_agent_mesh/agent/adk/models/models_llm.txt +1 -2
  7. solace_agent_mesh/agent/agent_llm.txt +1 -1
  8. solace_agent_mesh/agent/agent_llm_detail.txt +1702 -0
  9. solace_agent_mesh/agent/protocol/event_handlers.py +2 -13
  10. solace_agent_mesh/agent/protocol/protocol_llm.txt +15 -2
  11. solace_agent_mesh/agent/protocol/protocol_llm_detail.txt +92 -0
  12. solace_agent_mesh/agent/sac/component.py +51 -21
  13. solace_agent_mesh/agent/sac/sac_llm.txt +15 -1
  14. solace_agent_mesh/agent/sac/sac_llm_detail.txt +200 -0
  15. solace_agent_mesh/agent/sac/task_execution_context.py +73 -0
  16. solace_agent_mesh/agent/testing/testing_llm_detail.txt +68 -0
  17. solace_agent_mesh/agent/tools/tools_llm.txt +148 -154
  18. solace_agent_mesh/agent/tools/tools_llm_detail.txt +274 -0
  19. solace_agent_mesh/agent/utils/utils_llm.txt +1 -1
  20. solace_agent_mesh/agent/utils/utils_llm_detail.txt +149 -0
  21. solace_agent_mesh/assets/docs/404.html +3 -3
  22. solace_agent_mesh/assets/docs/assets/js/483cef9a.bf9398af.js +1 -0
  23. solace_agent_mesh/assets/docs/assets/js/{main.f67fc9f4.js → main.0c149855.js} +2 -2
  24. solace_agent_mesh/assets/docs/assets/js/{runtime~main.40527046.js → runtime~main.c66557e4.js} +1 -1
  25. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +3 -3
  26. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/rbac-setup-guilde/index.html +3 -3
  27. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +8 -4
  28. solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
  29. solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +3 -3
  30. solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +3 -3
  31. solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
  32. solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +3 -3
  33. solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +3 -3
  34. solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +3 -3
  35. solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +3 -3
  36. solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +3 -3
  37. solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +3 -3
  38. solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +3 -3
  39. solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +3 -3
  40. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
  41. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/litellm_models/index.html +3 -3
  42. solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +3 -3
  43. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
  44. solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +3 -3
  45. solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +3 -3
  46. solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +3 -3
  47. solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +3 -3
  48. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +3 -3
  49. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +3 -3
  50. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +3 -3
  51. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +3 -3
  52. solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +3 -3
  53. solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +3 -3
  54. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +3 -3
  55. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +3 -3
  56. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +3 -3
  57. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +3 -3
  58. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +3 -3
  59. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +3 -3
  60. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +3 -3
  61. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +3 -3
  62. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +3 -3
  63. solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +3 -3
  64. solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +3 -3
  65. solace_agent_mesh/assets/docs/lunr-index-1760032255022.json +1 -0
  66. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  67. solace_agent_mesh/assets/docs/search-doc-1760032255022.json +1 -0
  68. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  69. solace_agent_mesh/cli/__init__.py +1 -1
  70. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-j1LW-wlq.js → authCallback-DwrxZE0E.js} +1 -1
  71. solace_agent_mesh/client/webui/frontend/static/assets/{client-B9p_nFNA.js → client-DarGQzyw.js} +1 -1
  72. solace_agent_mesh/client/webui/frontend/static/assets/main-CZbpmwfA.css +1 -0
  73. solace_agent_mesh/client/webui/frontend/static/assets/main-C__uuUkB.js +339 -0
  74. solace_agent_mesh/client/webui/frontend/static/assets/{vendor-CS5YMf8a.js → vendor-BKIeiHj_.js} +80 -70
  75. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
  76. solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
  77. solace_agent_mesh/common/a2a/a2a_llm.txt +1 -1
  78. solace_agent_mesh/common/a2a/a2a_llm_detail.txt +193 -0
  79. solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +1 -1
  80. solace_agent_mesh/common/a2a_spec/a2a_spec_llm_detail.txt +736 -0
  81. solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +23 -0
  82. solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +93 -15
  83. solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +23 -0
  84. solace_agent_mesh/common/common_llm.txt +24 -39
  85. solace_agent_mesh/common/common_llm_detail.txt +2562 -0
  86. solace_agent_mesh/common/data_parts.py +9 -1
  87. solace_agent_mesh/common/middleware/middleware_llm_detail.txt +185 -0
  88. solace_agent_mesh/common/sac/sac_llm.txt +1 -1
  89. solace_agent_mesh/common/sac/sac_llm_detail.txt +82 -0
  90. solace_agent_mesh/common/sam_events/sam_events_llm.txt +104 -0
  91. solace_agent_mesh/common/sam_events/sam_events_llm_detail.txt +115 -0
  92. solace_agent_mesh/common/services/services_llm.txt +57 -6
  93. solace_agent_mesh/common/services/services_llm_detail.txt +459 -0
  94. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
  95. solace_agent_mesh/common/utils/utils_llm.txt +75 -87
  96. solace_agent_mesh/common/utils/utils_llm_detail.txt +572 -0
  97. solace_agent_mesh/core_a2a/core_a2a_llm_detail.txt +101 -0
  98. solace_agent_mesh/gateway/base/app.py +1 -1
  99. solace_agent_mesh/gateway/base/base_llm.txt +1 -1
  100. solace_agent_mesh/gateway/base/base_llm_detail.txt +235 -0
  101. solace_agent_mesh/gateway/gateway_llm.txt +242 -235
  102. solace_agent_mesh/gateway/gateway_llm_detail.txt +3885 -0
  103. solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +295 -0
  104. solace_agent_mesh/gateway/http_sse/alembic/env.py +10 -1
  105. solace_agent_mesh/gateway/http_sse/alembic/versions/20251006_98882922fa59_add_tasks_events_feedback_chat_tasks.py +190 -0
  106. solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +155 -0
  107. solace_agent_mesh/gateway/http_sse/alembic.ini +1 -1
  108. solace_agent_mesh/gateway/http_sse/app.py +148 -2
  109. solace_agent_mesh/gateway/http_sse/component.py +368 -60
  110. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +46 -6
  111. solace_agent_mesh/gateway/http_sse/components/task_logger_forwarder.py +108 -0
  112. solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +1 -1
  113. solace_agent_mesh/gateway/http_sse/dependencies.py +116 -26
  114. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +172 -172
  115. solace_agent_mesh/gateway/http_sse/http_sse_llm_detail.txt +3278 -0
  116. solace_agent_mesh/gateway/http_sse/main.py +146 -41
  117. solace_agent_mesh/gateway/http_sse/repository/__init__.py +3 -12
  118. solace_agent_mesh/gateway/http_sse/repository/chat_task_repository.py +103 -0
  119. solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +5 -3
  120. solace_agent_mesh/gateway/http_sse/repository/entities/chat_task.py +75 -0
  121. solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +263 -0
  122. solace_agent_mesh/gateway/http_sse/repository/entities/feedback.py +20 -0
  123. solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +0 -16
  124. solace_agent_mesh/gateway/http_sse/repository/entities/task.py +25 -0
  125. solace_agent_mesh/gateway/http_sse/repository/entities/task_event.py +21 -0
  126. solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +81 -0
  127. solace_agent_mesh/gateway/http_sse/repository/interfaces.py +73 -18
  128. solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -5
  129. solace_agent_mesh/gateway/http_sse/repository/models/chat_task_model.py +31 -0
  130. solace_agent_mesh/gateway/http_sse/repository/models/feedback_model.py +21 -0
  131. solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +266 -0
  132. solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +3 -3
  133. solace_agent_mesh/gateway/http_sse/repository/models/task_event_model.py +25 -0
  134. solace_agent_mesh/gateway/http_sse/repository/models/task_model.py +32 -0
  135. solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +340 -0
  136. solace_agent_mesh/gateway/http_sse/repository/session_repository.py +4 -53
  137. solace_agent_mesh/gateway/http_sse/repository/task_repository.py +173 -0
  138. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +1 -1
  139. solace_agent_mesh/gateway/http_sse/routers/config.py +26 -4
  140. solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +346 -0
  141. solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +3 -3
  142. solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +83 -0
  143. solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +2 -10
  144. solace_agent_mesh/gateway/http_sse/routers/dto/requests/task_requests.py +58 -0
  145. solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +5 -3
  146. solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +107 -0
  147. solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +1 -15
  148. solace_agent_mesh/gateway/http_sse/routers/dto/responses/task_responses.py +30 -0
  149. solace_agent_mesh/gateway/http_sse/routers/feedback.py +37 -0
  150. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +255 -204
  151. solace_agent_mesh/gateway/http_sse/routers/sessions.py +220 -40
  152. solace_agent_mesh/gateway/http_sse/routers/tasks.py +168 -42
  153. solace_agent_mesh/gateway/http_sse/services/data_retention_service.py +272 -0
  154. solace_agent_mesh/gateway/http_sse/services/feedback_service.py +241 -0
  155. solace_agent_mesh/gateway/http_sse/services/people_service.py +0 -80
  156. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +177 -13
  157. solace_agent_mesh/gateway/http_sse/services/session_service.py +151 -84
  158. solace_agent_mesh/gateway/http_sse/services/task_logger_service.py +317 -0
  159. solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +25 -14
  160. solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +285 -0
  161. solace_agent_mesh/gateway/http_sse/shared/types.py +7 -0
  162. solace_agent_mesh/gateway/http_sse/utils/__init__.py +1 -0
  163. solace_agent_mesh/gateway/http_sse/utils/stim_utils.py +32 -0
  164. solace_agent_mesh/gateway/http_sse/utils/utils_llm.txt +47 -0
  165. solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
  166. solace_agent_mesh/solace_agent_mesh_llm_detail.txt +8599 -0
  167. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.0.dist-info}/METADATA +1 -1
  168. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.0.dist-info}/RECORD +172 -124
  169. solace_agent_mesh/agent/adk/invocation_monitor.py +0 -295
  170. solace_agent_mesh/assets/docs/assets/js/483cef9a.4736f2d8.js +0 -1
  171. solace_agent_mesh/assets/docs/lunr-index-1759936913198.json +0 -1
  172. solace_agent_mesh/assets/docs/search-doc-1759936913198.json +0 -1
  173. solace_agent_mesh/client/webui/frontend/static/assets/main-ChRwcV89.css +0 -1
  174. solace_agent_mesh/client/webui/frontend/static/assets/main-DnnE01OM.js +0 -339
  175. solace_agent_mesh/gateway/http_sse/repository/entities/message.py +0 -41
  176. solace_agent_mesh/gateway/http_sse/repository/message_repository.py +0 -84
  177. solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +0 -45
  178. /solace_agent_mesh/assets/docs/assets/js/{main.f67fc9f4.js.LICENSE.txt → main.0c149855.js.LICENSE.txt} +0 -0
  179. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.0.dist-info}/WHEEL +0 -0
  180. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.0.dist-info}/entry_points.txt +0 -0
  181. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -97,19 +97,6 @@ async def process_event(component, event: Event):
97
97
  component.log_identifier,
98
98
  )
99
99
  return
100
- if component.invocation_monitor:
101
- component.invocation_monitor.log_message_event(
102
- direction="RECEIVED",
103
- topic=topic,
104
- payload=message.get_payload(),
105
- component_identifier=component.log_identifier,
106
- )
107
- else:
108
- log.warning(
109
- "%s InvocationMonitor not available in component for event on topic %s",
110
- component.log_identifier,
111
- topic,
112
- )
113
100
  namespace = component.get_config("namespace")
114
101
  agent_name = component.get_config("agent_name")
115
102
  agent_request_topic = get_agent_request_topic(namespace, agent_name)
@@ -1240,6 +1227,8 @@ async def handle_a2a_response(component, message: SolaceMessage):
1240
1227
  component.log_identifier,
1241
1228
  sub_task_id,
1242
1229
  )
1230
+ # Reset the timeout since we received a status update
1231
+ await component.reset_peer_timeout(sub_task_id)
1243
1232
  message.call_acknowledgements()
1244
1233
  return
1245
1234
 
@@ -17,7 +17,7 @@ This is an empty package initialization file and has no public interfaces.
17
17
 
18
18
  ### event_handlers.py
19
19
  **Purpose:** Central hub for processing all events related to the A2A protocol. Routes events to appropriate handlers and manages task lifecycle.
20
- **Import:** `from solace_agent_mesh.agent.protocol.event_handlers import process_event, handle_a2a_request, handle_agent_card_message, handle_a2a_response, publish_agent_card`
20
+ **Import:** `from solace_agent_mesh.agent.protocol.event_handlers import process_event, handle_a2a_request, handle_agent_card_message, handle_a2a_response, publish_agent_card, handle_sam_event, cleanup_agent_session`
21
21
 
22
22
  **Functions:**
23
23
  - `process_event(component, event: Event) -> None` - Main event router that processes incoming events and delegates to specific handlers based on event type and topic
@@ -25,6 +25,8 @@ This is an empty package initialization file and has no public interfaces.
25
25
  - `handle_agent_card_message(component, message: SolaceMessage) -> None` - Processes incoming Agent Card discovery messages and updates peer agent registry
26
26
  - `handle_a2a_response(component, message: SolaceMessage) -> None` - Handles responses and status updates from peer agents, manages parallel task completion
27
27
  - `publish_agent_card(component) -> None` - Publishes the agent's capabilities and information to the discovery topic
28
+ - `handle_sam_event(component, message: SolaceMessage, topic: str) -> None` - Handles incoming SAM system events like session deletion
29
+ - `cleanup_agent_session(component, session_id: str, user_id: str) -> None` - Cleans up agent-side session data when sessions are deleted
28
30
 
29
31
  **Internal Helper Functions:**
30
32
  - `_register_peer_artifacts_in_parent_context(parent_task_context: "TaskExecutionContext", peer_task_object: Task, log_identifier: str) -> None` - Registers artifacts produced by peer agents in the parent task context
@@ -48,6 +50,16 @@ publish_agent_card(component)
48
50
  from solace_agent_mesh.agent.protocol.event_handlers import handle_a2a_request
49
51
 
50
52
  await handle_a2a_request(component, solace_message)
53
+
54
+ # Handle SAM system events
55
+ from solace_agent_mesh.agent.protocol.event_handlers import handle_sam_event
56
+
57
+ handle_sam_event(component, message, topic)
58
+
59
+ # Clean up session data
60
+ from solace_agent_mesh.agent.protocol.event_handlers import cleanup_agent_session
61
+
62
+ await cleanup_agent_session(component, "session_123", "user_456")
51
63
  ```
52
64
 
53
65
  **Key Event Flow:**
@@ -56,6 +68,7 @@ await handle_a2a_request(component, solace_message)
56
68
  - Agent request topics → `handle_a2a_request()`
57
69
  - Discovery topics → `handle_agent_card_message()`
58
70
  - Response/status topics → `handle_a2a_response()`
71
+ - SAM events topics → `handle_sam_event()`
59
72
  3. For TIMER events, handles periodic agent card publishing
60
73
  4. For CACHE_EXPIRY events, delegates to component's cache handling
61
74
 
@@ -65,4 +78,4 @@ await handle_a2a_request(component, solace_message)
65
78
  - Integrates with Google ADK for task execution
66
79
  - Manages task contexts through `TaskExecutionContext`
67
80
 
68
- # content_hash: 00fc98ca0832801776639518be8b53197c211ac407f79f9a40aa0dc35bf6b447
81
+ # content_hash: 4b8a426320c6f06c621b469c79087c315f5590ef14497ccf17de02eeb66db91d
@@ -0,0 +1,92 @@
1
+ # LLM Summary Detail File
2
+
3
+ This file is a concatenation of all individual *llm.txt files found in the 'protocol' directory tree. Each section below corresponds to a specific directory's summary file.
4
+
5
+ ================================================================================
6
+
7
+ ## Section 1: solace_agent_mesh/agent/protocol/protocol_llm.txt
8
+
9
+ **Source file:** `solace_agent_mesh/agent/protocol/protocol_llm.txt`
10
+
11
+ # DEVELOPER GUIDE: protocol
12
+
13
+ ## Quick Summary
14
+ The `protocol` directory implements the core logic for Agent-to-Agent (A2A) communication. It handles receiving and processing requests, responses, and discovery messages (Agent Cards) over the Solace event mesh. It acts as the bridge between the A2A protocol and the underlying Google ADK execution environment.
15
+
16
+ ## Files Overview
17
+ - `__init__.py` - Empty package initialization file
18
+ - `event_handlers.py` - Contains the primary logic for handling all A2A protocol events, including routing incoming messages, managing task execution, and handling agent discovery
19
+
20
+ ## Developer API Reference
21
+
22
+ ### __init__.py
23
+ **Purpose:** Standard Python package initialization file
24
+ **Import:** `from solace_agent_mesh.agent.protocol import *`
25
+
26
+ This is an empty package initialization file and has no public interfaces.
27
+
28
+ ### event_handlers.py
29
+ **Purpose:** Central hub for processing all events related to the A2A protocol. Routes events to appropriate handlers and manages task lifecycle.
30
+ **Import:** `from solace_agent_mesh.agent.protocol.event_handlers import process_event, handle_a2a_request, handle_agent_card_message, handle_a2a_response, publish_agent_card, handle_sam_event, cleanup_agent_session`
31
+
32
+ **Functions:**
33
+ - `process_event(component, event: Event) -> None` - Main event router that processes incoming events and delegates to specific handlers based on event type and topic
34
+ - `handle_a2a_request(component, message: SolaceMessage) -> None` - Handles incoming A2A request messages, starts ADK runner for SendTask requests, and processes CancelTask requests
35
+ - `handle_agent_card_message(component, message: SolaceMessage) -> None` - Processes incoming Agent Card discovery messages and updates peer agent registry
36
+ - `handle_a2a_response(component, message: SolaceMessage) -> None` - Handles responses and status updates from peer agents, manages parallel task completion
37
+ - `publish_agent_card(component) -> None` - Publishes the agent's capabilities and information to the discovery topic
38
+ - `handle_sam_event(component, message: SolaceMessage, topic: str) -> None` - Handles incoming SAM system events like session deletion
39
+ - `cleanup_agent_session(component, session_id: str, user_id: str) -> None` - Cleans up agent-side session data when sessions are deleted
40
+
41
+ **Internal Helper Functions:**
42
+ - `_register_peer_artifacts_in_parent_context(parent_task_context: "TaskExecutionContext", peer_task_object: Task, log_identifier: str) -> None` - Registers artifacts produced by peer agents in the parent task context
43
+ - `_publish_peer_tool_result_notification(component: "SamAgentComponent", correlation_data: Dict[str, Any], payload_to_queue: Any, log_identifier: str) -> None` - Publishes a ToolResultData status update for a completed peer tool call
44
+
45
+ **Usage Examples:**
46
+ ```python
47
+ # Main event processing (typically called by the SAC framework)
48
+ from solace_agent_mesh.agent.protocol.event_handlers import process_event
49
+ from solace_ai_connector.common.event import Event, EventType
50
+
51
+ # Process an incoming event
52
+ await process_event(component, event)
53
+
54
+ # Publish agent discovery card
55
+ from solace_agent_mesh.agent.protocol.event_handlers import publish_agent_card
56
+
57
+ publish_agent_card(component)
58
+
59
+ # Handle specific message types (usually called internally by process_event)
60
+ from solace_agent_mesh.agent.protocol.event_handlers import handle_a2a_request
61
+
62
+ await handle_a2a_request(component, solace_message)
63
+
64
+ # Handle SAM system events
65
+ from solace_agent_mesh.agent.protocol.event_handlers import handle_sam_event
66
+
67
+ handle_sam_event(component, message, topic)
68
+
69
+ # Clean up session data
70
+ from solace_agent_mesh.agent.protocol.event_handlers import cleanup_agent_session
71
+
72
+ await cleanup_agent_session(component, "session_123", "user_456")
73
+ ```
74
+
75
+ **Key Event Flow:**
76
+ 1. `process_event()` receives all events and routes based on type (MESSAGE, TIMER, CACHE_EXPIRY)
77
+ 2. For MESSAGE events, routes to specific handlers based on topic patterns:
78
+ - Agent request topics → `handle_a2a_request()`
79
+ - Discovery topics → `handle_agent_card_message()`
80
+ - Response/status topics → `handle_a2a_response()`
81
+ - SAM events topics → `handle_sam_event()`
82
+ 3. For TIMER events, handles periodic agent card publishing
83
+ 4. For CACHE_EXPIRY events, delegates to component's cache handling
84
+
85
+ **Dependencies:**
86
+ - Requires `SamAgentComponent` instance with proper configuration
87
+ - Uses A2A protocol types from `a2a.types`
88
+ - Integrates with Google ADK for task execution
89
+ - Manages task contexts through `TaskExecutionContext`
90
+
91
+ ================================================================================
92
+
@@ -71,7 +71,6 @@ from ...agent.tools.peer_agent_tool import (
71
71
  PeerAgentTool,
72
72
  PEER_TOOL_PREFIX,
73
73
  )
74
- from ...agent.adk.invocation_monitor import InvocationMonitor
75
74
  from ...common.middleware.registry import MiddlewareRegistry
76
75
  from ...common.constants import DEFAULT_COMMUNICATION_TIMEOUT
77
76
  from ...agent.tools.registry import tool_registry
@@ -248,7 +247,6 @@ class SamAgentComponent(SamComponentBase):
248
247
  self._agent_system_instruction_callback: Optional[
249
248
  Callable[[CallbackContext, LlmRequest], Optional[str]]
250
249
  ] = None
251
- self.invocation_monitor: Optional[InvocationMonitor] = None
252
250
  self._active_background_tasks = set()
253
251
  try:
254
252
  self.agent_specific_state: Dict[str, Any] = {}
@@ -389,15 +387,6 @@ class SamAgentComponent(SamComponentBase):
389
387
  raise RuntimeError(
390
388
  f"Agent custom initialization failed: {e}"
391
389
  ) from e
392
- try:
393
- self.invocation_monitor = InvocationMonitor()
394
- except Exception as im_e:
395
- log.error(
396
- "%s Failed to initialize InvocationMonitor: %s",
397
- self.log_identifier,
398
- im_e,
399
- )
400
- self.invocation_monitor = None
401
390
 
402
391
  # Async init is now handled by the base class `run` method.
403
392
  # We still need a future to signal completion from the async thread.
@@ -619,6 +608,42 @@ class SamAgentComponent(SamComponentBase):
619
608
  log.warning("%s Failed to claim; it was already completed.", log_id)
620
609
  return None
621
610
 
611
+ async def reset_peer_timeout(self, sub_task_id: str):
612
+ """
613
+ Resets the timeout for a given peer sub-task.
614
+ """
615
+ log_id = f"{self.log_identifier}[ResetTimeout:{sub_task_id}]"
616
+ log.debug("%s Resetting timeout for peer sub-task.", log_id)
617
+
618
+ # Get the original logical task ID from the cache without removing it
619
+ logical_task_id = self.cache_service.get_data(sub_task_id)
620
+ if not logical_task_id:
621
+ log.warning(
622
+ "%s No active task found for sub-task %s. Cannot reset timeout.",
623
+ log_id,
624
+ sub_task_id,
625
+ )
626
+ return
627
+
628
+ # Get the configured timeout
629
+ timeout_sec = self.inter_agent_communication_config.get(
630
+ "request_timeout_seconds", DEFAULT_COMMUNICATION_TIMEOUT
631
+ )
632
+
633
+ # Update the cache with a new expiry
634
+ self.cache_service.add_data(
635
+ key=sub_task_id,
636
+ value=logical_task_id,
637
+ expiry=timeout_sec,
638
+ component=self,
639
+ )
640
+ log.info(
641
+ "%s Timeout for sub-task %s has been reset to %d seconds.",
642
+ log_id,
643
+ sub_task_id,
644
+ timeout_sec,
645
+ )
646
+
622
647
  async def _retrigger_agent_with_peer_responses(
623
648
  self,
624
649
  results_to_inject: list,
@@ -2050,6 +2075,21 @@ class SamAgentComponent(SamComponentBase):
2050
2075
  self.log_identifier,
2051
2076
  len(task_context.produced_artifacts),
2052
2077
  )
2078
+
2079
+ # Add token usage summary
2080
+ if task_context:
2081
+ token_summary = task_context.get_token_usage_summary()
2082
+ if token_summary["total_tokens"] > 0:
2083
+ final_task_metadata["token_usage"] = token_summary
2084
+ log.info(
2085
+ "%s Task %s used %d total tokens (input: %d, output: %d, cached: %d)",
2086
+ self.log_identifier,
2087
+ logical_task_id,
2088
+ token_summary["total_tokens"],
2089
+ token_summary["total_input_tokens"],
2090
+ token_summary["total_output_tokens"],
2091
+ token_summary["total_cached_input_tokens"],
2092
+ )
2053
2093
 
2054
2094
  final_task = a2a.create_final_task(
2055
2095
  task_id=logical_task_id,
@@ -2991,16 +3031,6 @@ class SamAgentComponent(SamComponentBase):
2991
3031
  func_name,
2992
3032
  e,
2993
3033
  )
2994
- if self.invocation_monitor:
2995
- try:
2996
- self.invocation_monitor.cleanup()
2997
- except Exception as im_clean_e:
2998
- log.error(
2999
- "%s Error during InvocationMonitor cleanup: %s",
3000
- self.log_identifier,
3001
- im_clean_e,
3002
- )
3003
-
3004
3034
  if self._tool_cleanup_hooks:
3005
3035
  log.info(
3006
3036
  "%s Executing %d tool cleanup hooks...",
@@ -141,6 +141,8 @@ patch_adk()
141
141
  - `get_and_clear_artifact_signals() -> List[Dict[str, Any]]` - Retrieves and clears artifact signals
142
142
  - `set_event_loop(loop: asyncio.AbstractEventLoop) -> None` - Stores event loop reference
143
143
  - `get_event_loop() -> Optional[asyncio.AbstractEventLoop]` - Retrieves stored event loop
144
+ - `record_token_usage(input_tokens: int, output_tokens: int, model: str, source: str = "agent", tool_name: Optional[str] = None, cached_input_tokens: int = 0) -> None` - Records token usage for LLM calls
145
+ - `get_token_usage_summary() -> Dict[str, Any]` - Returns summary of all token usage for the task
144
146
 
145
147
  **Usage Examples:**
146
148
  ```python
@@ -170,6 +172,18 @@ task_context.register_peer_sub_task("sub-task-456", correlation_data)
170
172
  completed_data = task_context.claim_sub_task_completion("sub-task-456")
171
173
  if completed_data:
172
174
  print(f"Sub-task completed: {completed_data}")
175
+
176
+ # Track token usage
177
+ task_context.record_token_usage(
178
+ input_tokens=100,
179
+ output_tokens=50,
180
+ model="gemini-1.5-pro",
181
+ source="agent"
182
+ )
183
+
184
+ # Get usage summary
185
+ usage = task_context.get_token_usage_summary()
186
+ print(f"Total tokens used: {usage['total_tokens']}")
173
187
  ```
174
188
 
175
- # content_hash: 79c043cb89eecb2b6a6f05113ff223c5064861f1a537d8e832ebb2738f5801e8
189
+ # content_hash: 27b0000d250131d578d28ab8c4d06c2e2084d888b47102e9b3b133adbc61a169
@@ -0,0 +1,200 @@
1
+ # LLM Summary Detail File
2
+
3
+ This file is a concatenation of all individual *llm.txt files found in the 'sac' directory tree. Each section below corresponds to a specific directory's summary file.
4
+
5
+ ================================================================================
6
+
7
+ ## Section 1: solace_agent_mesh/agent/sac/sac_llm.txt
8
+
9
+ **Source file:** `solace_agent_mesh/agent/sac/sac_llm.txt`
10
+
11
+ # DEVELOPER GUIDE for the directory: sac
12
+
13
+ ## Quick Summary
14
+ The `sac` (Solace AI Connector) directory provides the core implementation for hosting a Google ADK (Agent Development Kit) agent within the Solace AI Connector framework. It acts as a bridge, enabling ADK agents to communicate using the A2A (Agent-to-Agent) protocol over Solace messaging. This allows for the creation of distributed, collaborative agent systems where agents can delegate tasks, share information, and work together to solve complex problems.
15
+
16
+ ## Files Overview
17
+ - `__init__.py` - Empty package marker file
18
+ - `app.py` - Custom SAC App class that automatically configures Solace subscriptions and broker settings for A2A communication
19
+ - `component.py` - Main SAC Component that hosts the ADK agent, manages its lifecycle, and handles all A2A protocol messaging
20
+ - `patch_adk.py` - Runtime patches for the Google ADK library to enhance or correct its behavior
21
+ - `task_execution_context.py` - State management class that encapsulates all runtime information for a single, in-flight A2A task
22
+
23
+ ## Developer API Reference
24
+
25
+ ### app.py
26
+ **Purpose:** Provides a custom SAC App class that simplifies the configuration of an A2A agent
27
+ **Import:** `from solace_agent_mesh.agent.sac.app import SamAgentApp`
28
+
29
+ **Classes:**
30
+ - `SamAgentApp(app_info: Dict[str, Any], **kwargs)` - Custom App class for SAM Agent Host with namespace prefixing and automatic subscription generation
31
+ - `app_schema: Dict` - Class attribute defining comprehensive configuration schema for agent host validation
32
+
33
+ **Constants/Variables:**
34
+ - `info: Dict[str, str]` - Metadata dictionary about the SamAgentApp class for SAC framework discovery
35
+
36
+ **Usage Examples:**
37
+ ```python
38
+ # SamAgentApp is typically instantiated by the SAC framework from YAML config
39
+ # Example agent-config.yaml:
40
+ # app:
41
+ # class_name: solace_agent_mesh.agent.sac.app.SamAgentApp
42
+ # app_config:
43
+ # namespace: "my-org/production"
44
+ # agent_name: "customer-support-agent"
45
+ # model: "gemini-1.5-pro-latest"
46
+ # tools:
47
+ # - tool_type: "builtin"
48
+ # tool_name: "file_search"
49
+ # agent_card:
50
+ # description: "An agent that can answer questions about customer accounts."
51
+ # agent_card_publishing:
52
+ # interval_seconds: 60
53
+ # session_service:
54
+ # type: "memory"
55
+ ```
56
+
57
+ ### component.py
58
+ **Purpose:** Core component that hosts a Google ADK agent and bridges communication to A2A protocol
59
+ **Import:** `from solace_agent_mesh.agent.sac.component import SamAgentComponent`
60
+
61
+ **Classes:**
62
+ - `SamAgentComponent(**kwargs)` - Solace AI Connector component that hosts a Google ADK agent
63
+ - `process_event(event: Event) -> None` - Main entry point for all SAC framework events
64
+ - `handle_timer_event(timer_data: Dict[str, Any]) -> None` - Handles scheduled timer events for agent card publishing
65
+ - `handle_cache_expiry_event(cache_data: Dict[str, Any]) -> None` - Handles cache expiry events for peer agent timeouts
66
+ - `finalize_task_success(a2a_context: Dict) -> None` - Async method to finalize successful task completion
67
+ - `finalize_task_canceled(a2a_context: Dict) -> None` - Finalizes task as CANCELED
68
+ - `finalize_task_error(exception: Exception, a2a_context: Dict) -> None` - Async method to finalize failed tasks
69
+ - `cleanup() -> None` - Cleans up resources on component shutdown
70
+ - `set_agent_specific_state(key: str, value: Any) -> None` - Sets key-value pair in agent state dictionary
71
+ - `get_agent_specific_state(key: str, default: Optional[Any] = None) -> Any` - Retrieves value from agent state
72
+ - `get_async_loop() -> Optional[asyncio.AbstractEventLoop]` - Returns dedicated asyncio event loop
73
+ - `set_agent_system_instruction_string(instruction_string: str) -> None` - Sets static system prompt injection
74
+ - `set_agent_system_instruction_callback(callback_function: Callable) -> None` - Sets dynamic system prompt callback
75
+ - `get_gateway_id() -> str` - Returns unique identifier for agent host instance
76
+ - `submit_a2a_task(target_agent_name: str, a2a_message: A2AMessage, user_id: str, user_config: Dict[str, Any], sub_task_id: str) -> str` - Submits task to peer agent
77
+ - `get_agent_context() -> Dict[str, Any]` - Returns agent context for middleware interactions
78
+
79
+ **Constants/Variables:**
80
+ - `info: Dict` - Metadata dictionary for SAC framework
81
+ - `CORRELATION_DATA_PREFIX: str` - Prefix for cache keys when tracking peer requests
82
+ - `HOST_COMPONENT_VERSION: str` - Version string of the host component
83
+
84
+ **Usage Examples:**
85
+ ```python
86
+ # Custom initialization function example
87
+ from solace_agent_mesh.agent.sac.component import SamAgentComponent
88
+
89
+ def initialize_my_agent(host_component: SamAgentComponent, config: dict):
90
+ """Custom initialization function for the agent."""
91
+ # Store database connection in agent state
92
+ db_connection = create_database_connection(config.get('db_url'))
93
+ host_component.set_agent_specific_state('db_connection', db_connection)
94
+
95
+ # Set custom system instruction
96
+ host_component.set_agent_system_instruction_string(
97
+ "You are a specialized customer service agent with access to our database."
98
+ )
99
+
100
+ # Tool accessing agent state
101
+ def my_custom_tool(host_component: SamAgentComponent, query: str) -> str:
102
+ """Tool that uses stored database connection."""
103
+ db_connection = host_component.get_agent_specific_state('db_connection')
104
+ if db_connection:
105
+ return db_connection.execute_query(query)
106
+ return "Database not available"
107
+
108
+ # Scheduling async work from synchronous code
109
+ def schedule_background_task(host_component: SamAgentComponent):
110
+ """Schedule async work on the component's event loop."""
111
+ loop = host_component.get_async_loop()
112
+ if loop:
113
+ asyncio.run_coroutine_threadsafe(my_async_task(), loop)
114
+ ```
115
+
116
+ ### patch_adk.py
117
+ **Purpose:** Contains runtime patches for the Google ADK library to enhance behavior
118
+ **Import:** `from solace_agent_mesh.agent.sac.patch_adk import patch_adk`
119
+
120
+ **Functions:**
121
+ - `patch_adk() -> None` - Applies all necessary patches to the ADK library
122
+
123
+ **Usage Examples:**
124
+ ```python
125
+ from solace_agent_mesh.agent.sac.patch_adk import patch_adk
126
+
127
+ # Apply patches before using ADK
128
+ patch_adk()
129
+ ```
130
+
131
+ ### task_execution_context.py
132
+ **Purpose:** State management class for single, in-flight agent tasks
133
+ **Import:** `from solace_agent_mesh.agent.sac.task_execution_context import TaskExecutionContext`
134
+
135
+ **Classes:**
136
+ - `TaskExecutionContext(task_id: str, a2a_context: Dict[str, Any])` - Encapsulates runtime state for a single agent task
137
+ - `cancel() -> None` - Signals that the task should be cancelled
138
+ - `is_cancelled() -> bool` - Checks if cancellation event has been set
139
+ - `append_to_streaming_buffer(text: str) -> None` - Appends text to streaming buffer
140
+ - `flush_streaming_buffer() -> str` - Returns and clears streaming buffer content
141
+ - `get_streaming_buffer_content() -> str` - Returns buffer content without clearing
142
+ - `append_to_run_based_buffer(text: str) -> None` - Appends text to run-based response buffer
143
+ - `register_peer_sub_task(sub_task_id: str, correlation_data: Dict[str, Any]) -> None` - Adds peer sub-task tracking
144
+ - `claim_sub_task_completion(sub_task_id: str) -> Optional[Dict[str, Any]]` - Atomically retrieves and removes sub-task data
145
+ - `register_parallel_call_sent(invocation_id: str) -> None` - Registers new parallel tool call
146
+ - `handle_peer_timeout(sub_task_id: str, correlation_data: Dict, timeout_sec: int, invocation_id: str) -> bool` - Handles peer timeout
147
+ - `record_parallel_result(result: Dict, invocation_id: str) -> bool` - Records parallel tool call result
148
+ - `clear_parallel_invocation_state(invocation_id: str) -> None` - Removes completed invocation state
149
+ - `register_produced_artifact(filename: str, version: int) -> None` - Tracks newly created artifacts
150
+ - `add_artifact_signal(signal: Dict[str, Any]) -> None` - Adds artifact return signal
151
+ - `get_and_clear_artifact_signals() -> List[Dict[str, Any]]` - Retrieves and clears artifact signals
152
+ - `set_event_loop(loop: asyncio.AbstractEventLoop) -> None` - Stores event loop reference
153
+ - `get_event_loop() -> Optional[asyncio.AbstractEventLoop]` - Retrieves stored event loop
154
+ - `record_token_usage(input_tokens: int, output_tokens: int, model: str, source: str = "agent", tool_name: Optional[str] = None, cached_input_tokens: int = 0) -> None` - Records token usage for LLM calls
155
+ - `get_token_usage_summary() -> Dict[str, Any]` - Returns summary of all token usage for the task
156
+
157
+ **Usage Examples:**
158
+ ```python
159
+ from solace_agent_mesh.agent.sac.task_execution_context import TaskExecutionContext
160
+
161
+ # Create task context
162
+ a2a_context = {
163
+ "logical_task_id": "task-123",
164
+ "user_id": "user-456",
165
+ "session_id": "session-789"
166
+ }
167
+ task_context = TaskExecutionContext("task-123", a2a_context)
168
+
169
+ # Use streaming buffer
170
+ task_context.append_to_streaming_buffer("Hello ")
171
+ task_context.append_to_streaming_buffer("world!")
172
+ content = task_context.flush_streaming_buffer() # Returns "Hello world!"
173
+
174
+ # Track peer sub-tasks
175
+ correlation_data = {
176
+ "peer_agent_name": "math-agent",
177
+ "adk_function_call_id": "call-123"
178
+ }
179
+ task_context.register_peer_sub_task("sub-task-456", correlation_data)
180
+
181
+ # Handle completion
182
+ completed_data = task_context.claim_sub_task_completion("sub-task-456")
183
+ if completed_data:
184
+ print(f"Sub-task completed: {completed_data}")
185
+
186
+ # Track token usage
187
+ task_context.record_token_usage(
188
+ input_tokens=100,
189
+ output_tokens=50,
190
+ model="gemini-1.5-pro",
191
+ source="agent"
192
+ )
193
+
194
+ # Get usage summary
195
+ usage = task_context.get_token_usage_summary()
196
+ print(f"Total tokens used: {usage['total_tokens']}")
197
+ ```
198
+
199
+ ================================================================================
200
+
@@ -33,6 +33,13 @@ class TaskExecutionContext:
33
33
  self.artifact_signals_to_return: List[Dict[str, Any]] = []
34
34
  self.event_loop: Optional[asyncio.AbstractEventLoop] = None
35
35
  self.lock: threading.Lock = threading.Lock()
36
+
37
+ # Token usage tracking
38
+ self.total_input_tokens: int = 0
39
+ self.total_output_tokens: int = 0
40
+ self.total_cached_input_tokens: int = 0
41
+ self.token_usage_by_model: Dict[str, Dict[str, int]] = {}
42
+ self.token_usage_by_source: Dict[str, Dict[str, int]] = {}
36
43
 
37
44
  def cancel(self) -> None:
38
45
  """Signals that the task should be cancelled."""
@@ -183,3 +190,69 @@ class TaskExecutionContext:
183
190
  """Retrieves the stored event loop."""
184
191
  with self.lock:
185
192
  return self.event_loop
193
+
194
+ def record_token_usage(
195
+ self,
196
+ input_tokens: int,
197
+ output_tokens: int,
198
+ model: str,
199
+ source: str = "agent",
200
+ tool_name: Optional[str] = None,
201
+ cached_input_tokens: int = 0,
202
+ ) -> None:
203
+ """
204
+ Records token usage for an LLM call.
205
+
206
+ Args:
207
+ input_tokens: Number of input/prompt tokens.
208
+ output_tokens: Number of output/completion tokens.
209
+ model: Model identifier used for this call.
210
+ source: Source of the LLM call ("agent" or "tool").
211
+ tool_name: Tool name if source is "tool".
212
+ cached_input_tokens: Number of cached input tokens (optional).
213
+ """
214
+ with self.lock:
215
+ # Update totals
216
+ self.total_input_tokens += input_tokens
217
+ self.total_output_tokens += output_tokens
218
+ self.total_cached_input_tokens += cached_input_tokens
219
+
220
+ # Track by model
221
+ if model not in self.token_usage_by_model:
222
+ self.token_usage_by_model[model] = {
223
+ "input_tokens": 0,
224
+ "output_tokens": 0,
225
+ "cached_input_tokens": 0,
226
+ }
227
+ self.token_usage_by_model[model]["input_tokens"] += input_tokens
228
+ self.token_usage_by_model[model]["output_tokens"] += output_tokens
229
+ self.token_usage_by_model[model]["cached_input_tokens"] += cached_input_tokens
230
+
231
+ # Track by source
232
+ source_key = f"{source}:{tool_name}" if tool_name else source
233
+ if source_key not in self.token_usage_by_source:
234
+ self.token_usage_by_source[source_key] = {
235
+ "input_tokens": 0,
236
+ "output_tokens": 0,
237
+ "cached_input_tokens": 0,
238
+ }
239
+ self.token_usage_by_source[source_key]["input_tokens"] += input_tokens
240
+ self.token_usage_by_source[source_key]["output_tokens"] += output_tokens
241
+ self.token_usage_by_source[source_key]["cached_input_tokens"] += cached_input_tokens
242
+
243
+ def get_token_usage_summary(self) -> Dict[str, Any]:
244
+ """
245
+ Returns a summary of all token usage for this task.
246
+
247
+ Returns:
248
+ Dictionary containing total token counts and breakdowns by model and source.
249
+ """
250
+ with self.lock:
251
+ return {
252
+ "total_input_tokens": self.total_input_tokens,
253
+ "total_output_tokens": self.total_output_tokens,
254
+ "total_cached_input_tokens": self.total_cached_input_tokens,
255
+ "total_tokens": self.total_input_tokens + self.total_output_tokens,
256
+ "by_model": dict(self.token_usage_by_model),
257
+ "by_source": dict(self.token_usage_by_source),
258
+ }
@@ -0,0 +1,68 @@
1
+ # LLM Summary Detail File
2
+
3
+ This file is a concatenation of all individual *llm.txt files found in the 'testing' directory tree. Each section below corresponds to a specific directory's summary file.
4
+
5
+ ================================================================================
6
+
7
+ ## Section 1: solace_agent_mesh/agent/testing/testing_llm.txt
8
+
9
+ **Source file:** `solace_agent_mesh/agent/testing/testing_llm.txt`
10
+
11
+ ## Quick Summary
12
+ The `testing` directory provides utilities for testing the A2A (Agent-to-Agent) framework, with a focus on debugging tools that help developers understand test failures by providing readable representations of agent event histories.
13
+
14
+ ## Files Overview
15
+ - `__init__.py` - Package initialization file marking the directory as a Python module
16
+ - `debug_utils.py` - Debugging utilities including pretty-printing for A2A event history
17
+ - `testing_llm.txt` - Documentation file (not a code module)
18
+
19
+ ## Developer API Reference
20
+
21
+ ### debug_utils.py
22
+ **Purpose:** Provides debugging utilities for the declarative test framework, including a pretty-printer for A2A event history
23
+ **Import:** `from solace_agent_mesh.agent.testing.debug_utils import pretty_print_event_history`
24
+
25
+ **Functions:**
26
+ - `pretty_print_event_history(event_history: List[Dict[str, Any]], max_string_length: int = 200) -> None` - Formats and prints a list of A2A event payloads for debugging, intelligently parsing different event types and truncating long strings for readability
27
+
28
+ **Usage Examples:**
29
+ ```python
30
+ # Import the debugging utility
31
+ from solace_agent_mesh.agent.testing.debug_utils import pretty_print_event_history
32
+ from typing import List, Dict, Any
33
+
34
+ # Example: Debug a failed test by printing event history
35
+ event_history: List[Dict[str, Any]] = [
36
+ {
37
+ "result": {
38
+ "status": {
39
+ "state": "EXECUTING",
40
+ "message": {
41
+ "parts": [
42
+ {"type": "text", "text": "Processing your request..."}
43
+ ]
44
+ }
45
+ },
46
+ "final": False
47
+ }
48
+ },
49
+ {
50
+ "error": {
51
+ "code": "TIMEOUT_ERROR",
52
+ "message": "Request timed out after 30 seconds"
53
+ }
54
+ }
55
+ ]
56
+
57
+ # Print formatted event history for debugging
58
+ pretty_print_event_history(event_history)
59
+
60
+ # Print with custom string truncation length
61
+ pretty_print_event_history(event_history, max_string_length=100)
62
+
63
+ # Handle empty event history (when test fails before any events)
64
+ pretty_print_event_history([])
65
+ ```
66
+
67
+ ================================================================================
68
+