solace-agent-mesh 1.0.8__py3-none-any.whl → 1.1.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 (162) hide show
  1. solace_agent_mesh/agent/adk/adk_llm.txt +182 -42
  2. solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +171 -0
  3. solace_agent_mesh/agent/adk/callbacks.py +165 -104
  4. solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +0 -18
  5. solace_agent_mesh/agent/adk/models/models_llm.txt +104 -55
  6. solace_agent_mesh/agent/adk/runner.py +7 -5
  7. solace_agent_mesh/agent/adk/setup.py +11 -0
  8. solace_agent_mesh/agent/adk/stream_parser.py +8 -1
  9. solace_agent_mesh/agent/adk/tool_wrapper.py +10 -3
  10. solace_agent_mesh/agent/agent_llm.txt +355 -18
  11. solace_agent_mesh/agent/protocol/event_handlers.py +433 -296
  12. solace_agent_mesh/agent/protocol/protocol_llm.txt +54 -7
  13. solace_agent_mesh/agent/sac/app.py +1 -1
  14. solace_agent_mesh/agent/sac/component.py +212 -517
  15. solace_agent_mesh/agent/sac/sac_llm.txt +133 -63
  16. solace_agent_mesh/agent/testing/testing_llm.txt +25 -58
  17. solace_agent_mesh/agent/tools/peer_agent_tool.py +15 -11
  18. solace_agent_mesh/agent/tools/tools_llm.txt +234 -69
  19. solace_agent_mesh/agent/utils/artifact_helpers.py +35 -1
  20. solace_agent_mesh/agent/utils/utils_llm.txt +90 -105
  21. solace_agent_mesh/assets/docs/404.html +3 -3
  22. solace_agent_mesh/assets/docs/assets/js/{3d406171.7d02a73b.js → 3d406171.0b9eeed1.js} +1 -1
  23. solace_agent_mesh/assets/docs/assets/js/6e0db977.39a79ca9.js +1 -0
  24. solace_agent_mesh/assets/docs/assets/js/{75384d09.ccd480c4.js → 75384d09.bf78fbdb.js} +1 -1
  25. solace_agent_mesh/assets/docs/assets/js/90dd9cf6.88f385ea.js +1 -0
  26. solace_agent_mesh/assets/docs/assets/js/f284c35a.fb68323a.js +1 -0
  27. solace_agent_mesh/assets/docs/assets/js/main.a75ecc0d.js +2 -0
  28. solace_agent_mesh/assets/docs/assets/js/runtime~main.458efb1d.js +1 -0
  29. solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +4 -4
  30. solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +4 -4
  31. solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +4 -4
  32. solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +4 -4
  33. solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +4 -4
  34. solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +4 -4
  35. solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +4 -4
  36. solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +4 -4
  37. solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +4 -4
  38. solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +4 -4
  39. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +4 -4
  40. solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +4 -4
  41. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +4 -4
  42. solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +4 -4
  43. solace_agent_mesh/assets/docs/docs/documentation/migration-guides/a2a-upgrade-to-0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +105 -0
  44. solace_agent_mesh/assets/docs/docs/documentation/migration-guides/a2a-upgrade-to-0.3.0/a2a-technical-migration-map/index.html +53 -0
  45. solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +4 -4
  46. solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +8 -8
  47. solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +4 -4
  48. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +4 -4
  49. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +4 -4
  50. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +4 -4
  51. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +4 -4
  52. solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +4 -4
  53. solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +4 -4
  54. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +4 -4
  55. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +4 -4
  56. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +4 -4
  57. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +4 -4
  58. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +4 -4
  59. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +4 -4
  60. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +4 -4
  61. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +4 -4
  62. solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +4 -4
  63. solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +4 -4
  64. solace_agent_mesh/assets/docs/lunr-index-1756992446316.json +1 -0
  65. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  66. solace_agent_mesh/assets/docs/search-doc-1756992446316.json +1 -0
  67. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  68. solace_agent_mesh/assets/docs/sitemap.xml +1 -1
  69. solace_agent_mesh/cli/__init__.py +1 -1
  70. solace_agent_mesh/cli/commands/add_cmd/web_add_agent_step.py +12 -3
  71. solace_agent_mesh/cli/commands/add_cmd/web_add_gateway_step.py +10 -14
  72. solace_agent_mesh/cli/commands/init_cmd/web_init_step.py +2 -15
  73. solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +6 -2
  74. solace_agent_mesh/cli/utils.py +15 -0
  75. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-DvlO62me.js → authCallback-BmF2l6vg.js} +1 -1
  76. solace_agent_mesh/client/webui/frontend/static/assets/{client-bp6u3qVZ.js → client-D881Dttc.js} +4 -4
  77. solace_agent_mesh/client/webui/frontend/static/assets/main-C0jZjYa8.js +699 -0
  78. solace_agent_mesh/client/webui/frontend/static/assets/main-CCeG324-.css +1 -0
  79. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +2 -2
  80. solace_agent_mesh/client/webui/frontend/static/index.html +3 -3
  81. solace_agent_mesh/common/a2a/__init__.py +213 -0
  82. solace_agent_mesh/common/a2a/a2a_llm.txt +182 -0
  83. solace_agent_mesh/common/a2a/artifact.py +328 -0
  84. solace_agent_mesh/common/a2a/events.py +183 -0
  85. solace_agent_mesh/common/a2a/message.py +307 -0
  86. solace_agent_mesh/common/a2a/protocol.py +513 -0
  87. solace_agent_mesh/common/a2a/task.py +127 -0
  88. solace_agent_mesh/common/a2a/translation.py +653 -0
  89. solace_agent_mesh/common/a2a/types.py +54 -0
  90. solace_agent_mesh/common/a2a_spec/a2a.json +2576 -0
  91. solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +407 -0
  92. solace_agent_mesh/common/a2a_spec/schemas/agent_progress_update.json +18 -0
  93. solace_agent_mesh/common/a2a_spec/schemas/artifact_creation_progress.json +31 -0
  94. solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +18 -0
  95. solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +235 -0
  96. solace_agent_mesh/common/a2a_spec/schemas/tool_invocation_start.json +26 -0
  97. solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +25 -0
  98. solace_agent_mesh/common/agent_registry.py +1 -1
  99. solace_agent_mesh/common/common_llm.txt +192 -70
  100. solace_agent_mesh/common/data_parts.py +99 -0
  101. solace_agent_mesh/common/middleware/middleware_llm.txt +17 -17
  102. solace_agent_mesh/common/sac/__init__.py +0 -0
  103. solace_agent_mesh/common/sac/sac_llm.txt +71 -0
  104. solace_agent_mesh/common/sac/sam_component_base.py +252 -0
  105. solace_agent_mesh/common/services/providers/providers_llm.txt +51 -84
  106. solace_agent_mesh/common/services/services_llm.txt +206 -26
  107. solace_agent_mesh/common/utils/artifact_utils.py +29 -0
  108. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +176 -80
  109. solace_agent_mesh/common/utils/utils_llm.txt +323 -42
  110. solace_agent_mesh/config_portal/backend/common.py +1 -1
  111. solace_agent_mesh/config_portal/frontend/static/client/assets/{_index-MqsrTd6g.js → _index-Bym6YkMd.js} +74 -24
  112. solace_agent_mesh/config_portal/frontend/static/client/assets/{components-B7lKcHVY.js → components-Rk0n-9cK.js} +1 -1
  113. solace_agent_mesh/config_portal/frontend/static/client/assets/{entry.client-CEumGClk.js → entry.client-mvZjNKiz.js} +1 -1
  114. solace_agent_mesh/config_portal/frontend/static/client/assets/{index-DSo1AH_7.js → index-DzNKzXrc.js} +1 -1
  115. solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-d845808d.js +1 -0
  116. solace_agent_mesh/config_portal/frontend/static/client/assets/{root-C4XmHinv.js → root-BWvk5-gF.js} +1 -1
  117. solace_agent_mesh/config_portal/frontend/static/client/index.html +3 -3
  118. solace_agent_mesh/core_a2a/core_a2a_llm.txt +10 -8
  119. solace_agent_mesh/core_a2a/service.py +20 -44
  120. solace_agent_mesh/gateway/base/app.py +27 -1
  121. solace_agent_mesh/gateway/base/base_llm.txt +177 -72
  122. solace_agent_mesh/gateway/base/component.py +294 -523
  123. solace_agent_mesh/gateway/gateway_llm.txt +299 -58
  124. solace_agent_mesh/gateway/http_sse/component.py +156 -183
  125. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +29 -29
  126. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +272 -36
  127. solace_agent_mesh/gateway/http_sse/main.py +8 -10
  128. solace_agent_mesh/gateway/http_sse/routers/agents.py +1 -1
  129. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +18 -4
  130. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +231 -5
  131. solace_agent_mesh/gateway/http_sse/routers/sessions.py +12 -7
  132. solace_agent_mesh/gateway/http_sse/routers/tasks.py +116 -169
  133. solace_agent_mesh/gateway/http_sse/services/agent_service.py +1 -1
  134. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +89 -135
  135. solace_agent_mesh/gateway/http_sse/services/task_service.py +2 -5
  136. solace_agent_mesh/solace_agent_mesh_llm.txt +362 -0
  137. solace_agent_mesh/templates/gateway_component_template.py +149 -98
  138. {solace_agent_mesh-1.0.8.dist-info → solace_agent_mesh-1.1.0.dist-info}/METADATA +5 -4
  139. {solace_agent_mesh-1.0.8.dist-info → solace_agent_mesh-1.1.0.dist-info}/RECORD +143 -126
  140. solace_agent_mesh/assets/docs/assets/js/f284c35a.731836ad.js +0 -1
  141. solace_agent_mesh/assets/docs/assets/js/main.6dba4a66.js +0 -2
  142. solace_agent_mesh/assets/docs/assets/js/runtime~main.6415ad00.js +0 -1
  143. solace_agent_mesh/assets/docs/lunr-index-1756153049706.json +0 -1
  144. solace_agent_mesh/assets/docs/search-doc-1756153049706.json +0 -1
  145. solace_agent_mesh/client/webui/frontend/static/assets/main-BCpII1-0.css +0 -1
  146. solace_agent_mesh/client/webui/frontend/static/assets/main-BucUdn9m.js +0 -673
  147. solace_agent_mesh/common/a2a_protocol.py +0 -564
  148. solace_agent_mesh/common/client/__init__.py +0 -4
  149. solace_agent_mesh/common/client/card_resolver.py +0 -21
  150. solace_agent_mesh/common/client/client.py +0 -85
  151. solace_agent_mesh/common/client/client_llm.txt +0 -133
  152. solace_agent_mesh/common/server/__init__.py +0 -4
  153. solace_agent_mesh/common/server/server.py +0 -122
  154. solace_agent_mesh/common/server/server_llm.txt +0 -169
  155. solace_agent_mesh/common/server/task_manager.py +0 -291
  156. solace_agent_mesh/common/server/utils.py +0 -28
  157. solace_agent_mesh/common/types.py +0 -411
  158. solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-28271392.js +0 -1
  159. /solace_agent_mesh/assets/docs/assets/js/{main.6dba4a66.js.LICENSE.txt → main.a75ecc0d.js.LICENSE.txt} +0 -0
  160. {solace_agent_mesh-1.0.8.dist-info → solace_agent_mesh-1.1.0.dist-info}/WHEEL +0 -0
  161. {solace_agent_mesh-1.0.8.dist-info → solace_agent_mesh-1.1.0.dist-info}/entry_points.txt +0 -0
  162. {solace_agent_mesh-1.0.8.dist-info → solace_agent_mesh-1.1.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- Here is the comprehensive developer guide for the `gateway` directory.
1
+ # DEVELOPER GUIDE: gateway
2
2
 
3
3
  ## Quick Summary
4
4
  The `gateway` directory provides a comprehensive framework for building gateway implementations that bridge external platforms with the Solace AI Connector's A2A (Agent-to-Agent) messaging system. The architecture consists of a foundational base framework and three specialized gateway implementations: HTTP/SSE for web interfaces, Slack for team collaboration, and Webhook for external system integration. All gateways share common patterns for authentication, message translation, and real-time communication while providing platform-specific features.
@@ -18,7 +18,7 @@ The `gateway` directory provides a comprehensive framework for building gateway
18
18
 
19
19
  #### __init__.py
20
20
  **Purpose:** Initializes the `gateway` module, making it a Python package.
21
- **Import:** `from gateway import ...`
21
+ **Import:** `from solace_agent_mesh.gateway import ...`
22
22
 
23
23
  **Classes/Functions/Constants:**
24
24
  This file is empty and contains no direct exports.
@@ -30,68 +30,31 @@ This file is empty and contains no direct exports.
30
30
  **Key Exports:** `BaseGatewayApp`, `BaseGatewayComponent`, `TaskContextManager`
31
31
  **Import Examples:**
32
32
  ```python
33
- from gateway.base.app import BaseGatewayApp
34
- from gateway.base.component import BaseGatewayComponent
35
- from gateway.base.task_context import TaskContextManager
33
+ from solace_agent_mesh.gateway.base.app import BaseGatewayApp
34
+ from solace_agent_mesh.gateway.base.component import BaseGatewayComponent
35
+ from solace_agent_mesh.gateway.base.task_context import TaskContextManager
36
36
  ```
37
37
 
38
- **Key Modules:**
39
-
40
- * **`app.py`**:
41
- * **`BaseGatewayApp`**: The main application class to be subclassed for a new gateway. It automates configuration schema merging, Solace broker setup, and component instantiation.
42
- * `_get_gateway_component_class(self)`: **[Abstract Method]** Subclasses must implement this to return their specific gateway component class.
43
-
44
- * **`component.py`**:
45
- * **`BaseGatewayComponent`**: The abstract base class for gateway logic. Subclasses implement the abstract methods to define how the gateway interacts with its specific external platform.
46
- * **Public Methods**:
47
- * `submit_a2a_task(...)`: The primary method for submitting a task to an agent on behalf of an external user.
48
- * `publish_a2a_message(...)`: A lower-level method to publish any message to the A2A message bus.
49
- * **Abstract Methods to Implement**:
50
- * `_extract_initial_claims(self, external_event_data)`: Extracts user identity from a platform-specific event.
51
- * `_start_listener(self)` / `_stop_listener(self)`: Manages the lifecycle of the external platform listener (e.g., a web server).
52
- * `_translate_external_input(self, external_event)`: Translates an incoming event from the external platform into the A2A protocol format.
53
- * `_send_update_to_external(...)`: Sends a streaming update back to the external platform.
54
- * `_send_final_response_to_external(...)`: Sends the final task result back to the external platform.
55
- * `_send_error_to_external(...)`: Sends an error message back to the external platform.
56
-
57
- * **`task_context.py`**:
58
- * **`TaskContextManager`**: A thread-safe dictionary-like class for mapping A2A task IDs to the original request context from the external platform. This is crucial for routing responses back to the correct user/channel/thread.
59
-
60
38
  #### http_sse/
61
39
  **Purpose:** Implements a complete HTTP/SSE gateway to serve a web-based user interface, bridging web protocols with the backend A2A messaging fabric.
62
40
  **Key Exports:** `WebUIBackendApp`, `WebUIBackendComponent`, `SSEManager`, `SessionManager`, and various dependency injectors.
63
41
  **Import Examples:**
64
42
  ```python
65
- from gateway.http_sse.app import WebUIBackendApp
66
- from gateway.http_sse.component import WebUIBackendComponent
67
- from gateway.http_sse.sse_manager import SSEManager
68
- from gateway.http_sse.session_manager import SessionManager
69
- from gateway.http_sse.dependencies import get_agent_service, get_task_service, get_user_id
43
+ from solace_agent_mesh.gateway.http_sse.app import WebUIBackendApp
44
+ from solace_agent_mesh.gateway.http_sse.component import WebUIBackendComponent
45
+ from solace_agent_mesh.gateway.http_sse.sse_manager import SSEManager
46
+ from solace_agent_mesh.gateway.http_sse.session_manager import SessionManager
47
+ from solace_agent_mesh.gateway.http_sse.dependencies import get_agent_service, get_task_service, get_user_id
70
48
  ```
71
49
 
72
- **Key Modules & Exports:**
73
-
74
- * **`app.py`**:
75
- * **`WebUIBackendApp`**: The main SAC App class that defines the configuration schema and launches the `WebUIBackendComponent`.
76
- * **`component.py`**:
77
- * **`WebUIBackendComponent`**: The core component that hosts the FastAPI server, manages shared state, and implements the A2A translation logic for HTTP requests.
78
- * **`session_manager.py`**:
79
- * **`SessionManager`**: Manages web user sessions, creating and tracking unique A2A client and session IDs from HTTP requests.
80
- * **`sse_manager.py`**:
81
- * **`SSEManager`**: Manages Server-Sent Event (SSE) connections, allowing for real-time, streaming updates to be pushed from the server to connected web clients.
82
- * **`dependencies.py`**:
83
- * Provides FastAPI dependency injectors for giving API routers safe access to shared resources (e.g., `get_agent_service`, `get_task_service`, `get_sac_component`).
84
- * **`services/`**:
85
- * **`AgentService`**, **`TaskService`**: Contain the business logic for interacting with agents and managing tasks, respectively. These are accessed via the dependency injectors.
86
-
87
50
  #### slack/
88
51
  **Purpose:** Provides a gateway for integrating the Solace AI Connector with the Slack collaboration platform, enabling bot interactions within Slack channels and threads.
89
52
  **Key Exports:** `SlackGatewayApp`, `SlackGatewayComponent`, and various utility functions.
90
53
  **Import Examples:**
91
54
  ```python
92
- from gateway.slack.app import SlackGatewayApp
93
- from gateway.slack.component import SlackGatewayComponent
94
- from gateway.slack.utils import generate_a2a_session_id, send_slack_message, correct_slack_markdown
55
+ from solace_agent_mesh.gateway.slack.app import SlackGatewayApp
56
+ from solace_agent_mesh.gateway.slack.component import SlackGatewayComponent
57
+ from solace_agent_mesh.gateway.slack.utils import generate_a2a_session_id, send_slack_message, correct_slack_markdown
95
58
  ```
96
59
 
97
60
  #### webhook/
@@ -99,27 +62,305 @@ from gateway.slack.utils import generate_a2a_session_id, send_slack_message, cor
99
62
  **Key Exports:** `WebhookGatewayApp`, `WebhookGatewayComponent`
100
63
  **Import Examples:**
101
64
  ```python
102
- from gateway.webhook.app import WebhookGatewayApp
103
- from gateway.webhook.component import WebhookGatewayComponent
104
- from gateway.webhook.dependencies import get_sac_component
65
+ from solace_agent_mesh.gateway.webhook.app import WebhookGatewayApp
66
+ from solace_agent_mesh.gateway.webhook.component import WebhookGatewayComponent
67
+ from solace_agent_mesh.gateway.webhook.dependencies import get_sac_component
105
68
  ```
106
69
 
107
70
  ## Complete Usage Guide
108
- This guide provides practical examples of how to use the components and frameworks within the `gateway` directory.
109
71
 
110
- ### 1. How to Create a Custom Gateway
72
+ ### 1. Creating a Custom Gateway
73
+
111
74
  This example shows how to use the `base` module to build a new gateway for a hypothetical external platform.
112
75
 
113
76
  ```python
114
77
  # my_gateway/app.py
115
- from gateway.base.app import BaseGatewayApp
78
+ from typing import Type, List, Dict, Any
79
+ from solace_agent_mesh.gateway.base.app import BaseGatewayApp
116
80
  from .component import MyGatewayComponent
117
81
 
118
82
  class MyGatewayApp(BaseGatewayApp):
119
83
  """Defines the application and its configuration for My Platform."""
120
- SPECIFIC_APP_SCHEMA_PARAMS = [
84
+
85
+ SPECIFIC_APP_SCHEMA_PARAMS: List[Dict[str, Any]] = [
121
86
  {
122
87
  "name": "my_platform_api_key",
123
88
  "required": True,
124
89
  "type": "string",
125
- "
90
+ "description": "API key for connecting to My Platform."
91
+ },
92
+ {
93
+ "name": "my_platform_webhook_url",
94
+ "required": False,
95
+ "type": "string",
96
+ "description": "Webhook URL for receiving events from My Platform."
97
+ }
98
+ ]
99
+
100
+ def _get_gateway_component_class(self) -> Type[MyGatewayComponent]:
101
+ return MyGatewayComponent
102
+
103
+ # my_gateway/component.py
104
+ from typing import Any, Dict, List, Optional, Tuple, Union
105
+ from solace_agent_mesh.gateway.base.component import BaseGatewayComponent
106
+ from a2a.types import Part as A2APart, TextPart, Task, TaskStatusUpdateEvent, TaskArtifactUpdateEvent, JSONRPCError
107
+
108
+ class MyGatewayComponent(BaseGatewayComponent):
109
+
110
+ def __init__(self, **kwargs):
111
+ super().__init__(**kwargs)
112
+ self.api_key = self.get_config("my_platform_api_key")
113
+ self.webhook_url = self.get_config("my_platform_webhook_url")
114
+ self.server = None
115
+
116
+ async def _extract_initial_claims(self, external_event_data: Any) -> Optional[Dict[str, Any]]:
117
+ """Extract user identity from platform-specific event."""
118
+ if hasattr(external_event_data, 'user_id'):
119
+ return {"id": external_event_data.user_id, "source": "my_platform"}
120
+ return None
121
+
122
+ def _start_listener(self) -> None:
123
+ """Start your platform listener (web server, etc.)."""
124
+ # Example: Start a web server to receive webhooks
125
+ from fastapi import FastAPI
126
+ import uvicorn
127
+
128
+ app = FastAPI()
129
+
130
+ @app.post("/webhook")
131
+ async def handle_webhook(request_data: dict):
132
+ await self.handle_external_event(request_data)
133
+ return {"status": "ok"}
134
+
135
+ self.server = uvicorn.Server(
136
+ uvicorn.Config(app, host="0.0.0.0", port=8080)
137
+ )
138
+ # Start server in background thread
139
+ import threading
140
+ self.server_thread = threading.Thread(target=self.server.run)
141
+ self.server_thread.start()
142
+
143
+ def _stop_listener(self) -> None:
144
+ """Stop your platform listener."""
145
+ if self.server:
146
+ self.server.should_exit = True
147
+
148
+ def _translate_external_input(self, external_event: Any) -> Tuple[str, List[A2APart], Dict[str, Any]]:
149
+ """Convert external event to A2A format."""
150
+ target_agent = external_event.get("target_agent", "default-agent")
151
+ message_text = external_event.get("message", "Hello")
152
+
153
+ a2a_parts = [TextPart(text=message_text)]
154
+
155
+ context = {
156
+ "platform": "my_platform",
157
+ "user_id_for_artifacts": external_event.get("user_id"),
158
+ "a2a_session_id": f"my-platform-{external_event.get('session_id', 'default')}"
159
+ }
160
+
161
+ return target_agent, a2a_parts, context
162
+
163
+ async def _send_update_to_external(self, external_request_context: Dict[str, Any],
164
+ event_data: Union[TaskStatusUpdateEvent, TaskArtifactUpdateEvent],
165
+ is_final_chunk_of_update: bool) -> None:
166
+ """Send streaming update back to external platform."""
167
+ # Extract text from event and send to your platform
168
+ if hasattr(event_data, 'text_delta'):
169
+ await self.send_to_platform(
170
+ user_id=external_request_context["user_id_for_artifacts"],
171
+ message=event_data.text_delta,
172
+ is_partial=not is_final_chunk_of_update
173
+ )
174
+
175
+ async def _send_final_response_to_external(self, external_request_context: Dict[str, Any],
176
+ task_data: Task) -> None:
177
+ """Send final response back to external platform."""
178
+ final_text = ""
179
+ for part in task_data.result.parts:
180
+ if hasattr(part, 'text'):
181
+ final_text += part.text
182
+
183
+ await self.send_to_platform(
184
+ user_id=external_request_context["user_id_for_artifacts"],
185
+ message=final_text,
186
+ is_final=True
187
+ )
188
+
189
+ async def _send_error_to_external(self, external_request_context: Dict[str, Any],
190
+ error_data: JSONRPCError) -> None:
191
+ """Send error back to external platform."""
192
+ await self.send_to_platform(
193
+ user_id=external_request_context["user_id_for_artifacts"],
194
+ message=f"Error: {error_data.message}",
195
+ is_error=True
196
+ )
197
+
198
+ async def send_to_platform(self, user_id: str, message: str, **kwargs):
199
+ """Helper method to send messages to your platform."""
200
+ # Implement your platform-specific sending logic here
201
+ print(f"Sending to {user_id}: {message}")
202
+
203
+ # Usage
204
+ if __name__ == "__main__":
205
+ app_config = {
206
+ "namespace": "myorg/prod",
207
+ "gateway_id": "my-gateway-01",
208
+ "my_platform_api_key": "secret-key-here",
209
+ "my_platform_webhook_url": "https://myplatform.com/webhook"
210
+ }
211
+
212
+ gateway_app = MyGatewayApp(app_info=app_config)
213
+ gateway_app.run()
214
+ ```
215
+
216
+ ### 2. Using the HTTP/SSE Gateway
217
+
218
+ ```python
219
+ from solace_agent_mesh.gateway.http_sse.app import WebUIBackendApp
220
+
221
+ # Configuration for the web UI gateway
222
+ app_config = {
223
+ "name": "my-webui-gateway",
224
+ "session_secret_key": "your-secret-key-here",
225
+ "fastapi_host": "0.0.0.0",
226
+ "fastapi_port": 8000,
227
+ "namespace": "myorg/prod",
228
+ "gateway_id": "webui-gateway-01",
229
+ "cors_allowed_origins": ["http://localhost:3000"],
230
+ "frontend_welcome_message": "Welcome to my A2A system!",
231
+ "frontend_bot_name": "My Assistant",
232
+ "frontend_enable_file_upload": True,
233
+ "frontend_enable_agent_selection": True
234
+ }
235
+
236
+ # Initialize and run the web UI gateway
237
+ webui_app = WebUIBackendApp(app_info=app_config)
238
+ webui_app.run()
239
+
240
+ # The gateway will start a FastAPI server with endpoints like:
241
+ # GET /api/agents - List available agents
242
+ # POST /api/tasks - Submit new tasks
243
+ # GET /api/tasks/{task_id}/sse - Stream task updates via SSE
244
+ # POST /api/artifacts - Upload files
245
+ ```
246
+
247
+ ### 3. Creating Custom API Endpoints for HTTP/SSE Gateway
248
+
249
+ ```python
250
+ from fastapi import APIRouter, Depends, Request
251
+ from solace_agent_mesh.gateway.http_sse.dependencies import (
252
+ get_agent_registry,
253
+ get_user_id,
254
+ get_publish_a2a_func,
255
+ get_sse_manager,
256
+ get_session_manager
257
+ )
258
+
259
+ # Create a custom router
260
+ custom_router = APIRouter(prefix="/api/custom")
261
+
262
+ @custom_router.get("/my-agents")
263
+ async def get_my_agents(
264
+ user_id: str = Depends(get_user_id),
265
+ agent_registry = Depends(get_agent_registry)
266
+ ):
267
+ """Get agents filtered by user permissions."""
268
+ all_agents = agent_registry.get_all_agents()
269
+ # Filter agents based on user permissions
270
+ user_agents = [agent for agent in all_agents if user_can_access_agent(user_id, agent)]
271
+ return {"agents": user_agents, "user_id": user_id}
272
+
273
+ @custom_router.post("/broadcast-message")
274
+ async def broadcast_message(
275
+ message: str,
276
+ publish_func = Depends(get_publish_a2a_func),
277
+ user_id: str = Depends(get_user_id)
278
+ ):
279
+ """Broadcast a message to all agents."""
280
+ publish_func(
281
+ topic="/myorg/prod/a2a/v1/broadcast",
282
+ payload={
283
+ "method": "broadcast/message",
284
+ "params": {"message": message, "from_user": user_id}
285
+ },
286
+ user_properties={"clientId": user_id}
287
+ )
288
+ return {"status": "broadcasted", "message": message}
289
+
290
+ # Add the router to your FastAPI app
291
+ # This would typically be done in the main.py or during app setup
292
+ ```
293
+
294
+ ### 4. Using the Slack Gateway
295
+
296
+ ```python
297
+ from solace_agent_mesh.gateway.slack.app import SlackGatewayApp
298
+
299
+ # Configuration for Slack gateway
300
+ slack_config = {
301
+ "name": "my-slack-gateway",
302
+ "namespace": "myorg/prod",
303
+ "gateway_id": "slack-gateway-01",
304
+ "slack_bot_token": "xoxb-your-bot-token",
305
+ "slack_app_token": "xapp-your-app-token",
306
+ "slack_signing_secret": "your-signing-secret",
307
+ "default_agent_name": "assistant",
308
+ "enable_socket_mode": True,
309
+ "enable_file_upload": True
310
+ }
311
+
312
+ # Initialize and run the Slack gateway
313
+ slack_app = SlackGatewayApp(app_info=slack_config)
314
+ slack_app.run()
315
+
316
+ # The gateway will:
317
+ # - Connect to Slack via Socket Mode or HTTP
318
+ # - Listen for mentions and direct messages
319
+ # - Translate Slack messages to A2A format
320
+ # - Send responses back to Slack channels/threads
321
+ ```
322
+
323
+ ### 5. Using the Webhook Gateway
324
+
325
+ ```python
326
+ from solace_agent_mesh.gateway.webhook.app import WebhookGatewayApp
327
+
328
+ # Configuration for webhook gateway
329
+ webhook_config = {
330
+ "name": "my-webhook-gateway",
331
+ "namespace": "myorg/prod",
332
+ "gateway_id": "webhook-gateway-01",
333
+ "webhook_host": "0.0.0.0",
334
+ "webhook_port": 9000,
335
+ "webhook_path": "/webhook",
336
+ "target_agent_name": "data-processor",
337
+ "auth_method": "header",
338
+ "auth_header_name": "X-API-Key",
339
+ "auth_header_value": "secret-webhook-key",
340
+ "payload_format": "json",
341
+ "user_id_extraction": {
342
+ "method": "json_path",
343
+ "path": "$.user.id"
344
+ }
345
+ }
346
+
347
+ # Initialize and run the webhook gateway
348
+ webhook_app = WebhookGatewayApp(app_info=webhook_config)
349
+ webhook_app.run()
350
+
351
+ # The gateway will:
352
+ # - Start an HTTP server on the specified host/port
353
+ # - Authenticate incoming requests
354
+ # - Extract user identity from payloads
355
+ # - Convert webhook data to A2A messages
356
+ # - Send to the specified target agent
357
+ ```
358
+
359
+ ### 6. Working with Task Context Management
360
+
361
+ ```python
362
+ from solace_agent_mesh.gateway.base.task_context import TaskContextManager
363
+
364
+ # Initialize the task context manager (usually done by BaseGat
365
+
366
+ # content_hash: 8ff3c690b39ed85edd13c1e9f2965e9da9050eeeea66823dbbad322f600f0d09