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,124 +1,220 @@
1
- Here is the developer guide for the `embeds` directory.
1
+ # DEVELOPER GUIDE: embeds
2
2
 
3
3
  ## Quick Summary
4
- The `embeds` directory provides a system for finding, parsing, and resolving embedded expressions within strings. These expressions, denoted by `«...»`, can represent dynamic values like mathematical calculations, datetimes, or content from stored artifacts. The system supports multi-step data transformation pipelines on artifact content, recursive embed resolution, and safety features like depth and size limits. It is a core component for dynamic content generation and data processing.
4
+ The `embeds` directory provides a comprehensive system for finding, parsing, and resolving embedded expressions within strings. These expressions use `«...»` syntax and can represent dynamic values like mathematical calculations, datetimes, UUIDs, or content from stored artifacts. The system supports multi-step data transformation pipelines, recursive embed resolution, and includes safety features like depth and size limits. It's designed as a core component for dynamic content generation and data processing in agent workflows.
5
5
 
6
6
  ## Files Overview
7
- - `__init__.py`: Exports the primary public functions and constants for easy access.
8
- - `constants.py`: Defines the syntax (delimiters, separators), regular expressions, and type classifications for embeds.
9
- - `converter.py`: Provides functions for converting data between different formats (e.g., bytes, string, JSON) and for serializing data into a final string representation.
10
- - `evaluators.py`: Contains the specific logic for evaluating simple embed types like `math`, `datetime`, and `uuid`.
11
- - `modifiers.py`: Implements a library of data transformation functions (e.g., `jsonpath`, `slice_rows`, `grep`) that can be chained together.
12
- - `resolver.py`: The core engine that orchestrates the entire embed resolution process, including handling modifier chains and recursion.
13
- - `types.py`: Defines the `DataFormat` enum used to track data types during transformations.
7
+ - `__init__.py` - Main public entry point exporting key functions and constants
8
+ - `constants.py` - Defines embed syntax (delimiters, separators), regex patterns, and type classifications
9
+ - `converter.py` - Data format conversion and serialization functions
10
+ - `evaluators.py` - Specific evaluation logic for simple embed types (math, datetime, uuid, etc.)
11
+ - `modifiers.py` - Data transformation functions that can be chained together (jsonpath, slice, grep, etc.)
12
+ - `resolver.py` - Core orchestration engine handling embed resolution, modifier chains, and recursion
13
+ - `types.py` - DataFormat enum for tracking data types during transformations
14
14
 
15
15
  ## Developer API Reference
16
16
 
17
17
  ### __init__.py
18
- **Purpose:** This module serves as the main public entry point for the `embeds` package, exporting the most commonly used functions and constants from the other modules. Developers should typically import from here.
18
+ **Purpose:** Main public entry point that exports the most commonly used functions and constants from other modules.
19
19
 
20
- **Import:** `from src.solace_agent_mesh.common.utils.embeds import resolve_embeds_recursively_in_string, evaluate_embed, EMBED_REGEX`
21
-
22
- *(Note: Detailed documentation is available under each source file's section.)*
23
-
24
- **Classes:**
25
- - None
20
+ **Import:** `from solace_agent_mesh.common.utils.embeds import resolve_embeds_recursively_in_string, evaluate_embed, EMBED_REGEX`
26
21
 
27
22
  **Functions:**
28
- - `evaluate_embed(...)`: Evaluates a single, parsed embed expression.
29
- - `resolve_embeds_in_string(...)`: Resolves embeds in a string for a single pass (non-recursive).
30
- - `resolve_embeds_recursively_in_string(...)`: Recursively finds and resolves all embeds in a string, respecting depth and size limits.
23
+ - `evaluate_embed(embed_type: str, expression: str, format_spec: Optional[str], context: Dict[str, Any], log_identifier: str, config: Optional[Dict] = None, current_depth: int = 0, visited_artifacts: Optional[Set[Tuple[str, int]]] = None) -> Union[Tuple[str, Optional[str], int], Tuple[None, str, Any]]` - Evaluates a single parsed embed expression
24
+ - `resolve_embeds_in_string(text: str, context: Any, resolver_func: Callable, types_to_resolve: Set[str], log_identifier: str = "[EmbedUtil]", config: Optional[Dict[str, Any]] = None) -> Tuple[str, int, List[Tuple[int, Any]]]` - Resolves embeds in a string for a single pass (non-recursive)
25
+ - `resolve_embeds_recursively_in_string(text: str, context: Any, resolver_func: Callable, types_to_resolve: Set[str], log_identifier: str, config: Optional[Dict], max_depth: int, current_depth: int = 0, visited_artifacts: Optional[Set[Tuple[str, int]]] = None, accumulated_size: int = 0, max_total_size: int = -1) -> str` - Recursively resolves all embeds in a string with depth and size limits
31
26
 
32
27
  **Constants/Variables:**
33
- - `EMBED_DELIMITER_OPEN: str`: The opening delimiter for an embed (`«`).
34
- - `EMBED_DELIMITER_CLOSE: str`: The closing delimiter for an embed (`»`).
35
- - `EMBED_TYPE_SEPARATOR: str`: The separator between an embed's type and its expression (`:`).
36
- - `EMBED_FORMAT_SEPARATOR: str`: The separator for an optional format specifier (`|`).
37
- - `EMBED_CHAIN_DELIMITER: str`: The separator for modifier steps in an `artifact_content` chain (`>>>`).
38
- - `EMBED_REGEX: re.Pattern`: The compiled regular expression used to find embeds.
39
- - `EARLY_EMBED_TYPES: Set[str]`: A set of embed types that are resolved in an initial pass.
40
- - `LATE_EMBED_TYPES: Set[str]`: A set of embed types (like `artifact_content`) resolved in a subsequent pass.
41
-
42
- ---
43
- ### constants.py
44
- **Purpose:** This file defines all the static constants that govern the syntax and classification of embeds. This includes delimiters, separators, the master regular expression for parsing, and sets that categorize embed types for phased resolution.
28
+ - `EMBED_DELIMITER_OPEN: str` - Opening delimiter (`«`)
29
+ - `EMBED_DELIMITER_CLOSE: str` - Closing delimiter (`»`)
30
+ - `EMBED_TYPE_SEPARATOR: str` - Type/expression separator (`:`)
31
+ - `EMBED_FORMAT_SEPARATOR: str` - Format specifier separator (`|`)
32
+ - `EMBED_CHAIN_DELIMITER: str` - Modifier chain separator (`>>>`)
33
+ - `EMBED_REGEX: re.Pattern` - Compiled regex for finding embeds
34
+ - `EARLY_EMBED_TYPES: Set[str]` - Types resolved in initial pass
35
+ - `LATE_EMBED_TYPES: Set[str]` - Types resolved in subsequent pass
45
36
 
46
- **Import:** `from src.solace_agent_mesh.common.utils.embeds.constants import EMBED_REGEX, EARLY_EMBED_TYPES`
37
+ **Usage Examples:**
38
+ ```python
39
+ from solace_agent_mesh.common.utils.embeds import resolve_embeds_recursively_in_string, evaluate_embed, EMBED_REGEX
40
+
41
+ # Basic embed resolution
42
+ context = {
43
+ "artifact_service": my_artifact_service,
44
+ "session_context": {"app_name": "myapp", "user_id": "user123", "session_id": "sess456"}
45
+ }
46
+
47
+ text = "The result is «math:10 * 1.15 | .2f» and ID is «uuid:new»"
48
+ resolved = await resolve_embeds_recursively_in_string(
49
+ text=text,
50
+ context=context,
51
+ resolver_func=evaluate_embed,
52
+ types_to_resolve={"math", "uuid"},
53
+ log_identifier="[MyApp]",
54
+ config={},
55
+ max_depth=5
56
+ )
57
+ ```
47
58
 
48
- **Classes:**
49
- - None
59
+ ### constants.py
60
+ **Purpose:** Defines all static constants governing embed syntax and classification.
50
61
 
51
- **Functions:**
52
- - None
62
+ **Import:** `from solace_agent_mesh.common.utils.embeds.constants import EMBED_REGEX, EARLY_EMBED_TYPES`
53
63
 
54
64
  **Constants/Variables:**
55
- - `EMBED_DELIMITER_OPEN: str`: The character that marks the beginning of an embed (`«`).
56
- - `EMBED_DELIMITER_CLOSE: str`: The character that marks the end of an embed (`»`).
57
- - `EMBED_TYPE_SEPARATOR: str`: The character separating the embed type from its expression (`:`).
58
- - `EMBED_FORMAT_SEPARATOR: str`: The character separating an expression from its optional format specifier (`|`).
59
- - `EMBED_CHAIN_DELIMITER: str`: The string separating transformation steps in an `artifact_content` embed (`>>>`).
60
- - `EMBED_REGEX: re.Pattern`: A compiled regular expression to find and capture the `type`, `expression`, and optional `format` from an embed string.
61
- - `EARLY_EMBED_TYPES: Set[str]`: A set of embed types (`math`, `datetime`, etc.) that are resolved first, as they are generally simple, self-contained, and do not involve recursion.
62
- - `LATE_EMBED_TYPES: Set[str]`: A set of embed types (`artifact_content`) that are resolved later, as they can be complex, involve I/O, and may contain further embeds that require recursive resolution.
63
- - `TEXT_CONTAINER_MIME_TYPES: Set[str]`: A set of MIME types that are considered to contain text and can be safely decoded to a string.
65
+ - `EMBED_DELIMITER_OPEN: str` - Opening delimiter (`«`)
66
+ - `EMBED_DELIMITER_CLOSE: str` - Closing delimiter (`»`)
67
+ - `EMBED_TYPE_SEPARATOR: str` - Type/expression separator (`:`)
68
+ - `EMBED_FORMAT_SEPARATOR: str` - Format specifier separator (`|`)
69
+ - `EMBED_CHAIN_DELIMITER: str` - Modifier chain separator (`>>>`)
70
+ - `EMBED_REGEX: re.Pattern` - Compiled regex with capture groups for type, expression, and format
71
+ - `EARLY_EMBED_TYPES: Set[str]` - Simple embed types resolved first (`math`, `datetime`, `uuid`, `artifact_meta`, `status_update`)
72
+ - `LATE_EMBED_TYPES: Set[str]` - Complex embed types resolved later (`artifact_content`)
73
+ - `TEXT_CONTAINER_MIME_TYPES: Set[str]` - MIME types considered text-based
64
74
 
65
75
  **Usage Examples:**
66
76
  ```python
67
- import re
68
- from src.solace_agent_mesh.common.utils.embeds.constants import EMBED_REGEX
69
-
70
- text = "The price is «math:10 * 1.15 | .2f» and the ID is «uuid:new»."
77
+ from solace_agent_mesh.common.utils.embeds.constants import EMBED_REGEX
71
78
 
79
+ text = "Price: «math:10 * 1.15 | .2f» ID: «uuid:new»"
72
80
  for match in EMBED_REGEX.finditer(text):
73
- embed_type = match.group(1)
74
- expression = match.group(2)
75
- format_spec = match.group(3) # This will be None if not present
76
- print(f"Type: {embed_type}, Expression: '{expression}', Format: '{format_spec}'")
77
-
78
- # Expected Output:
79
- # Type: math, Expression: '10 * 1.15 ', Format: ' .2f'
80
- # Type: uuid, Expression: 'new', Format: 'None'
81
+ embed_type = match.group(1) # "math" or "uuid"
82
+ expression = match.group(2) # "10 * 1.15 " or "new"
83
+ format_spec = match.group(3) # " .2f" or None
84
+ print(f"Type: {embed_type}, Expr: '{expression}', Format: '{format_spec}'")
81
85
  ```
82
86
 
83
- ---
84
87
  ### converter.py
85
- **Purpose:** This file provides the core logic for data conversion and serialization. It can transform data between different `DataFormat` representations (e.g., `BYTES` to `STRING`, `STRING` to `LIST_OF_DICTS`) and serialize any format into a final string representation (e.g., `json`, `csv`, `datauri`).
88
+ **Purpose:** Provides data conversion between different formats and serialization to final string representations.
86
89
 
87
- **Import:** `from src.solace_agent_mesh.common.utils.embeds.converter import convert_data, serialize_data`
88
-
89
- **Classes:**
90
- - None
90
+ **Import:** `from solace_agent_mesh.common.utils.embeds.converter import convert_data, serialize_data`
91
91
 
92
92
  **Functions:**
93
- - `convert_data(current_data: Any, current_format: Optional[DataFormat], target_format: DataFormat, log_id: str = "[Converter]", original_mime_type: Optional[str] = None) -> Tuple[Any, DataFormat, Optional[str]]`: Converts data from a source format to a target format. It uses `original_mime_type` as a hint for parsing (e.g., knowing that a string is JSON or CSV). Returns a tuple of `(converted_data, resulting_format, error_message)`.
94
- - `serialize_data(data: Any, data_format: Optional[DataFormat], target_string_format: Optional[str], original_mime_type: Optional[str], log_id: str = "[Serializer]") -> Tuple[str, Optional[str]]`: Serializes data from any `DataFormat` into a final string. `target_string_format` can be a keyword like `"json"`, `"csv"`, `"datauri"`, or a Python format specifier for numbers (e.g., `".2f"`). Returns a tuple of `(serialized_string, error_message)`.
95
-
96
- **Constants/Variables:**
97
- - None
93
+ - `convert_data(current_data: Any, current_format: Optional[DataFormat], target_format: DataFormat, log_id: str = "[Converter]", original_mime_type: Optional[str] = None) -> Tuple[Any, DataFormat, Optional[str]]` - Converts data between DataFormat types using MIME type hints
94
+ - `serialize_data(data: Any, data_format: Optional[DataFormat], target_string_format: Optional[str], original_mime_type: Optional[str], log_id: str = "[Serializer]") -> Tuple[str, Optional[str]]` - Serializes data to final string format (text, json, csv, datauri, or Python format specs)
98
95
 
99
96
  **Usage Examples:**
100
97
  ```python
101
- from src.solace_agent_mesh.common.utils.embeds.converter import convert_data, serialize_data
102
- from src.solace_agent_mesh.common.utils.embeds.types import DataFormat
98
+ from solace_agent_mesh.common.utils.embeds.converter import convert_data, serialize_data
99
+ from solace_agent_mesh.common.utils.embeds.types import DataFormat
103
100
 
104
- # Example 1: Convert CSV bytes to a list of dictionaries
101
+ # Convert CSV bytes to list of dictionaries
105
102
  csv_bytes = b"id,name\n1,Alice\n2,Bob"
106
- list_of_dicts, new_format, err = convert_data(
103
+ list_data, new_format, err = convert_data(
107
104
  current_data=csv_bytes,
108
105
  current_format=DataFormat.BYTES,
109
106
  target_format=DataFormat.LIST_OF_DICTS,
110
107
  original_mime_type="text/csv"
111
108
  )
112
- if not err:
113
- print(f"Converted data: {list_of_dicts}")
114
- # Converted data: [{'id': '1', 'name': 'Alice'}, {'id': '2', 'name': 'Bob'}]
115
109
 
116
- # Example 2: Serialize the list of dictionaries back to a pretty JSON string
117
- json_string, err = serialize_data(
118
- data=list_of_dicts,
110
+ # Serialize to pretty JSON
111
+ json_str, err = serialize_data(
112
+ data=list_data,
119
113
  data_format=DataFormat.LIST_OF_DICTS,
120
114
  target_string_format="json_pretty",
121
115
  original_mime_type=None
122
116
  )
123
- if not err:
124
- print(f"Serialized JSON:\n{json_string}")
117
+ ```
118
+
119
+ ### evaluators.py
120
+ **Purpose:** Contains evaluation logic for simple embed types and the evaluator registry.
121
+
122
+ **Import:** `from solace_agent_mesh.common.utils.embeds.evaluators import EMBED_EVALUATORS`
123
+
124
+ **Functions:**
125
+ - `_evaluate_math_embed(expression: str, context: Any, log_identifier: str, format_spec: Optional[str] = None) -> Tuple[str, Optional[str], int]` - Evaluates mathematical expressions using asteval
126
+ - `_evaluate_datetime_embed(expression: str, context: Any, log_identifier: str, format_spec: Optional[str] = None) -> Tuple[str, Optional[str], int]` - Formats current datetime
127
+ - `_evaluate_uuid_embed(expression: str, context: Any, log_identifier: str, format_spec: Optional[str] = None) -> Tuple[str, Optional[str], int]` - Generates UUID4 strings
128
+ - `_evaluate_artifact_meta_embed(expression: str, context: Dict[str, Any], log_identifier: str, format_spec: Optional[str] = None) -> Tuple[str, Optional[str], int]` - Loads and formats artifact metadata
129
+ - `_evaluate_artifact_content_embed(expression: str, context: Any, log_identifier: str, config: Optional[Dict] = None) -> Tuple[Optional[bytes], Optional[str], Optional[str]]` - Loads raw artifact content
130
+
131
+ **Constants/Variables:**
132
+ - `EMBED_EVALUATORS: Dict[str, Callable]` - Registry mapping embed types to evaluator functions
133
+ - `MATH_SAFE_SYMBOLS: Dict[str, Any]` - Safe mathematical functions and constants for math embeds
134
+
135
+ **Usage Examples:**
136
+ ```python
137
+ from solace_agent_mesh.common.utils.embeds.evaluators import EMBED_EVALUATORS
138
+
139
+ # Math evaluation
140
+ result, error, size = EMBED_EVALUATORS["math"]("2 + 3 * 4", {}, "[Test]", ".2f")
141
+ # result: "14.00", error: None, size: 5
142
+
143
+ # DateTime formatting
144
+ result, error, size = EMBED_EVALUATORS["datetime"]("%Y-%m-%d", {}, "[Test]")
145
+ # result: "2024-01-15", error: None, size: 10
146
+ ```
147
+
148
+ ### modifiers.py
149
+ **Purpose:** Implements data transformation functions that can be chained together in artifact_content embeds.
150
+
151
+ **Import:** `from solace_agent_mesh.common.utils.embeds.modifiers import MODIFIER_DEFINITIONS, _parse_modifier_chain`
152
+
153
+ **Functions:**
154
+ - `_apply_jsonpath(current_data: Any, expression: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Applies JSONPath expressions to JSON data
155
+ - `_apply_select_cols(current_data: List[Dict], cols_str: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Selects specific columns from tabular data
156
+ - `_apply_filter_rows_eq(current_data: List[Dict], filter_spec: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Filters rows by column value equality
157
+ - `_apply_slice_rows(current_data: List[Dict], slice_spec: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Slices rows using Python slice notation
158
+ - `_apply_slice_lines(current_data: str, slice_spec: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Slices text lines
159
+ - `_apply_grep(current_data: str, pattern: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Filters lines matching regex pattern
160
+ - `_apply_head(current_data: str, n_str: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Returns first N lines
161
+ - `_apply_tail(current_data: str, n_str: str, mime_type: Optional[str], log_id: str) -> Tuple[Any, Optional[str], Optional[str]]` - Returns last N lines
162
+ - `_apply_template(current_data: Any, template_spec: str, mime_type: Optional[str], log_id: str, context: Any) -> Tuple[Any, Optional[str], Optional[str]]` - Applies Mustache templates from artifacts
163
+ - `_parse_modifier_chain(expression: str) -> Tuple[str, List[Tuple[str, str]], Optional[str]]` - Parses artifact_content expression into components
164
+
165
+ **Constants/Variables:**
166
+ - `MODIFIER_IMPLEMENTATIONS: Dict[str, Callable]` - Registry of modifier functions
167
+ - `MODIFIER_DEFINITIONS: Dict[str, Dict[str, Any]]` - Modifier metadata including accepted/produced formats
168
+
169
+ **Usage Examples:**
170
+ ```python
171
+ from solace_agent_mesh.common.utils.embeds.modifiers import _parse_modifier_chain
172
+
173
+ # Parse a complex artifact_content expression
174
+ expression = "data.csv:1 >>> select_cols:name,age >>> filter_rows_eq:age:25 >>> format:json"
175
+ artifact_spec, modifiers, output_format = _parse_modifier_chain(expression)
176
+ # artifact_spec: "data.csv:1"
177
+ # modifiers: [("select_cols", "name,age"), ("filter_rows_eq", "age:25")]
178
+ # output_format: "json"
179
+ ```
180
+
181
+ ### resolver.py
182
+ **Purpose:** Core orchestration engine that handles the complete embed resolution process including modifier chains and recursion.
183
+
184
+ **Import:** `from solace_agent_mesh.common.utils.embeds.resolver import resolve_embeds_in_string, evaluate_embed`
185
+
186
+ **Functions:**
187
+ - `resolve_embeds_in_string(text: str, context: Any, resolver_func: Callable, types_to_resolve: Set[str], log_identifier: str = "[EmbedUtil]", config: Optional[Dict[str, Any]] = None) -> Tuple[str, int, List[Tuple[int, Any]]]` - Single-pass embed resolution with buffering support
188
+ - `resolve_embeds_recursively_in_string(text: str, context: Any, resolver_func: Callable, types_to_resolve: Set[str], log_identifier: str, config: Optional[Dict], max_depth: int, current_depth: int = 0, visited_artifacts: Optional[Set[Tuple[str, int]]] = None, accumulated_size: int = 0, max_total_size: int = -1) -> str` - Recursive embed resolution with safety limits
189
+ - `evaluate_embed(embed_type: str, expression: str, format_spec: Optional[str], context: Dict[str, Any], log_identifier: str, config: Optional[Dict] = None, current_depth: int = 0, visited_artifacts: Optional[Set[Tuple[str, int]]] = None) -> Union[Tuple[str, Optional[str], int], Tuple[None, str, Any]]` - Main embed evaluation dispatcher
190
+
191
+ **Usage Examples:**
192
+ ```python
193
+ from solace_agent_mesh.common.utils.embeds.resolver import resolve_embeds_in_string, evaluate_embed
194
+
195
+ # Single-pass resolution
196
+ text = "Result: «math:2+3» and «uuid:new»"
197
+ context = {"artifact_service": service, "session_context": session_ctx}
198
+
199
+ resolved_text, processed_index, signals = await resolve_embeds_in_string(
200
+ text=text,
201
+ context=context,
202
+ resolver_func=evaluate_embed,
203
+ types_to_resolve={"math", "uuid"},
204
+ log_identifier="[MyApp]",
205
+ config={}
206
+ )
207
+
208
+ # Complex artifact content with modifiers
209
+ result, error, size = await evaluate_embed(
210
+ embed_type="artifact_content",
211
+ expression="sales.csv >>> select_cols:product,revenue >>> format:json",
212
+ format_spec=None,
213
+ context=context,
214
+ log_identifier="[Sales]"
215
+ )
216
+ ```
217
+
218
+ ### types.py
219
+
220
+ # content_hash: cbca48790a6e817c5bf49ddd8212cbbc663e920e9dd4dbece95bcf57d79c1837