solace-agent-mesh 1.0.7__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 (163) 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/services.py +9 -1
  8. solace_agent_mesh/agent/adk/setup.py +11 -0
  9. solace_agent_mesh/agent/adk/stream_parser.py +8 -1
  10. solace_agent_mesh/agent/adk/tool_wrapper.py +10 -3
  11. solace_agent_mesh/agent/agent_llm.txt +355 -18
  12. solace_agent_mesh/agent/protocol/event_handlers.py +433 -296
  13. solace_agent_mesh/agent/protocol/protocol_llm.txt +54 -7
  14. solace_agent_mesh/agent/sac/app.py +1 -1
  15. solace_agent_mesh/agent/sac/component.py +212 -517
  16. solace_agent_mesh/agent/sac/sac_llm.txt +133 -63
  17. solace_agent_mesh/agent/testing/testing_llm.txt +25 -58
  18. solace_agent_mesh/agent/tools/peer_agent_tool.py +15 -11
  19. solace_agent_mesh/agent/tools/tools_llm.txt +234 -69
  20. solace_agent_mesh/agent/utils/artifact_helpers.py +35 -1
  21. solace_agent_mesh/agent/utils/utils_llm.txt +90 -105
  22. solace_agent_mesh/assets/docs/404.html +3 -3
  23. solace_agent_mesh/assets/docs/assets/js/{3d406171.7d02a73b.js → 3d406171.0b9eeed1.js} +1 -1
  24. solace_agent_mesh/assets/docs/assets/js/6e0db977.39a79ca9.js +1 -0
  25. solace_agent_mesh/assets/docs/assets/js/{75384d09.ccd480c4.js → 75384d09.bf78fbdb.js} +1 -1
  26. solace_agent_mesh/assets/docs/assets/js/90dd9cf6.88f385ea.js +1 -0
  27. solace_agent_mesh/assets/docs/assets/js/f284c35a.fb68323a.js +1 -0
  28. solace_agent_mesh/assets/docs/assets/js/main.a75ecc0d.js +2 -0
  29. solace_agent_mesh/assets/docs/assets/js/runtime~main.458efb1d.js +1 -0
  30. solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +4 -4
  31. solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +4 -4
  32. solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +4 -4
  33. solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +4 -4
  34. solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +4 -4
  35. solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +4 -4
  36. solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +4 -4
  37. solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +4 -4
  38. solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +4 -4
  39. solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +4 -4
  40. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +4 -4
  41. solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +4 -4
  42. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +4 -4
  43. solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +4 -4
  44. 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
  45. solace_agent_mesh/assets/docs/docs/documentation/migration-guides/a2a-upgrade-to-0.3.0/a2a-technical-migration-map/index.html +53 -0
  46. solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +4 -4
  47. solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +8 -8
  48. solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +4 -4
  49. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +4 -4
  50. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +4 -4
  51. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +4 -4
  52. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +4 -4
  53. solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +4 -4
  54. solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +4 -4
  55. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +4 -4
  56. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +4 -4
  57. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +4 -4
  58. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +4 -4
  59. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +4 -4
  60. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +4 -4
  61. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +4 -4
  62. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +4 -4
  63. solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +4 -4
  64. solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +4 -4
  65. solace_agent_mesh/assets/docs/lunr-index-1756992446316.json +1 -0
  66. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  67. solace_agent_mesh/assets/docs/search-doc-1756992446316.json +1 -0
  68. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  69. solace_agent_mesh/assets/docs/sitemap.xml +1 -1
  70. solace_agent_mesh/cli/__init__.py +1 -1
  71. solace_agent_mesh/cli/commands/add_cmd/web_add_agent_step.py +12 -3
  72. solace_agent_mesh/cli/commands/add_cmd/web_add_gateway_step.py +10 -14
  73. solace_agent_mesh/cli/commands/init_cmd/web_init_step.py +2 -15
  74. solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +6 -2
  75. solace_agent_mesh/cli/utils.py +15 -0
  76. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-DvlO62me.js → authCallback-BmF2l6vg.js} +1 -1
  77. solace_agent_mesh/client/webui/frontend/static/assets/{client-bp6u3qVZ.js → client-D881Dttc.js} +4 -4
  78. solace_agent_mesh/client/webui/frontend/static/assets/main-C0jZjYa8.js +699 -0
  79. solace_agent_mesh/client/webui/frontend/static/assets/main-CCeG324-.css +1 -0
  80. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +2 -2
  81. solace_agent_mesh/client/webui/frontend/static/index.html +3 -3
  82. solace_agent_mesh/common/a2a/__init__.py +213 -0
  83. solace_agent_mesh/common/a2a/a2a_llm.txt +182 -0
  84. solace_agent_mesh/common/a2a/artifact.py +328 -0
  85. solace_agent_mesh/common/a2a/events.py +183 -0
  86. solace_agent_mesh/common/a2a/message.py +307 -0
  87. solace_agent_mesh/common/a2a/protocol.py +513 -0
  88. solace_agent_mesh/common/a2a/task.py +127 -0
  89. solace_agent_mesh/common/a2a/translation.py +653 -0
  90. solace_agent_mesh/common/a2a/types.py +54 -0
  91. solace_agent_mesh/common/a2a_spec/a2a.json +2576 -0
  92. solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +407 -0
  93. solace_agent_mesh/common/a2a_spec/schemas/agent_progress_update.json +18 -0
  94. solace_agent_mesh/common/a2a_spec/schemas/artifact_creation_progress.json +31 -0
  95. solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +18 -0
  96. solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +235 -0
  97. solace_agent_mesh/common/a2a_spec/schemas/tool_invocation_start.json +26 -0
  98. solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +25 -0
  99. solace_agent_mesh/common/agent_registry.py +1 -1
  100. solace_agent_mesh/common/common_llm.txt +192 -70
  101. solace_agent_mesh/common/data_parts.py +99 -0
  102. solace_agent_mesh/common/middleware/middleware_llm.txt +17 -17
  103. solace_agent_mesh/common/sac/__init__.py +0 -0
  104. solace_agent_mesh/common/sac/sac_llm.txt +71 -0
  105. solace_agent_mesh/common/sac/sam_component_base.py +252 -0
  106. solace_agent_mesh/common/services/providers/providers_llm.txt +51 -84
  107. solace_agent_mesh/common/services/services_llm.txt +206 -26
  108. solace_agent_mesh/common/utils/artifact_utils.py +29 -0
  109. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +176 -80
  110. solace_agent_mesh/common/utils/utils_llm.txt +323 -42
  111. solace_agent_mesh/config_portal/backend/common.py +1 -1
  112. solace_agent_mesh/config_portal/frontend/static/client/assets/{_index-MqsrTd6g.js → _index-Bym6YkMd.js} +74 -24
  113. solace_agent_mesh/config_portal/frontend/static/client/assets/{components-B7lKcHVY.js → components-Rk0n-9cK.js} +1 -1
  114. solace_agent_mesh/config_portal/frontend/static/client/assets/{entry.client-CEumGClk.js → entry.client-mvZjNKiz.js} +1 -1
  115. solace_agent_mesh/config_portal/frontend/static/client/assets/{index-DSo1AH_7.js → index-DzNKzXrc.js} +1 -1
  116. solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-d845808d.js +1 -0
  117. solace_agent_mesh/config_portal/frontend/static/client/assets/{root-C4XmHinv.js → root-BWvk5-gF.js} +1 -1
  118. solace_agent_mesh/config_portal/frontend/static/client/index.html +3 -3
  119. solace_agent_mesh/core_a2a/core_a2a_llm.txt +10 -8
  120. solace_agent_mesh/core_a2a/service.py +20 -44
  121. solace_agent_mesh/gateway/base/app.py +27 -1
  122. solace_agent_mesh/gateway/base/base_llm.txt +177 -72
  123. solace_agent_mesh/gateway/base/component.py +294 -523
  124. solace_agent_mesh/gateway/gateway_llm.txt +299 -58
  125. solace_agent_mesh/gateway/http_sse/component.py +156 -183
  126. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +29 -29
  127. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +272 -36
  128. solace_agent_mesh/gateway/http_sse/main.py +8 -10
  129. solace_agent_mesh/gateway/http_sse/routers/agents.py +1 -1
  130. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +18 -4
  131. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +231 -5
  132. solace_agent_mesh/gateway/http_sse/routers/sessions.py +12 -7
  133. solace_agent_mesh/gateway/http_sse/routers/tasks.py +116 -169
  134. solace_agent_mesh/gateway/http_sse/services/agent_service.py +1 -1
  135. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +89 -135
  136. solace_agent_mesh/gateway/http_sse/services/task_service.py +2 -5
  137. solace_agent_mesh/solace_agent_mesh_llm.txt +362 -0
  138. solace_agent_mesh/templates/gateway_component_template.py +149 -98
  139. {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/METADATA +5 -4
  140. {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/RECORD +144 -127
  141. solace_agent_mesh/assets/docs/assets/js/f284c35a.731836ad.js +0 -1
  142. solace_agent_mesh/assets/docs/assets/js/main.d79f063b.js +0 -2
  143. solace_agent_mesh/assets/docs/assets/js/runtime~main.6415ad00.js +0 -1
  144. solace_agent_mesh/assets/docs/lunr-index-1756146501924.json +0 -1
  145. solace_agent_mesh/assets/docs/search-doc-1756146501924.json +0 -1
  146. solace_agent_mesh/client/webui/frontend/static/assets/main-BCpII1-0.css +0 -1
  147. solace_agent_mesh/client/webui/frontend/static/assets/main-BucUdn9m.js +0 -673
  148. solace_agent_mesh/common/a2a_protocol.py +0 -564
  149. solace_agent_mesh/common/client/__init__.py +0 -4
  150. solace_agent_mesh/common/client/card_resolver.py +0 -21
  151. solace_agent_mesh/common/client/client.py +0 -85
  152. solace_agent_mesh/common/client/client_llm.txt +0 -133
  153. solace_agent_mesh/common/server/__init__.py +0 -4
  154. solace_agent_mesh/common/server/server.py +0 -122
  155. solace_agent_mesh/common/server/server_llm.txt +0 -169
  156. solace_agent_mesh/common/server/task_manager.py +0 -291
  157. solace_agent_mesh/common/server/utils.py +0 -28
  158. solace_agent_mesh/common/types.py +0 -411
  159. solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-28271392.js +0 -1
  160. /solace_agent_mesh/assets/docs/assets/js/{main.d79f063b.js.LICENSE.txt → main.a75ecc0d.js.LICENSE.txt} +0 -0
  161. {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/WHEEL +0 -0
  162. {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/entry_points.txt +0 -0
  163. {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,52 +1,51 @@
1
+ # DEVELOPER GUIDE: base
2
+
1
3
  ## Quick Summary
2
- The `base` directory provides the foundational, abstract classes for building Gateway implementations within the Solace AI Connector. It establishes a framework for handling common gateway tasks such as application configuration, Solace broker integration, A2A (Agent-to-Agent) message protocol handling, and managing the lifecycle of requests from external platforms. Developers should subclass `BaseGatewayApp` and `BaseGatewayComponent` to create a new gateway.
4
+ The `base` directory provides foundational abstract classes for building Gateway implementations within the Solace AI Connector. It establishes a framework for handling common gateway tasks such as application configuration, Solace broker integration, A2A (Agent-to-Agent) message protocol handling, and managing the lifecycle of requests from external platforms. Developers should subclass `BaseGatewayApp` and `BaseGatewayComponent` to create new gateways.
3
5
 
4
6
  ## Files Overview
5
- - `__init__.py`: Marks the directory as a Python package.
6
- - `app.py`: Contains the base application class (`BaseGatewayApp`) that handles configuration, schema merging, and broker setup.
7
- - `component.py`: Contains the core logic class (`BaseGatewayComponent`) for processing A2A messages and integrating with external platforms.
8
- - `task_context.py`: Provides a thread-safe manager for mapping A2A task IDs to their original request context.
7
+ - `__init__.py` - Marks the directory as a Python package
8
+ - `app.py` - Contains the base application class that handles configuration, schema merging, and broker setup
9
+ - `component.py` - Contains the core logic class for processing A2A messages and integrating with external platforms
10
+ - `task_context.py` - Provides a thread-safe manager for mapping A2A task IDs to their original request context
9
11
 
10
12
  ## Developer API Reference
11
13
 
12
14
  ### __init__.py
13
- **Purpose:** Initializes the `gateway.base` Python package.
14
- **Import:** `from gateway.base import ...`
15
+ **Purpose:** Initializes the `gateway.base` Python package
16
+ **Import:** `from solace_agent_mesh.gateway.base import ...`
15
17
 
16
18
  ---
17
19
 
18
20
  ### app.py
19
- **Purpose:** Provides the base application class for gateway implementations. It automates configuration schema merging, Solace broker setup (including topic subscriptions and queue creation), and component instantiation.
20
- **Import:** `from gateway.base.app import BaseGatewayApp, BaseGatewayComponent`
21
+ **Purpose:** Provides the base application class for gateway implementations with automated configuration schema merging, Solace broker setup, and component instantiation
22
+ **Import:** `from solace_agent_mesh.gateway.base.app import BaseGatewayApp, BaseGatewayComponent`
21
23
 
22
24
  **Classes:**
23
- - `BaseGatewayComponent(ComponentBase)` - A base class marker for gateway components. Subclasses of `BaseGatewayComponent` from `component.py` inherit from this.
24
- - `BaseGatewayApp(app_info: Dict[str, Any], **kwargs)` - The main application class to be subclassed for a new gateway.
25
- - `_get_gateway_component_class(self) -> Type[BaseGatewayComponent]` - **[Abstract Method]** Must be implemented by subclasses to return the specific gateway component class that will handle the core logic.
26
- - `namespace: str` - The absolute topic prefix for A2A communication (e.g., 'myorg/dev').
27
- - `gateway_id: str` - The unique ID for this gateway instance. Auto-generated if not provided.
28
- - `artifact_service_config: Dict` - Configuration for the shared ADK Artifact Service.
29
- - `enable_embed_resolution: bool` - Flag to enable or disable late-stage 'artifact_content' embed resolution.
30
- - `gateway_max_artifact_resolve_size_bytes: int` - Maximum size for resolving individual or recursively embedded artifacts.
31
- - `gateway_recursive_embed_depth: int` - Maximum depth for recursively resolving 'artifact_content' embeds.
25
+ - `BaseGatewayComponent(ComponentBase)` - Base marker class for gateway components
26
+ - `BaseGatewayApp(app_info: Dict[str, Any], **kwargs)` - Main application class to be subclassed for new gateways
27
+ - `_get_gateway_component_class(self) -> Type[BaseGatewayComponent]` - **[Abstract Method]** Must return the specific gateway component class
28
+ - `namespace: str` - Absolute topic prefix for A2A communication (e.g., 'myorg/dev')
29
+ - `gateway_id: str` - Unique ID for this gateway instance (auto-generated if not provided)
30
+ - `artifact_service_config: Dict` - Configuration for the shared ADK Artifact Service
31
+ - `enable_embed_resolution: bool` - Flag to enable/disable late-stage 'artifact_content' embed resolution
32
+ - `gateway_max_artifact_resolve_size_bytes: int` - Maximum size for resolving artifacts (default: 104857600)
33
+ - `gateway_recursive_embed_depth: int` - Maximum depth for recursive embed resolution (default: 12)
32
34
 
33
35
  **Constants/Variables:**
34
- - `BASE_GATEWAY_APP_SCHEMA: Dict[str, List[Dict[str, Any]]]` - The base configuration schema dictionary that is automatically merged with subclass-specific parameters.
35
- - `SPECIFIC_APP_SCHEMA_PARAMS_ATTRIBUTE_NAME: str` - The class attribute name (`"SPECIFIC_APP_SCHEMA_PARAMS"`) that subclasses should use to define their own configuration parameters.
36
+ - `BASE_GATEWAY_APP_SCHEMA: Dict[str, List[Dict[str, Any]]]` - Base configuration schema automatically merged with subclass parameters
37
+ - `SPECIFIC_APP_SCHEMA_PARAMS_ATTRIBUTE_NAME: str` - Class attribute name ("SPECIFIC_APP_SCHEMA_PARAMS") for subclass-specific config parameters
36
38
 
37
39
  **Usage Examples:**
38
40
  ```python
39
- # In your custom gateway's app.py
40
-
41
41
  from typing import Type, List, Dict, Any
42
- from gateway.base.app import BaseGatewayApp
43
- from .component import MyGatewayComponent # Your custom component
42
+ from solace_agent_mesh.gateway.base.app import BaseGatewayApp
43
+ from .component import MyGatewayComponent
44
44
 
45
45
  class MyGatewayApp(BaseGatewayApp):
46
- """
47
- A custom gateway application for My Platform.
48
- """
49
- # Define additional configuration parameters specific to this gateway
46
+ """Custom gateway application for My Platform."""
47
+
48
+ # Define additional configuration parameters
50
49
  SPECIFIC_APP_SCHEMA_PARAMS: List[Dict[str, Any]] = [
51
50
  {
52
51
  "name": "my_platform_api_key",
@@ -57,63 +56,169 @@ class MyGatewayApp(BaseGatewayApp):
57
56
  ]
58
57
 
59
58
  def _get_gateway_component_class(self) -> Type[MyGatewayComponent]:
60
- """
61
- Returns our custom component class.
62
- """
63
59
  return MyGatewayComponent
64
60
 
65
- # To run this app (typically via a YAML configuration file):
66
- # app_config = {
67
- # "name": "my-gateway-app",
68
- # "app_class": MyGatewayApp,
69
- # "app_config": {
70
- # "namespace": "myorg/prod",
71
- # "gateway_id": "my-gateway-instance-01",
72
- # "artifact_service": {
73
- # "type": "local_file",
74
- # "base_path": "/data/artifacts"
75
- # },
76
- # "my_platform_api_key": "secret-key-here"
77
- # }
78
- # }
79
- # app = MyGatewayApp(app_info=app_config)
80
- # app.run()
61
+ # Usage in YAML config:
62
+ # app_config:
63
+ # namespace: "myorg/prod"
64
+ # gateway_id: "my-gateway-instance-01"
65
+ # artifact_service:
66
+ # type: "local_file"
67
+ # base_path: "/data/artifacts"
68
+ # my_platform_api_key: "secret-key-here"
81
69
  ```
82
70
 
83
71
  ---
84
72
 
85
73
  ### component.py
86
- **Purpose:** Provides the abstract base class for gateway components. This class contains the core logic for handling the A2A protocol, managing services (identity, artifacts), and defining the interface for interaction with an external platform (e.g., a web server, a chat application).
87
- **Import:** `from gateway.base.component import BaseGatewayComponent`
74
+ **Purpose:** Provides the abstract base class for gateway components containing core A2A protocol logic, service management, and external platform integration interface
75
+ **Import:** `from solace_agent_mesh.gateway.base.component import BaseGatewayComponent`
88
76
 
89
77
  **Classes:**
90
- - `BaseGatewayComponent(**kwargs: Any)` - The abstract base class for gateway components. Developers must subclass this and implement the abstract methods.
78
+ - `BaseGatewayComponent(**kwargs: Any)` - Abstract base class for gateway components
91
79
  - **Public Methods:**
92
- - `publish_a2a_message(self, topic: str, payload: Dict, user_properties: Optional[Dict] = None) -> None` - Publishes a message to the Solace broker for A2A communication.
93
- - `authenticate_and_enrich_user(self, external_event_data: Any) -> Optional[Dict[str, Any]]` - Orchestrates the full user authentication and identity enrichment flow by calling `_extract_initial_claims` and the configured Identity Service.
94
- - `submit_a2a_task(self, target_agent_name: str, a2a_parts: List[A2APart], external_request_context: Dict[str, Any], user_identity: Any, is_streaming: bool = True, api_version: str = "v2") -> str` - Submits a task to a target agent, handling user configuration resolution, message creation, and context storage. Returns the generated `task_id`.
95
- - `run(self) -> None` - Starts the component's asynchronous operations, including the message processor loop and the external platform listener.
96
- - `cleanup(self) -> None` - Cleans up all resources, stops listeners, and shuts down background threads.
97
- - **Abstract Methods (Must be Implemented by Subclasses):**
98
- - `_extract_initial_claims(self, external_event_data: Any) -> Optional[Dict[str, Any]]` - Extracts primary identity claims (e.g., user ID) from a platform-specific event. Must return a dict with an 'id' key, or None if auth fails.
99
- - `_start_listener(self) -> None` - Starts the listener for the external platform (e.g., start a web server, connect to a WebSocket).
100
- - `_stop_listener(self) -> None` - Stops the listener for the external platform.
101
- - `_translate_external_input(self, external_event: Any) -> Tuple[str, List[A2APart], Dict[str, Any]]` - Translates an incoming event from the external platform into a format the A2A protocol understands: `(target_agent_name, list_of_a2a_parts, external_request_context)`.
102
- - `_send_update_to_external(self, external_request_context: Dict[str, Any], event_data: Union[TaskStatusUpdateEvent, TaskArtifactUpdateEvent], is_final_chunk_of_update: bool) -> None` - Sends a streaming update (e.g., a status message or an artifact) back to the external platform.
103
- - `_send_final_response_to_external(self, external_request_context: Dict[str, Any], task_data: Task) -> None` - Sends the final, complete response of a task back to the external platform.
104
- - `_send_error_to_external(self, external_request_context: Dict[str, Any], error_data: JSONRPCError) -> None` - Sends an error message back to the external platform.
80
+ - `get_config(self, key: str, default: Any = None) -> Any` - Retrieves configuration from nested app_config or component_config
81
+ - `publish_a2a_message(self, topic: str, payload: Dict, user_properties: Optional[Dict] = None) -> None` - Publishes A2A messages to Solace broker
82
+ - `authenticate_and_enrich_user(self, external_event_data: Any) -> Optional[Dict[str, Any]]` - Orchestrates user authentication and identity enrichment
83
+ - `submit_a2a_task(self, target_agent_name: str, a2a_parts: List[ContentPart], external_request_context: Dict[str, Any], user_identity: Any, is_streaming: bool = True, api_version: str = "v2") -> str` - Submits task to target agent, returns task_id
84
+ - `run(self) -> None` - Starts component's async operations and external platform listener
85
+ - `cleanup(self) -> None` - Cleans up resources and stops background threads
86
+ - **Abstract Methods (Must be Implemented):**
87
+ - `_extract_initial_claims(self, external_event_data: Any) -> Optional[Dict[str, Any]]` - Extract identity claims from platform event (must return dict with 'id' key)
88
+ - `_start_listener(self) -> None` - Start external platform listener (e.g., web server, WebSocket)
89
+ - `_stop_listener(self) -> None` - Stop external platform listener
90
+ - `_translate_external_input(self, external_event: Any) -> Tuple[str, List[ContentPart], Dict[str, Any]]` - Convert external event to A2A format: (target_agent_name, a2a_parts, context)
91
+ - `_send_update_to_external(self, external_request_context: Dict[str, Any], event_data: Union[TaskStatusUpdateEvent, TaskArtifactUpdateEvent], is_final_chunk_of_update: bool) -> None` - Send streaming update to external platform
92
+ - `_send_final_response_to_external(self, external_request_context: Dict[str, Any], task_data: Task) -> None` - Send final response to external platform
93
+ - `_send_error_to_external(self, external_request_context: Dict[str, Any], error_data: JSONRPCError) -> None` - Send error to external platform
94
+ - **Properties:**
95
+ - `namespace: str` - A2A communication namespace
96
+ - `gateway_id: str` - Unique gateway instance ID
97
+ - `agent_registry: AgentRegistry` - Registry for discovered agents
98
+ - `core_a2a_service: CoreA2AService` - Core A2A protocol service
99
+ - `shared_artifact_service: Optional[BaseArtifactService]` - Artifact service instance
100
+ - `task_context_manager: TaskContextManager` - Thread-safe task context storage
101
+ - `identity_service: Optional[BaseIdentityService]` - Identity enrichment service
105
102
 
106
103
  **Usage Examples:**
107
104
  ```python
108
- # In your custom gateway's component.py
109
-
110
105
  from typing import Any, Dict, List, Optional, Tuple, Union
111
- from gateway.base.component import BaseGatewayComponent
112
- from ...common.types import (
113
- Part as A2APart, TextPart, Task, TaskStatusUpdateEvent,
114
- TaskArtifactUpdateEvent, JSONRPCError
115
- )
106
+ from solace_agent_mesh.gateway.base.component import BaseGatewayComponent
107
+ from solace_agent_mesh.common.a2a.types import ContentPart
108
+ from a2a.types import TextPart, Task, TaskStatusUpdateEvent, TaskArtifactUpdateEvent, JSONRPCError
116
109
 
117
110
  class MyGatewayComponent(BaseGatewayComponent):
118
- # This is a simplified example. A real implementation would
119
- #
111
+
112
+ async def _extract_initial_claims(self, external_event_data: Any) -> Optional[Dict[str, Any]]:
113
+ """Extract user identity from platform-specific event."""
114
+ # Example for HTTP request
115
+ if hasattr(external_event_data, 'headers'):
116
+ user_id = external_event_data.headers.get('X-User-ID')
117
+ if user_id:
118
+ return {"id": user_id, "source": "http_header"}
119
+ return None
120
+
121
+ def _start_listener(self) -> None:
122
+ """Start your platform listener (web server, etc.)."""
123
+ # Example: Start FastAPI server, WebSocket connection, etc.
124
+ pass
125
+
126
+ def _stop_listener(self) -> None:
127
+ """Stop your platform listener."""
128
+ pass
129
+
130
+ async def _translate_external_input(self, external_event: Any) -> Tuple[str, List[ContentPart], Dict[str, Any]]:
131
+ """Convert external event to A2A format."""
132
+ # Example translation
133
+ target_agent = "my-agent"
134
+ message_text = getattr(external_event, 'message', 'Hello')
135
+ a2a_parts = [TextPart(text=message_text)]
136
+ context = {
137
+ "platform": "my_platform",
138
+ "user_id_for_artifacts": "user123",
139
+ "a2a_session_id": "session456"
140
+ }
141
+ return target_agent, a2a_parts, context
142
+
143
+ async def _send_update_to_external(self, external_request_context: Dict[str, Any],
144
+ event_data: Union[TaskStatusUpdateEvent, TaskArtifactUpdateEvent],
145
+ is_final_chunk_of_update: bool) -> None:
146
+ """Send streaming update back to external platform."""
147
+ # Extract text from event and send to your platform
148
+ pass
149
+
150
+ async def _send_final_response_to_external(self, external_request_context: Dict[str, Any],
151
+ task_data: Task) -> None:
152
+ """Send final response back to external platform."""
153
+ # Extract final result and send to your platform
154
+ pass
155
+
156
+ async def _send_error_to_external(self, external_request_context: Dict[str, Any],
157
+ error_data: JSONRPCError) -> None:
158
+ """Send error back to external platform."""
159
+ # Send error message to your platform
160
+ pass
161
+
162
+ # Usage in your handler:
163
+ async def handle_external_request(request):
164
+ # Authenticate user
165
+ user_identity = await component.authenticate_and_enrich_user(request)
166
+ if not user_identity:
167
+ return "Authentication failed"
168
+
169
+ # Translate request
170
+ target_agent, a2a_parts, context = await component._translate_external_input(request)
171
+
172
+ # Submit to A2A system
173
+ task_id = await component.submit_a2a_task(
174
+ target_agent_name=target_agent,
175
+ a2a_parts=a2a_parts,
176
+ external_request_context=context,
177
+ user_identity=user_identity,
178
+ is_streaming=True
179
+ )
180
+
181
+ return f"Task submitted: {task_id}"
182
+ ```
183
+
184
+ ---
185
+
186
+ ### task_context.py
187
+ **Purpose:** Provides thread-safe storage for mapping A2A task IDs to their original external request context
188
+ **Import:** `from solace_agent_mesh.gateway.base.task_context import TaskContextManager`
189
+
190
+ **Classes:**
191
+ - `TaskContextManager()` - Thread-safe context storage manager
192
+ - `store_context(self, task_id: str, context_data: Dict[str, Any]) -> None` - Store context for a task ID
193
+ - `get_context(self, task_id: str) -> Optional[Dict[str, Any]]` - Retrieve context for a task ID
194
+ - `remove_context(self, task_id: str) -> Optional[Dict[str, Any]]` - Remove and return context for a task ID
195
+ - `clear_all_contexts_for_testing(self) -> None` - Clear all contexts (testing only)
196
+
197
+ **Usage Examples:**
198
+ ```python
199
+ from solace_agent_mesh.gateway.base.task_context import TaskContextManager
200
+
201
+ # Initialize manager
202
+ context_manager = TaskContextManager()
203
+
204
+ # Store context when submitting task
205
+ task_id = "gdk-task-abc123"
206
+ context = {
207
+ "platform": "slack",
208
+ "channel_id": "C1234567890",
209
+ "thread_ts": "1234567890.123456",
210
+ "user_identity": {"id": "user123", "name": "John Doe"}
211
+ }
212
+ context_manager.store_context(task_id, context)
213
+
214
+ # Retrieve context when processing response
215
+ retrieved_context = context_manager.get_context(task_id)
216
+ if retrieved_context:
217
+ channel_id = retrieved_context["channel_id"]
218
+ # Send response back to Slack channel
219
+
220
+ # Clean up when task is complete
221
+ context_manager.remove_context(task_id)
222
+ ```
223
+
224
+ # content_hash: 016addd094bc383fc1606b1540887c181ef630740fff8f4d801ff03d91e1cbd4