solace-agent-mesh 1.6.1__py3-none-any.whl → 1.6.2__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 (122) hide show
  1. solace_agent_mesh/agent/adk/app_llm_agent.py +26 -0
  2. solace_agent_mesh/agent/adk/artifacts/filesystem_artifact_service.py +1 -1
  3. solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +135 -31
  4. solace_agent_mesh/agent/adk/models/lite_llm.py +5 -0
  5. solace_agent_mesh/agent/adk/runner.py +10 -12
  6. solace_agent_mesh/agent/adk/services.py +50 -14
  7. solace_agent_mesh/agent/adk/setup.py +66 -38
  8. solace_agent_mesh/agent/protocol/event_handlers.py +243 -122
  9. solace_agent_mesh/agent/proxies/a2a/app.py +3 -2
  10. solace_agent_mesh/agent/proxies/base/app.py +3 -2
  11. solace_agent_mesh/agent/sac/app.py +43 -2
  12. solace_agent_mesh/agent/sac/component.py +200 -72
  13. solace_agent_mesh/agent/sac/task_execution_context.py +35 -4
  14. solace_agent_mesh/agent/tools/tool_config_types.py +3 -0
  15. solace_agent_mesh/agent/utils/artifact_helpers.py +1 -1
  16. solace_agent_mesh/assets/docs/404.html +3 -3
  17. solace_agent_mesh/assets/docs/assets/js/240a0364.c39f8388.js +1 -0
  18. solace_agent_mesh/assets/docs/assets/js/631738c7.7c4594c9.js +1 -0
  19. solace_agent_mesh/assets/docs/assets/js/66d4869e.830d443f.js +1 -0
  20. solace_agent_mesh/assets/docs/assets/js/71da7b71.ddbdfbe2.js +1 -0
  21. solace_agent_mesh/assets/docs/assets/js/e92d0134.4f395c6b.js +1 -0
  22. solace_agent_mesh/assets/docs/assets/js/f284c35a.720d2ef2.js +1 -0
  23. solace_agent_mesh/assets/docs/assets/js/main.d1643f0b.js +2 -0
  24. solace_agent_mesh/assets/docs/assets/js/runtime~main.97f920d4.js +1 -0
  25. solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +3 -3
  26. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/artifact-management/index.html +3 -3
  27. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/audio-tools/index.html +3 -3
  28. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/data-analysis-tools/index.html +3 -3
  29. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/embeds/index.html +3 -3
  30. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/index.html +3 -3
  31. solace_agent_mesh/assets/docs/docs/documentation/components/cli/index.html +3 -3
  32. solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +3 -3
  33. solace_agent_mesh/assets/docs/docs/documentation/components/index.html +3 -3
  34. solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +3 -3
  35. solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +3 -3
  36. solace_agent_mesh/assets/docs/docs/documentation/components/proxies/index.html +3 -3
  37. solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +4 -25
  38. solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +4 -4
  39. solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +4 -4
  40. solace_agent_mesh/assets/docs/docs/documentation/deploying/logging/index.html +76 -0
  41. solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +5 -4
  42. solace_agent_mesh/assets/docs/docs/documentation/developing/create-agents/index.html +3 -3
  43. solace_agent_mesh/assets/docs/docs/documentation/developing/create-gateways/index.html +3 -3
  44. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-python-tools/index.html +3 -3
  45. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +3 -3
  46. solace_agent_mesh/assets/docs/docs/documentation/developing/evaluations/index.html +3 -3
  47. solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +3 -3
  48. solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +3 -3
  49. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/bedrock-agents/index.html +3 -3
  50. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/custom-agent/index.html +3 -3
  51. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/event-mesh-gateway/index.html +3 -3
  52. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mcp-integration/index.html +3 -3
  53. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mongodb-integration/index.html +3 -3
  54. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rag-integration/index.html +3 -3
  55. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rest-gateway/index.html +3 -3
  56. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +3 -3
  57. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/sql-database/index.html +3 -3
  58. solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +3 -3
  59. solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +3 -3
  60. solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +3 -3
  61. solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +3 -3
  62. solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +3 -3
  63. solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +3 -3
  64. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
  65. solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +3 -3
  66. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/configurations/index.html +3 -6
  67. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +3 -3
  68. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +3 -3
  69. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +3 -3
  70. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +3 -3
  71. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
  72. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-technical-migration-map/index.html +3 -3
  73. solace_agent_mesh/assets/docs/lunr-index-1761663789856.json +1 -0
  74. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  75. solace_agent_mesh/assets/docs/search-doc-1761663789856.json +1 -0
  76. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  77. solace_agent_mesh/assets/docs/sitemap.xml +1 -1
  78. solace_agent_mesh/cli/__init__.py +1 -1
  79. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-BTf6dqwp.js → authCallback-D4_RMYRh.js} +1 -1
  80. solace_agent_mesh/client/webui/frontend/static/assets/{client-CaY59VuC.js → client-UZ3qU6Bq.js} +1 -1
  81. solace_agent_mesh/client/webui/frontend/static/assets/main--3yJYl7S.css +1 -0
  82. solace_agent_mesh/client/webui/frontend/static/assets/main-DojKHS49.js +342 -0
  83. solace_agent_mesh/client/webui/frontend/static/assets/{vendor-BEmvJSYz.js → vendor-DSqhjwq_.js} +1 -1
  84. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
  85. solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
  86. solace_agent_mesh/common/a2a/events.py +2 -1
  87. solace_agent_mesh/common/sac/sam_component_base.py +24 -18
  88. solace_agent_mesh/common/utils/pydantic_utils.py +90 -3
  89. solace_agent_mesh/gateway/base/component.py +12 -8
  90. solace_agent_mesh/gateway/http_sse/app.py +7 -0
  91. solace_agent_mesh/gateway/http_sse/component.py +17 -9
  92. solace_agent_mesh/gateway/http_sse/dependencies.py +83 -59
  93. solace_agent_mesh/gateway/http_sse/main.py +3 -2
  94. solace_agent_mesh/gateway/http_sse/routers/agent_cards.py +1 -1
  95. solace_agent_mesh/gateway/http_sse/routers/auth.py +103 -6
  96. solace_agent_mesh/gateway/http_sse/routers/config.py +1 -1
  97. solace_agent_mesh/gateway/http_sse/routers/sessions.py +1 -1
  98. solace_agent_mesh/gateway/http_sse/routers/sse.py +15 -5
  99. solace_agent_mesh/gateway/http_sse/routers/tasks.py +3 -3
  100. solace_agent_mesh/gateway/http_sse/routers/visualization.py +90 -8
  101. solace_agent_mesh/gateway/http_sse/services/session_service.py +1 -1
  102. solace_agent_mesh/gateway/http_sse/session_manager.py +15 -15
  103. solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +16 -1
  104. solace_agent_mesh/gateway/http_sse/sse_manager.py +15 -6
  105. solace_agent_mesh/templates/logging_config_template.ini +2 -2
  106. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/METADATA +2 -2
  107. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/RECORD +111 -109
  108. solace_agent_mesh/assets/docs/assets/js/240a0364.7eac6021.js +0 -1
  109. solace_agent_mesh/assets/docs/assets/js/631738c7.a8b1ef8b.js +0 -1
  110. solace_agent_mesh/assets/docs/assets/js/71da7b71.38583438.js +0 -1
  111. solace_agent_mesh/assets/docs/assets/js/e92d0134.cf6d6522.js +0 -1
  112. solace_agent_mesh/assets/docs/assets/js/f284c35a.42f59cdd.js +0 -1
  113. solace_agent_mesh/assets/docs/assets/js/main.b12eac43.js +0 -2
  114. solace_agent_mesh/assets/docs/assets/js/runtime~main.e268214e.js +0 -1
  115. solace_agent_mesh/assets/docs/lunr-index-1761248203150.json +0 -1
  116. solace_agent_mesh/assets/docs/search-doc-1761248203150.json +0 -1
  117. solace_agent_mesh/client/webui/frontend/static/assets/main-B32noGmR.js +0 -342
  118. solace_agent_mesh/client/webui/frontend/static/assets/main-DHJKSW1S.css +0 -1
  119. /solace_agent_mesh/assets/docs/assets/js/{main.b12eac43.js.LICENSE.txt → main.d1643f0b.js.LICENSE.txt} +0 -0
  120. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/WHEEL +0 -0
  121. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/entry_points.txt +0 -0
  122. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/licenses/LICENSE +0 -0
@@ -3,7 +3,10 @@ Custom LlmAgent subclass for the A2A Host Component.
3
3
  """
4
4
 
5
5
  from typing import Any
6
+
6
7
  from google.adk.agents import LlmAgent
8
+ from google.adk.flows.llm_flows.base_llm_flow import BaseLlmFlow
9
+ from google.adk.flows.llm_flows.single_flow import SingleFlow
7
10
  from pydantic import Field
8
11
 
9
12
 
@@ -24,3 +27,26 @@ class AppLlmAgent(LlmAgent):
24
27
  This field is excluded from Pydantic's model serialization and validation
25
28
  if not provided during instantiation, and is intended to be set post-init.
26
29
  """
30
+
31
+ # Override the _llm_flow property to inject the patched auth preprocessor
32
+ @property
33
+ def _llm_flow(self) -> BaseLlmFlow:
34
+ try:
35
+ from solace_agent_mesh_enterprise.auth.auth_preprocessor_patch import (
36
+ request_processor,
37
+ )
38
+ except ImportError:
39
+ # If enterprise module doesn't exist, use standard parent flow
40
+ return super()._llm_flow
41
+
42
+ llm_flow = super()._llm_flow
43
+ if isinstance(llm_flow, SingleFlow):
44
+ # Replace auth_preprocessor.request_processor with the patched version from _AuthLlmRequestProcessorPatched
45
+ from google.adk.auth import auth_preprocessor
46
+
47
+ for i, processor in enumerate(llm_flow.request_processors):
48
+ if processor is auth_preprocessor.request_processor:
49
+ llm_flow.request_processors[i] = request_processor
50
+ break
51
+
52
+ return llm_flow
@@ -45,7 +45,7 @@ class FilesystemArtifactService(BaseArtifactService):
45
45
  try:
46
46
  os.makedirs(self.base_path, exist_ok=True)
47
47
  logger.info(
48
- "FilesystemArtifactService initialized. Base path: %s",
48
+ "Initialized FilesystemArtifactService. Base path: %s",
49
49
  self.base_path,
50
50
  )
51
51
  except OSError as e:
@@ -1,44 +1,116 @@
1
1
  """
2
2
  Custom MCPToolset that resolves embeds in tool parameters before calling MCP tools.
3
+
4
+ This module uses dynamic inheritance to support both standard and enterprise MCP tools:
5
+ - Standard mode: Inherits from MCPTool and MCPToolset (Google ADK)
6
+ - Enterprise mode: Inherits from McpToolWithManifest and McpToolsetWithManifest
7
+ (adds manifest support and tool_config parameter)
8
+
9
+ The base class is determined at import time based on enterprise package availability.
3
10
  """
4
11
 
5
12
  import logging
6
- import asyncio
7
- from typing import Dict, List, Optional, Any
8
-
9
- from google.adk.tools.mcp_tool import MCPToolset, MCPTool
10
- from google.adk.tools.mcp_tool.mcp_session_manager import (
11
- SseConnectionParams,
12
- StdioConnectionParams,
13
- StreamableHTTPConnectionParams,
14
- )
15
- from google.adk.tools.tool_context import ToolContext
13
+ from typing import Any
16
14
 
15
+ from google.adk.auth.credential_manager import CredentialManager
16
+ from google.adk.tools.mcp_tool import MCPTool, MCPToolset
17
+ from google.adk.tools.tool_context import ToolContext
17
18
 
18
- from ..utils.context_helpers import get_original_session_id
19
19
  from ...common.utils.embeds import (
20
- resolve_embeds_in_string,
21
- evaluate_embed,
22
20
  EARLY_EMBED_TYPES,
23
- LATE_EMBED_TYPES,
24
21
  EMBED_DELIMITER_OPEN,
22
+ LATE_EMBED_TYPES,
23
+ evaluate_embed,
24
+ resolve_embeds_in_string,
25
25
  )
26
+ from ..utils.context_helpers import get_original_session_id
26
27
 
27
28
  log = logging.getLogger(__name__)
28
29
 
29
- class EmbedResolvingMCPTool(MCPTool):
30
+ def _get_base_mcp_toolset_class() -> tuple[type[MCPToolset], bool]:
31
+ """
32
+ Factory function to determine which base MCP toolset class to use for inheritance.
33
+
34
+ Tries to import McpToolsetWithManifest from solace_agent_mesh_enterprise.common
35
+ and returns it if available. Falls back to base MCPToolset if not available.
36
+
37
+ Returns:
38
+ Tuple of (class, supports_tool_config_flag) where:
39
+ - class: The base MCPToolset class to inherit from
40
+ - supports_tool_config_flag: Whether the class supports tool_config parameter
41
+ """
42
+ try:
43
+ from solace_agent_mesh_enterprise.auth.mcp_toolset_with_manifest import (
44
+ McpToolsetWithManifest,
45
+ )
46
+
47
+ return (McpToolsetWithManifest, True)
48
+ except ImportError:
49
+ return (MCPToolset, False)
50
+
51
+
52
+ def _get_base_mcp_tool_class() -> tuple[type[MCPTool], bool]:
53
+ """
54
+ Factory function to determine which base MCP tool class to use for inheritance.
55
+
56
+ Tries to import McpToolWithManifest from solace_agent_mesh_enterprise.common
57
+ and returns it if available. Falls back to base MCPTool if not available.
58
+
59
+ Returns:
60
+ Tuple of (class, supports_tool_config_flag) where:
61
+ - class: The base MCPTool class to inherit from
62
+ - supports_tool_config_flag: Whether the class supports tool_config parameter
63
+ """
64
+ try:
65
+ from solace_agent_mesh_enterprise.auth.mcp_toolset_with_manifest import (
66
+ McpToolWithManifest,
67
+ )
68
+
69
+ return (McpToolWithManifest, True)
70
+ except ImportError:
71
+ return (MCPTool, False)
72
+
73
+
74
+ # Get the base tool class to use for inheritance
75
+ _BaseMcpToolClass, _base_supports_tool_config = _get_base_mcp_tool_class()
76
+
77
+
78
+ class EmbedResolvingMCPTool(_BaseMcpToolClass):
30
79
  """
31
80
  Custom MCPTool that resolves embeds in parameters before calling the actual MCP tool.
81
+ Uses dynamic inheritance to conditionally inherit from McpToolWithManifest when available,
82
+ falling back to the standard MCPTool base class.
32
83
  """
33
84
 
34
- def __init__(self, original_mcp_tool: MCPTool, tool_config: Optional[Dict] = None):
85
+ def __init__(
86
+ self,
87
+ original_mcp_tool: MCPTool,
88
+ tool_config: dict | None = None,
89
+ credential_manager: CredentialManager | None = None,
90
+ ):
35
91
  # Copy all attributes from the original tool
36
- super().__init__(
37
- mcp_tool=original_mcp_tool._mcp_tool,
38
- mcp_session_manager=original_mcp_tool._mcp_session_manager,
39
- auth_scheme=getattr(original_mcp_tool, "_auth_scheme", None),
40
- auth_credential=getattr(original_mcp_tool, "_auth_credential", None),
41
- )
92
+ if _base_supports_tool_config:
93
+ super().__init__(
94
+ mcp_tool=original_mcp_tool._mcp_tool,
95
+ mcp_session_manager=original_mcp_tool._mcp_session_manager,
96
+ auth_scheme=getattr(original_mcp_tool._mcp_tool, "auth_scheme", None),
97
+ auth_credential=getattr(
98
+ original_mcp_tool._mcp_tool, "auth_credential", None
99
+ ),
100
+ auth_discovery=getattr(
101
+ original_mcp_tool._mcp_tool, "auth_discovery", None
102
+ ),
103
+ credential_manager=credential_manager,
104
+ )
105
+ else:
106
+ super().__init__(
107
+ mcp_tool=original_mcp_tool._mcp_tool,
108
+ mcp_session_manager=original_mcp_tool._mcp_session_manager,
109
+ auth_scheme=getattr(original_mcp_tool._mcp_tool, "auth_scheme", None),
110
+ auth_credential=getattr(
111
+ original_mcp_tool._mcp_tool, "auth_credential", None
112
+ ),
113
+ )
42
114
  self._original_mcp_tool = original_mcp_tool
43
115
  self._tool_config = tool_config or {}
44
116
 
@@ -254,9 +326,15 @@ class EmbedResolvingMCPTool(MCPTool):
254
326
  )
255
327
 
256
328
 
257
- class EmbedResolvingMCPToolset(MCPToolset):
329
+ # Get the base toolset class to use for inheritance
330
+ _BaseMcpToolsetClass, _base_toolset_supports_tool_config = _get_base_mcp_toolset_class()
331
+
332
+
333
+ class EmbedResolvingMCPToolset(_BaseMcpToolsetClass):
258
334
  """
259
335
  Custom MCPToolset that creates EmbedResolvingMCPTool instances for embed resolution.
336
+ Uses dynamic inheritance to conditionally inherit from McpToolsetWithManifest when available,
337
+ falling back to the standard MCPToolset base class.
260
338
  """
261
339
 
262
340
  def __init__(
@@ -265,20 +343,43 @@ class EmbedResolvingMCPToolset(MCPToolset):
265
343
  tool_filter=None,
266
344
  auth_scheme=None,
267
345
  auth_credential=None,
268
- tool_config: Optional[Dict] = None,
346
+ auth_discovery=None,
347
+ tool_config: dict | None = None,
348
+ credential_manager: CredentialManager | None = None,
269
349
  ):
270
- super().__init__(
271
- connection_params=connection_params,
272
- tool_filter=tool_filter,
273
- auth_scheme=auth_scheme,
274
- auth_credential=auth_credential,
275
- )
350
+ # Store tool_config for later use
276
351
  self._tool_config = tool_config or {}
277
352
 
278
- async def get_tools(self, readonly_context=None) -> List[MCPTool]:
353
+ # Initialize base class with appropriate parameters
354
+ if _base_toolset_supports_tool_config:
355
+ super().__init__(
356
+ connection_params=connection_params,
357
+ tool_filter=tool_filter,
358
+ auth_scheme=auth_scheme,
359
+ auth_credential=auth_credential,
360
+ auth_discovery=auth_discovery,
361
+ tool_config=tool_config,
362
+ )
363
+ else:
364
+ # Base MCPToolset doesn't support tool_config parameter
365
+ super().__init__(
366
+ connection_params=connection_params,
367
+ tool_filter=tool_filter,
368
+ auth_scheme=auth_scheme,
369
+ auth_credential=auth_credential,
370
+ )
371
+
372
+ self._tool_cache = []
373
+ self._credential_manager = credential_manager
374
+
375
+ async def get_tools(self, readonly_context=None) -> list[MCPTool]:
279
376
  """
280
377
  Override get_tools to return EmbedResolvingMCPTool instances.
281
378
  """
379
+
380
+ if self._tool_cache:
381
+ return self._tool_cache
382
+
282
383
  # Get the original tools from the parent class
283
384
  original_tools = await super().get_tools(readonly_context)
284
385
 
@@ -294,7 +395,10 @@ class EmbedResolvingMCPToolset(MCPToolset):
294
395
  embed_resolving_tool = EmbedResolvingMCPTool(
295
396
  original_mcp_tool=tool,
296
397
  tool_config=tool_specific_config,
398
+ credential_manager=self._credential_manager,
297
399
  )
298
400
  embed_resolving_tools.append(embed_resolving_tool)
299
401
 
402
+ self._tool_cache = embed_resolving_tools
300
403
  return embed_resolving_tools
404
+
@@ -699,6 +699,11 @@ class LiteLlm(BaseLlm):
699
699
  super().__init__(model=model, **kwargs)
700
700
  self._additional_args = kwargs.copy()
701
701
 
702
+ # Remove handlers added by LiteLLM as they produce duplicate and misformatted logs.
703
+ # Logging is an application concern and libraries should not set handlers/formatters.
704
+ for logger_name in ["LiteLLM", "LiteLLM Proxy", "LiteLLM Router", "litellm"]:
705
+ logging.getLogger(logger_name).handlers.clear()
706
+
702
707
  # Validate and store cache strategy
703
708
  valid_strategies = ["none", "5m", "1h"]
704
709
  if cache_strategy not in valid_strategies:
@@ -38,6 +38,7 @@ async def run_adk_async_task_thread_wrapper(
38
38
  adk_content: adk_types.Content,
39
39
  run_config: RunConfig,
40
40
  a2a_context: dict[str, Any],
41
+ append_context_event: bool = True,
41
42
  ):
42
43
  """
43
44
  Wrapper to run the async ADK task.
@@ -73,9 +74,8 @@ async def run_adk_async_task_thread_wrapper(
73
74
  logical_task_id,
74
75
  )
75
76
 
76
- if adk_session and component.session_service:
77
+ if adk_session and component.session_service and append_context_event:
77
78
  context_setting_invocation_id = logical_task_id
78
- original_message = a2a_context.pop("original_solace_message", None)
79
79
  try:
80
80
  context_setting_event = ADKEvent(
81
81
  invocation_id=context_setting_invocation_id,
@@ -107,15 +107,13 @@ async def run_adk_async_task_thread_wrapper(
107
107
  e_append,
108
108
  exc_info=True,
109
109
  )
110
- finally:
111
- if original_message:
112
- a2a_context["original_solace_message"] = original_message
113
110
  else:
114
- log.warning(
115
- "%s Could not inject a2a_context into ADK session state via event for task %s (session or session_service invalid). Tool scope filtering might not work.",
116
- component.log_identifier,
117
- logical_task_id,
118
- )
111
+ if append_context_event:
112
+ log.warning(
113
+ "%s Could not inject a2a_context into ADK session state via event for task %s (session or session_service invalid). Tool scope filtering might not work.",
114
+ component.log_identifier,
115
+ logical_task_id,
116
+ )
119
117
 
120
118
  is_paused = await run_adk_async_task(
121
119
  component,
@@ -198,7 +196,7 @@ async def run_adk_async_task_thread_wrapper(
198
196
  "%s Bad Request for task %s: %s.",
199
197
  component.log_identifier,
200
198
  logical_task_id,
201
- e.message
199
+ e.message,
202
200
  )
203
201
  raise
204
202
  except Exception as e:
@@ -345,7 +343,7 @@ async def run_adk_async_task(
345
343
  "%s Bad Request for task %s: %s.",
346
344
  component.log_identifier,
347
345
  logical_task_id,
348
- e.message
346
+ e.message,
349
347
  )
350
348
  raise
351
349
  except Exception as e:
@@ -5,28 +5,32 @@ Initializes ADK Services based on configuration.
5
5
  import logging
6
6
  import os
7
7
  import re
8
- from typing import Dict, Optional, List, Any
9
- from typing_extensions import override
10
-
11
- from google.genai import types as adk_types
8
+ from typing import Any, Dict, List, Optional
12
9
 
13
-
14
- from google.adk.sessions import (
15
- BaseSessionService,
16
- InMemorySessionService,
17
- DatabaseSessionService,
18
- VertexAiSessionService,
19
- )
20
10
  from google.adk.artifacts import (
21
11
  BaseArtifactService,
22
- InMemoryArtifactService,
23
12
  GcsArtifactService,
13
+ InMemoryArtifactService,
14
+ )
15
+ from google.adk.auth.credential_service.base_credential_service import (
16
+ BaseCredentialService,
17
+ )
18
+ from google.adk.auth.credential_service.in_memory_credential_service import (
19
+ InMemoryCredentialService,
24
20
  )
25
21
  from google.adk.memory import (
26
22
  BaseMemoryService,
27
23
  InMemoryMemoryService,
28
24
  VertexAiRagMemoryService,
29
25
  )
26
+ from google.adk.sessions import (
27
+ BaseSessionService,
28
+ DatabaseSessionService,
29
+ InMemorySessionService,
30
+ VertexAiSessionService,
31
+ )
32
+ from google.genai import types as adk_types
33
+ from typing_extensions import override
30
34
 
31
35
  from .artifacts.filesystem_artifact_service import FilesystemArtifactService
32
36
 
@@ -170,9 +174,9 @@ def initialize_session_service(component) -> BaseSessionService:
170
174
  config = component.get_config("session_service", {})
171
175
 
172
176
  # Handle both dict and SessionServiceConfig object
173
- if hasattr(config, 'type'):
177
+ if hasattr(config, "type"):
174
178
  service_type = config.type.lower()
175
- db_url = getattr(config, 'database_url', None)
179
+ db_url = getattr(config, "database_url", None)
176
180
  else:
177
181
  service_type = config.get("type", "memory").lower()
178
182
  db_url = config.get("database_url")
@@ -390,3 +394,35 @@ def initialize_memory_service(component) -> BaseMemoryService:
390
394
  raise ValueError(
391
395
  f"{component.log_identifier} Unsupported memory service type: {service_type}"
392
396
  )
397
+
398
+
399
+ def initialize_credential_service(component) -> BaseCredentialService | None:
400
+ """Initializes the ADK Credential Service based on configuration."""
401
+ config = component.get_config("credential_service", None)
402
+
403
+ # If no credential service is configured, return None
404
+ if config is None:
405
+ log.info(
406
+ "%s No credential service configured, skipping initialization",
407
+ component.log_identifier,
408
+ )
409
+ return None
410
+
411
+ # Handle both dict and CredentialServiceConfig object
412
+ if hasattr(config, "type"):
413
+ service_type = config.type.lower()
414
+ else:
415
+ service_type = config.get("type", "memory").lower()
416
+
417
+ log.info(
418
+ "%s Initializing Credential Service of type: %s",
419
+ component.log_identifier,
420
+ service_type,
421
+ )
422
+
423
+ if service_type == "memory":
424
+ return InMemoryCredentialService()
425
+ else:
426
+ raise ValueError(
427
+ f"{component.log_identifier} Unsupported credential service type: {service_type}"
428
+ )
@@ -2,39 +2,31 @@
2
2
  Handles ADK Agent and Runner initialization, including tool loading and callback assignment.
3
3
  """
4
4
 
5
- import logging
6
- from typing import Dict, List, Optional, Union, Callable, Tuple, Set, Any, TYPE_CHECKING, Type
7
5
  import functools
8
6
  import inspect
9
- from solace_ai_connector.common.utils import import_module
10
- from ...common.utils.type_utils import is_subclass_by_name
11
-
7
+ import logging
8
+ from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
12
9
 
13
- from .app_llm_agent import AppLlmAgent
14
- from .tool_wrapper import ADKToolWrapper
15
- from .embed_resolving_mcp_toolset import EmbedResolvingMCPToolset
16
- from google.adk.runners import Runner
17
- from google.adk.models import BaseLlm
18
- from google.adk.tools import BaseTool, ToolContext
19
10
  from google.adk import tools as adk_tools_module
20
11
  from google.adk.agents.callback_context import CallbackContext
12
+ from google.adk.models import BaseLlm
21
13
  from google.adk.models.llm_request import LlmRequest
22
14
  from google.adk.models.llm_response import LlmResponse
15
+ from google.adk.runners import Runner
16
+ from google.adk.tools import BaseTool, ToolContext
23
17
  from google.adk.tools.mcp_tool.mcp_session_manager import (
24
18
  SseServerParams,
25
19
  StdioConnectionParams,
26
20
  StreamableHTTPServerParams,
27
-
28
21
  )
29
-
30
22
  from mcp import StdioServerParameters
23
+ from solace_ai_connector.common.utils import import_module
31
24
 
32
- if TYPE_CHECKING:
33
- from ..sac.component import SamAgentComponent
34
-
35
- from ..tools.registry import tool_registry
36
- from ..tools.tool_definition import BuiltinTool
25
+ from ...agent.adk import callbacks as adk_callbacks
26
+ from ...agent.adk.models.lite_llm import LiteLlm
27
+ from ...common.utils.type_utils import is_subclass_by_name
37
28
  from ..tools.dynamic_tool import DynamicTool, DynamicToolProvider
29
+ from ..tools.registry import tool_registry
38
30
  from ..tools.tool_config_types import (
39
31
  AnyToolConfig,
40
32
  BuiltinToolConfig,
@@ -42,10 +34,13 @@ from ..tools.tool_config_types import (
42
34
  McpToolConfig,
43
35
  PythonToolConfig,
44
36
  )
37
+ from ..tools.tool_definition import BuiltinTool
38
+ from .app_llm_agent import AppLlmAgent
39
+ from .embed_resolving_mcp_toolset import EmbedResolvingMCPToolset
40
+ from .tool_wrapper import ADKToolWrapper
45
41
 
46
-
47
- from ...agent.adk import callbacks as adk_callbacks
48
- from ...agent.adk.models.lite_llm import LiteLlm
42
+ if TYPE_CHECKING:
43
+ from ..sac.component import SamAgentComponent
49
44
 
50
45
  log = logging.getLogger(__name__)
51
46
 
@@ -585,11 +580,43 @@ async def _load_mcp_tool(component: "SamAgentComponent", tool_config: Dict) -> T
585
580
  tool_config_model.tool_name,
586
581
  )
587
582
 
588
- mcp_toolset_instance = EmbedResolvingMCPToolset(
589
- connection_params=connection_params,
590
- tool_filter=tool_filter_list,
591
- tool_config=tool_config,
592
- )
583
+ additional_params = {}
584
+ try:
585
+ from solace_agent_mesh_enterprise.auth.tool_configurator import (
586
+ configure_mcp_tool,
587
+ )
588
+
589
+ try:
590
+ # Call the tool configurator with MCP-specific context
591
+ additional_params = configure_mcp_tool(
592
+ tool_type="mcp",
593
+ tool_config=tool_config,
594
+ connection_params=connection_params,
595
+ tool_filter=tool_filter_list,
596
+ )
597
+ except Exception as e:
598
+ log.error(
599
+ "%s Tool configurator failed for %s: %s",
600
+ component.log_identifier,
601
+ tool_config.get("name", "unknown"),
602
+ e,
603
+ )
604
+ # Continue with normal tool creation if configurator fails
605
+ additional_params = {}
606
+ except ImportError:
607
+ pass
608
+
609
+ # Create the EmbedResolvingMCPToolset with base parameters
610
+ toolset_params = {
611
+ "connection_params": connection_params,
612
+ "tool_filter": tool_filter_list,
613
+ "tool_config": tool_config,
614
+ }
615
+
616
+ # Merge additional parameters from configurator
617
+ toolset_params.update(additional_params)
618
+
619
+ mcp_toolset_instance = EmbedResolvingMCPToolset(**toolset_params)
593
620
  mcp_toolset_instance.origin = "mcp"
594
621
 
595
622
  log.info(
@@ -891,7 +918,7 @@ def initialize_adk_agent(
891
918
  callbacks_in_order_for_before_model.append(
892
919
  adk_callbacks.repair_history_callback
893
920
  )
894
- log.info(
921
+ log.debug(
895
922
  "%s Added repair_history_callback to before_model chain.",
896
923
  component.log_identifier,
897
924
  )
@@ -900,7 +927,7 @@ def initialize_adk_agent(
900
927
  callbacks_in_order_for_before_model.append(
901
928
  component._inject_peer_tools_callback
902
929
  )
903
- log.info(
930
+ log.debug(
904
931
  "%s Added _inject_peer_tools_callback to before_model chain.",
905
932
  component.log_identifier,
906
933
  )
@@ -909,7 +936,7 @@ def initialize_adk_agent(
909
936
  callbacks_in_order_for_before_model.append(
910
937
  component._filter_tools_by_capability_callback
911
938
  )
912
- log.info(
939
+ log.debug(
913
940
  "%s Added _filter_tools_by_capability_callback to before_model chain.",
914
941
  component.log_identifier,
915
942
  )
@@ -917,7 +944,7 @@ def initialize_adk_agent(
917
944
  callbacks_in_order_for_before_model.append(
918
945
  component._inject_gateway_instructions_callback
919
946
  )
920
- log.info(
947
+ log.debug(
921
948
  "%s Added _inject_gateway_instructions_callback to before_model chain.",
922
949
  component.log_identifier,
923
950
  )
@@ -930,7 +957,7 @@ def initialize_adk_agent(
930
957
  callbacks_in_order_for_before_model.append(
931
958
  dynamic_instruction_callback_with_component
932
959
  )
933
- log.info(
960
+ log.debug(
934
961
  "%s Added inject_dynamic_instructions_callback to before_model chain.",
935
962
  component.log_identifier,
936
963
  )
@@ -957,7 +984,7 @@ def initialize_adk_agent(
957
984
  return None
958
985
 
959
986
  agent.before_model_callback = final_before_model_wrapper
960
- log.info(
987
+ log.debug(
961
988
  "%s Final before_model_callback chain (Solace logging now occurs last) assigned to agent.",
962
989
  component.log_identifier,
963
990
  )
@@ -967,7 +994,7 @@ def initialize_adk_agent(
967
994
  host_component=component,
968
995
  )
969
996
  agent.before_tool_callback = tool_invocation_start_cb_with_component
970
- log.info(
997
+ log.debug(
971
998
  "%s Assigned notify_tool_invocation_start_callback as before_tool_callback.",
972
999
  component.log_identifier,
973
1000
  )
@@ -1053,7 +1080,7 @@ def initialize_adk_agent(
1053
1080
  return tool_response
1054
1081
 
1055
1082
  agent.after_tool_callback = chained_after_tool_callback
1056
- log.info(
1083
+ log.debug(
1057
1084
  "%s Chained 'manage_large_mcp_tool_responses_callback' and 'after_tool_callback_inject_metadata' as after_tool_callback.",
1058
1085
  component.log_identifier,
1059
1086
  )
@@ -1067,7 +1094,7 @@ def initialize_adk_agent(
1067
1094
  adk_callbacks.process_artifact_blocks_callback, host_component=component
1068
1095
  )
1069
1096
  callbacks_in_order_for_after_model.append(artifact_block_cb)
1070
- log.info(
1097
+ log.debug(
1071
1098
  "%s Added process_artifact_blocks_callback to after_model chain.",
1072
1099
  component.log_identifier,
1073
1100
  )
@@ -1077,7 +1104,7 @@ def initialize_adk_agent(
1077
1104
  adk_callbacks.auto_continue_on_max_tokens_callback, host_component=component
1078
1105
  )
1079
1106
  callbacks_in_order_for_after_model.append(auto_continue_cb)
1080
- log.info(
1107
+ log.debug(
1081
1108
  "%s Added auto_continue_on_max_tokens_callback to after_model chain.",
1082
1109
  component.log_identifier,
1083
1110
  )
@@ -1110,7 +1137,7 @@ def initialize_adk_agent(
1110
1137
  return None
1111
1138
 
1112
1139
  agent.after_model_callback = final_after_model_wrapper
1113
- log.info(
1140
+ log.debug(
1114
1141
  "%s Chained all after_model_callbacks and assigned to agent.",
1115
1142
  component.log_identifier,
1116
1143
  )
@@ -1157,9 +1184,10 @@ def initialize_adk_runner(component) -> Runner:
1157
1184
  session_service=component.session_service,
1158
1185
  artifact_service=component.artifact_service,
1159
1186
  memory_service=component.memory_service,
1187
+ credential_service=component.credential_service,
1160
1188
  )
1161
1189
  log.info("%s ADK Runner created successfully.", component.log_identifier)
1162
1190
  return runner
1163
1191
  except Exception as e:
1164
1192
  log.error("%s Failed to create ADK Runner: %s", component.log_identifier, e)
1165
- raise
1193
+ raise