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.
- solace_agent_mesh/agent/adk/adk_llm.txt +182 -42
- solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +171 -0
- solace_agent_mesh/agent/adk/callbacks.py +165 -104
- solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +0 -18
- solace_agent_mesh/agent/adk/models/models_llm.txt +104 -55
- solace_agent_mesh/agent/adk/runner.py +7 -5
- solace_agent_mesh/agent/adk/services.py +9 -1
- solace_agent_mesh/agent/adk/setup.py +11 -0
- solace_agent_mesh/agent/adk/stream_parser.py +8 -1
- solace_agent_mesh/agent/adk/tool_wrapper.py +10 -3
- solace_agent_mesh/agent/agent_llm.txt +355 -18
- solace_agent_mesh/agent/protocol/event_handlers.py +433 -296
- solace_agent_mesh/agent/protocol/protocol_llm.txt +54 -7
- solace_agent_mesh/agent/sac/app.py +1 -1
- solace_agent_mesh/agent/sac/component.py +212 -517
- solace_agent_mesh/agent/sac/sac_llm.txt +133 -63
- solace_agent_mesh/agent/testing/testing_llm.txt +25 -58
- solace_agent_mesh/agent/tools/peer_agent_tool.py +15 -11
- solace_agent_mesh/agent/tools/tools_llm.txt +234 -69
- solace_agent_mesh/agent/utils/artifact_helpers.py +35 -1
- solace_agent_mesh/agent/utils/utils_llm.txt +90 -105
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/{3d406171.7d02a73b.js → 3d406171.0b9eeed1.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/6e0db977.39a79ca9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{75384d09.ccd480c4.js → 75384d09.bf78fbdb.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/90dd9cf6.88f385ea.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f284c35a.fb68323a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/main.a75ecc0d.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/runtime~main.458efb1d.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +4 -4
- 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
- solace_agent_mesh/assets/docs/docs/documentation/migration-guides/a2a-upgrade-to-0.3.0/a2a-technical-migration-map/index.html +53 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +8 -8
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +4 -4
- solace_agent_mesh/assets/docs/lunr-index-1756992446316.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1756992446316.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/assets/docs/sitemap.xml +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/add_cmd/web_add_agent_step.py +12 -3
- solace_agent_mesh/cli/commands/add_cmd/web_add_gateway_step.py +10 -14
- solace_agent_mesh/cli/commands/init_cmd/web_init_step.py +2 -15
- solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +6 -2
- solace_agent_mesh/cli/utils.py +15 -0
- solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-DvlO62me.js → authCallback-BmF2l6vg.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-bp6u3qVZ.js → client-D881Dttc.js} +4 -4
- solace_agent_mesh/client/webui/frontend/static/assets/main-C0jZjYa8.js +699 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-CCeG324-.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +2 -2
- solace_agent_mesh/client/webui/frontend/static/index.html +3 -3
- solace_agent_mesh/common/a2a/__init__.py +213 -0
- solace_agent_mesh/common/a2a/a2a_llm.txt +182 -0
- solace_agent_mesh/common/a2a/artifact.py +328 -0
- solace_agent_mesh/common/a2a/events.py +183 -0
- solace_agent_mesh/common/a2a/message.py +307 -0
- solace_agent_mesh/common/a2a/protocol.py +513 -0
- solace_agent_mesh/common/a2a/task.py +127 -0
- solace_agent_mesh/common/a2a/translation.py +653 -0
- solace_agent_mesh/common/a2a/types.py +54 -0
- solace_agent_mesh/common/a2a_spec/a2a.json +2576 -0
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +407 -0
- solace_agent_mesh/common/a2a_spec/schemas/agent_progress_update.json +18 -0
- solace_agent_mesh/common/a2a_spec/schemas/artifact_creation_progress.json +31 -0
- solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +18 -0
- solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +235 -0
- solace_agent_mesh/common/a2a_spec/schemas/tool_invocation_start.json +26 -0
- solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +25 -0
- solace_agent_mesh/common/agent_registry.py +1 -1
- solace_agent_mesh/common/common_llm.txt +192 -70
- solace_agent_mesh/common/data_parts.py +99 -0
- solace_agent_mesh/common/middleware/middleware_llm.txt +17 -17
- solace_agent_mesh/common/sac/__init__.py +0 -0
- solace_agent_mesh/common/sac/sac_llm.txt +71 -0
- solace_agent_mesh/common/sac/sam_component_base.py +252 -0
- solace_agent_mesh/common/services/providers/providers_llm.txt +51 -84
- solace_agent_mesh/common/services/services_llm.txt +206 -26
- solace_agent_mesh/common/utils/artifact_utils.py +29 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +176 -80
- solace_agent_mesh/common/utils/utils_llm.txt +323 -42
- solace_agent_mesh/config_portal/backend/common.py +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/{_index-MqsrTd6g.js → _index-Bym6YkMd.js} +74 -24
- solace_agent_mesh/config_portal/frontend/static/client/assets/{components-B7lKcHVY.js → components-Rk0n-9cK.js} +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/{entry.client-CEumGClk.js → entry.client-mvZjNKiz.js} +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/{index-DSo1AH_7.js → index-DzNKzXrc.js} +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-d845808d.js +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{root-C4XmHinv.js → root-BWvk5-gF.js} +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/index.html +3 -3
- solace_agent_mesh/core_a2a/core_a2a_llm.txt +10 -8
- solace_agent_mesh/core_a2a/service.py +20 -44
- solace_agent_mesh/gateway/base/app.py +27 -1
- solace_agent_mesh/gateway/base/base_llm.txt +177 -72
- solace_agent_mesh/gateway/base/component.py +294 -523
- solace_agent_mesh/gateway/gateway_llm.txt +299 -58
- solace_agent_mesh/gateway/http_sse/component.py +156 -183
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +29 -29
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +272 -36
- solace_agent_mesh/gateway/http_sse/main.py +8 -10
- solace_agent_mesh/gateway/http_sse/routers/agents.py +1 -1
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +18 -4
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +231 -5
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +12 -7
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +116 -169
- solace_agent_mesh/gateway/http_sse/services/agent_service.py +1 -1
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +89 -135
- solace_agent_mesh/gateway/http_sse/services/task_service.py +2 -5
- solace_agent_mesh/solace_agent_mesh_llm.txt +362 -0
- solace_agent_mesh/templates/gateway_component_template.py +149 -98
- {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/METADATA +5 -4
- {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/RECORD +144 -127
- solace_agent_mesh/assets/docs/assets/js/f284c35a.731836ad.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/main.d79f063b.js +0 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.6415ad00.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1756146501924.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1756146501924.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-BCpII1-0.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-BucUdn9m.js +0 -673
- solace_agent_mesh/common/a2a_protocol.py +0 -564
- solace_agent_mesh/common/client/__init__.py +0 -4
- solace_agent_mesh/common/client/card_resolver.py +0 -21
- solace_agent_mesh/common/client/client.py +0 -85
- solace_agent_mesh/common/client/client_llm.txt +0 -133
- solace_agent_mesh/common/server/__init__.py +0 -4
- solace_agent_mesh/common/server/server.py +0 -122
- solace_agent_mesh/common/server/server_llm.txt +0 -169
- solace_agent_mesh/common/server/task_manager.py +0 -291
- solace_agent_mesh/common/server/utils.py +0 -28
- solace_agent_mesh/common/types.py +0 -411
- solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-28271392.js +0 -1
- /solace_agent_mesh/assets/docs/assets/js/{main.d79f063b.js.LICENSE.txt → main.a75ecc0d.js.LICENSE.txt} +0 -0
- {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.0.7.dist-info → solace_agent_mesh-1.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,67 +1,348 @@
|
|
|
1
|
-
Here is the comprehensive developer guide for the `utils` directory.
|
|
2
|
-
|
|
3
1
|
## Quick Summary
|
|
4
|
-
The `utils` directory provides
|
|
5
|
-
|
|
6
|
-
The architecture consists of standalone utility files for specific tasks and a more complex, self-contained subdirectory for advanced functionality. Direct files provide services like a thread-safe in-memory cache (`in_memory_cache.py`), JWT-based authentication for push notifications (`push_notification_auth.py`), custom logging formatters (`log_formatters.py`), and a critical patch for asyncio on macOS (`asyncio_macos_fix.py`).
|
|
7
|
-
|
|
8
|
-
The `embeds` subdirectory provides a powerful system for finding, parsing, and resolving dynamic expressions embedded within strings. These utilities are designed to work together. For instance, a request handler might use `mime_helpers` to validate content type, use the `embeds` system to process the content, and then store the result in the `InMemoryCache` to optimize future requests.
|
|
2
|
+
The `utils` directory provides essential utility functions and tools for the Solace Agent Mesh system. It contains both direct utility files for common operations (MIME type handling, caching, message validation, authentication) and a sophisticated `embeds` subdirectory that implements a dynamic expression evaluation system. The utilities work together to provide platform compatibility, security features, data processing capabilities, and dynamic content generation for agent workflows.
|
|
9
3
|
|
|
10
4
|
## Files and Subdirectories Overview
|
|
11
|
-
- **Direct files:**
|
|
12
|
-
- `__init__.py`: Exposes key utility functions from the package for convenient access.
|
|
13
|
-
- `asyncio_macos_fix.py`: Automatically applies a patch to fix asyncio subprocess issues on macOS.
|
|
14
|
-
- `in_memory_cache.py`: Implements a thread-safe, singleton in-memory cache with TTL support.
|
|
15
|
-
- `log_formatters.py`: Provides custom logging formatters, such as a Datadog-compatible JSON formatter.
|
|
16
|
-
- `mime_helpers.py`: Contains helper functions to classify and identify text-based MIME types.
|
|
17
|
-
- `push_notification_auth.py`: Implements JWT-based authentication for sending and receiving push notifications.
|
|
18
5
|
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
### Direct Files:
|
|
7
|
+
- **`__init__.py`** - Main entry point exporting commonly used utilities like MIME type checking
|
|
8
|
+
- **`artifact_utils.py`** - Utilities for working with ADK artifacts, including version resolution
|
|
9
|
+
- **`asyncio_macos_fix.py`** - Automatic fix for asyncio subprocess issues on macOS
|
|
10
|
+
- **`in_memory_cache.py`** - Thread-safe singleton cache with TTL support
|
|
11
|
+
- **`initializer.py`** - Enterprise feature initialization and configuration loading
|
|
12
|
+
- **`log_formatters.py`** - Custom logging formatters for platforms like Datadog
|
|
13
|
+
- **`message_utils.py`** - Message size calculation and validation utilities
|
|
14
|
+
- **`mime_helpers.py`** - MIME type classification and file extension utilities
|
|
15
|
+
- **`push_notification_auth.py`** - JWT-based authentication for push notifications
|
|
16
|
+
|
|
17
|
+
### Subdirectories:
|
|
18
|
+
- **`embeds/`** - Dynamic expression evaluation system using `«...»` syntax for mathematical calculations, datetime formatting, UUID generation, and artifact content processing
|
|
21
19
|
|
|
22
20
|
## Developer API Reference
|
|
23
21
|
|
|
24
22
|
### Direct Files
|
|
25
23
|
|
|
26
24
|
#### __init__.py
|
|
27
|
-
**Purpose:**
|
|
28
|
-
**Import:** `from
|
|
25
|
+
**Purpose:** Main entry point for the utils package, exporting the most commonly used utility functions
|
|
26
|
+
**Import:** `from solace_agent_mesh.common.utils import is_text_based_mime_type`
|
|
29
27
|
|
|
30
|
-
**
|
|
31
|
-
|
|
28
|
+
**Functions:**
|
|
29
|
+
- `is_text_based_mime_type(mime_type: Optional[str]) -> bool` - Checks if a MIME type represents text-based content
|
|
30
|
+
|
|
31
|
+
#### artifact_utils.py
|
|
32
|
+
**Purpose:** Common utility functions for working with ADK artifacts
|
|
33
|
+
**Import:** `from solace_agent_mesh.common.utils.artifact_utils import get_latest_artifact_version`
|
|
34
|
+
|
|
35
|
+
**Functions:**
|
|
36
|
+
- `get_latest_artifact_version(artifact_service: BaseArtifactService, app_name: str, user_id: str, session_id: str, filename: str) -> Optional[int]` - Resolves the latest version number for a given artifact
|
|
32
37
|
|
|
33
38
|
#### asyncio_macos_fix.py
|
|
34
|
-
**Purpose:**
|
|
35
|
-
**Import:** `from
|
|
39
|
+
**Purpose:** Automatic fix for asyncio subprocess creation issues on macOS (imported for side effects)
|
|
40
|
+
**Import:** `from solace_agent_mesh.common.utils import asyncio_macos_fix`
|
|
36
41
|
|
|
37
|
-
**
|
|
38
|
-
|
|
42
|
+
**Functions:**
|
|
43
|
+
- `apply_macos_asyncio_fix() -> bool` - Applies the asyncio fix for macOS subprocess support
|
|
44
|
+
- `ensure_asyncio_compatibility() -> bool` - Ensures asyncio compatibility for subprocess creation
|
|
39
45
|
|
|
40
46
|
#### in_memory_cache.py
|
|
41
|
-
**Purpose:**
|
|
42
|
-
**Import:** `from
|
|
47
|
+
**Purpose:** Thread-safe singleton in-memory cache with TTL support
|
|
48
|
+
**Import:** `from solace_agent_mesh.common.utils.in_memory_cache import InMemoryCache`
|
|
49
|
+
|
|
50
|
+
**Classes:**
|
|
51
|
+
- **`InMemoryCache`** - Singleton cache class
|
|
52
|
+
- `set(key: str, value: Any, ttl: Optional[int] = None) -> None` - Store value with optional TTL
|
|
53
|
+
- `get(key: str, default: Any = None) -> Any` - Retrieve value or default
|
|
54
|
+
- `delete(key: str) -> bool` - Delete specific key
|
|
55
|
+
- `clear() -> bool` - Clear all cached data
|
|
43
56
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
#### initializer.py
|
|
58
|
+
**Purpose:** Handles initialization of enterprise features if available
|
|
59
|
+
**Import:** `from solace_agent_mesh.common.utils.initializer import initialize`
|
|
60
|
+
|
|
61
|
+
**Functions:**
|
|
62
|
+
- `initialize() -> None` - Initializes enterprise features using SAM_AUTHORIZATION_CONFIG environment variable
|
|
50
63
|
|
|
51
64
|
#### log_formatters.py
|
|
52
|
-
**Purpose:**
|
|
53
|
-
**Import:** `from
|
|
65
|
+
**Purpose:** Custom logging formatters for structured output
|
|
66
|
+
**Import:** `from solace_agent_mesh.common.utils.log_formatters import DatadogJsonFormatter`
|
|
67
|
+
|
|
68
|
+
**Classes:**
|
|
69
|
+
- **`DatadogJsonFormatter(logging.Formatter)`** - JSON formatter with Datadog-compatible attributes including trace IDs
|
|
70
|
+
|
|
71
|
+
#### message_utils.py
|
|
72
|
+
**Purpose:** Message size calculation and validation utilities
|
|
73
|
+
**Import:** `from solace_agent_mesh.common.utils.message_utils import calculate_message_size, validate_message_size`
|
|
74
|
+
|
|
75
|
+
**Functions:**
|
|
76
|
+
- `calculate_message_size(payload: Dict[str, Any]) -> int` - Calculate exact message size using JSON + UTF-8 encoding
|
|
77
|
+
- `validate_message_size(payload: Dict[str, Any], max_size_bytes: int, component_identifier: str = "Unknown") -> Tuple[bool, int]` - Validate message doesn't exceed size limits
|
|
54
78
|
|
|
55
|
-
**
|
|
56
|
-
|
|
79
|
+
**Constants:**
|
|
80
|
+
- `MAX_UTF8_BYTES_PER_CHARACTER: int` - Maximum UTF-8 bytes per character (4)
|
|
57
81
|
|
|
58
82
|
#### mime_helpers.py
|
|
59
|
-
**Purpose:**
|
|
60
|
-
**Import:** `from
|
|
83
|
+
**Purpose:** MIME type classification and file extension utilities
|
|
84
|
+
**Import:** `from solace_agent_mesh.common.utils.mime_helpers import is_text_based_mime_type, get_extension_for_mime_type, is_text_based_file`
|
|
61
85
|
|
|
62
|
-
**
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
**Functions:**
|
|
87
|
+
- `is_text_based_mime_type(mime_type: Optional[str]) -> bool` - Check if MIME type is text-based
|
|
88
|
+
- `is_text_based_file(mime_type: Optional[str], content_bytes: Optional[bytes] = None) -> bool` - Determine if file is text-based using MIME type and content analysis
|
|
89
|
+
- `get_extension_for_mime_type(mime_type: Optional[str], default_extension: str = ".dat") -> str` - Get file extension for MIME type
|
|
90
|
+
|
|
91
|
+
**Constants:**
|
|
92
|
+
- `TEXT_CONTAINER_MIME_TYPES: Set[str]` - Set of non-text/* MIME types that contain text
|
|
65
93
|
|
|
66
94
|
#### push_notification_auth.py
|
|
67
|
-
**Purpose:**
|
|
95
|
+
**Purpose:** JWT-based authentication for push notifications with request integrity verification
|
|
96
|
+
**Import:** `from solace_agent_mesh.common.utils.push_notification_auth import PushNotificationSenderAuth, PushNotificationReceiverAuth`
|
|
97
|
+
|
|
98
|
+
**Classes:**
|
|
99
|
+
- **`PushNotificationSenderAuth`** - Handles sending authenticated notifications
|
|
100
|
+
- `generate_jwk() -> None` - Generate RSA key pair for signing
|
|
101
|
+
- `handle_jwks_endpoint(request: Request) -> JSONResponse` - Serve public keys endpoint
|
|
102
|
+
- `send_push_notification(url: str, data: dict[str, Any]) -> None` - Send authenticated notification
|
|
103
|
+
- `verify_push_notification_url(url: str) -> bool` - Verify notification URL
|
|
104
|
+
- **`PushNotificationReceiverAuth`** - Handles receiving and verifying notifications
|
|
105
|
+
- `load_jwks(jwks_url: str) -> None` - Load public keys from JWKS endpoint
|
|
106
|
+
- `verify_push_notification(request: Request) -> bool` - Verify notification authenticity
|
|
107
|
+
|
|
108
|
+
### Subdirectory APIs
|
|
109
|
+
|
|
110
|
+
#### embeds/
|
|
111
|
+
**Purpose:** Comprehensive dynamic expression evaluation system using `«...»` syntax for mathematical calculations, datetime formatting, UUID generation, and artifact content processing with transformation pipelines
|
|
112
|
+
**Key Exports:** Main resolution functions, evaluator registry, modifier system, and type constants
|
|
113
|
+
**Import Examples:**
|
|
114
|
+
```python
|
|
115
|
+
from solace_agent_mesh.common.utils.embeds import resolve_embeds_recursively_in_string, evaluate_embed, EMBED_REGEX
|
|
116
|
+
from solace_agent_mesh.common.utils.embeds.constants import EARLY_EMBED_TYPES, LATE_EMBED_TYPES
|
|
117
|
+
from solace_agent_mesh.common.utils.embeds.types import DataFormat
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Complete Usage Guide
|
|
121
|
+
|
|
122
|
+
### 1. Basic Utility Operations
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
# Import commonly used utilities
|
|
126
|
+
from solace_agent_mesh.common.utils import is_text_based_mime_type
|
|
127
|
+
from solace_agent_mesh.common.utils.in_memory_cache import InMemoryCache
|
|
128
|
+
from solace_agent_mesh.common.utils.message_utils import validate_message_size, calculate_message_size
|
|
129
|
+
from solace_agent_mesh.common.utils.mime_helpers import get_extension_for_mime_type, is_text_based_file
|
|
130
|
+
|
|
131
|
+
# MIME type checking
|
|
132
|
+
if is_text_based_mime_type("application/json"):
|
|
133
|
+
print("JSON is text-based")
|
|
134
|
+
|
|
135
|
+
# File analysis with content
|
|
136
|
+
with open("data.bin", "rb") as f:
|
|
137
|
+
content = f.read()
|
|
138
|
+
if is_text_based_file("application/octet-stream", content):
|
|
139
|
+
print("File contains text despite binary MIME type")
|
|
140
|
+
|
|
141
|
+
# Singleton cache usage
|
|
142
|
+
cache = InMemoryCache()
|
|
143
|
+
cache.set("user_session", {"user_id": "123", "role": "admin"}, ttl=3600) # 1 hour TTL
|
|
144
|
+
session_data = cache.get("user_session", {})
|
|
145
|
+
|
|
146
|
+
# Message size validation
|
|
147
|
+
payload = {"message": "Hello world", "data": [1, 2, 3], "metadata": {"timestamp": "2024-01-15"}}
|
|
148
|
+
is_valid, size = validate_message_size(payload, max_size_bytes=1024, component_identifier="MessageProcessor")
|
|
149
|
+
if not is_valid:
|
|
150
|
+
print(f"Message too large: {size} bytes exceeds 1024 byte limit")
|
|
151
|
+
|
|
152
|
+
# Get appropriate file extension
|
|
153
|
+
extension = get_extension_for_mime_type("image/png") # Returns ".png"
|
|
154
|
+
filename = f"image_{uuid.uuid4()}{extension}"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 2. Platform Compatibility and System Initialization
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
# Early in application startup - import for side effects
|
|
161
|
+
from solace_agent_mesh.common.utils import asyncio_macos_fix # Auto-applies macOS fix
|
|
162
|
+
from solace_agent_mesh.common.utils.initializer import initialize
|
|
163
|
+
|
|
164
|
+
# Initialize enterprise features if available
|
|
165
|
+
try:
|
|
166
|
+
initialize()
|
|
167
|
+
print("Enterprise features initialized")
|
|
168
|
+
except Exception as e:
|
|
169
|
+
print(f"Running in community mode: {e}")
|
|
170
|
+
|
|
171
|
+
# Now asyncio subprocess creation works reliably on macOS
|
|
172
|
+
import asyncio
|
|
173
|
+
|
|
174
|
+
async def run_command(cmd: str):
|
|
175
|
+
process = await asyncio.create_subprocess_exec(
|
|
176
|
+
*cmd.split(),
|
|
177
|
+
stdout=asyncio.subprocess.PIPE,
|
|
178
|
+
stderr=asyncio.subprocess.PIPE
|
|
179
|
+
)
|
|
180
|
+
stdout, stderr = await process.communicate()
|
|
181
|
+
return stdout.decode(), stderr.decode(), process.returncode
|
|
182
|
+
|
|
183
|
+
# This will work on macOS without NotImplementedError
|
|
184
|
+
result = await run_command("echo Hello World")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 3. Structured Logging Setup
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
import logging
|
|
191
|
+
import os
|
|
192
|
+
from solace_agent_mesh.common.utils.log_formatters import DatadogJsonFormatter
|
|
193
|
+
|
|
194
|
+
# Configure structured JSON logging
|
|
195
|
+
logger = logging.getLogger("my_application")
|
|
196
|
+
handler = logging.StreamHandler()
|
|
197
|
+
handler.setFormatter(DatadogJsonFormatter())
|
|
198
|
+
logger.addHandler(handler)
|
|
199
|
+
logger.setLevel(logging.INFO)
|
|
200
|
+
|
|
201
|
+
# Set service name for Datadog
|
|
202
|
+
os.environ["SERVICE_NAME"] = "my_agent_service"
|
|
203
|
+
|
|
204
|
+
# Log with structured data - automatically includes trace IDs if available
|
|
205
|
+
logger.info("User action completed", extra={
|
|
206
|
+
"user_id": "user123",
|
|
207
|
+
"action": "file_upload",
|
|
208
|
+
"file_size": 1024,
|
|
209
|
+
"dd.trace_id": "abc123" # Will be included in JSON output
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
# Output will be JSON with timestamp, level, service, code location, etc.
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 4. Secure Push Notification System
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from solace_agent_mesh.common.utils.push_notification_auth import (
|
|
219
|
+
PushNotificationSenderAuth,
|
|
220
|
+
PushNotificationReceiverAuth
|
|
221
|
+
)
|
|
222
|
+
from starlette.applications import Starlette
|
|
223
|
+
from starlette.requests import Request
|
|
224
|
+
from starlette.responses import Response, JSONResponse
|
|
225
|
+
|
|
226
|
+
# Sender setup and usage
|
|
227
|
+
sender_auth = PushNotificationSenderAuth()
|
|
228
|
+
sender_auth.generate_jwk() # Generate RSA key pair
|
|
229
|
+
|
|
230
|
+
async def notify_clients(event_data: dict):
|
|
231
|
+
client_urls = ["https://client1.example.com/webhook", "https://client2.example.com/webhook"]
|
|
232
|
+
|
|
233
|
+
for url in client_urls:
|
|
234
|
+
# Verify URL accepts notifications
|
|
235
|
+
if await sender_auth.verify_push_notification_url(url):
|
|
236
|
+
# Send authenticated notification
|
|
237
|
+
await sender_auth.send_push_notification(url, {
|
|
238
|
+
"event": "data_updated",
|
|
239
|
+
"timestamp": "2024-01-15T10:30:00Z",
|
|
240
|
+
"data": event_data
|
|
241
|
+
})
|
|
242
|
+
else:
|
|
243
|
+
print(f"Failed to verify URL: {url}")
|
|
244
|
+
|
|
245
|
+
# Receiver setup
|
|
246
|
+
app = Starlette()
|
|
247
|
+
receiver_auth = PushNotificationReceiverAuth()
|
|
248
|
+
|
|
249
|
+
# Load sender's public keys
|
|
250
|
+
await receiver_auth.load_jwks("https://sender.example.com/.well-known/jwks.json")
|
|
251
|
+
|
|
252
|
+
@app.route("/webhook", methods=["POST"])
|
|
253
|
+
async def webhook_handler(request: Request):
|
|
254
|
+
try:
|
|
255
|
+
# Verify JWT signature and request integrity
|
|
256
|
+
if await receiver_auth.verify_push_notification(request):
|
|
257
|
+
data = await request.json()
|
|
258
|
+
# Process authenticated notification
|
|
259
|
+
print(f"Received verified notification: {data}")
|
|
260
|
+
return Response("OK")
|
|
261
|
+
else:
|
|
262
|
+
return Response("Unauthorized", status_code=401)
|
|
263
|
+
except Exception as e:
|
|
264
|
+
print(f"Verification failed: {e}")
|
|
265
|
+
return Response("Bad Request", status_code=400)
|
|
266
|
+
|
|
267
|
+
# JWKS endpoint for sender
|
|
268
|
+
@app.route("/.well-known/jwks.json")
|
|
269
|
+
async def jwks_endpoint(request: Request):
|
|
270
|
+
return sender_auth.handle_jwks_endpoint(request)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 5. Advanced Embed Processing
|
|
274
|
+
|
|
275
|
+
```python
|
|
276
|
+
from solace_agent_mesh.common.utils.embeds import (
|
|
277
|
+
resolve_embeds_recursively_in_string,
|
|
278
|
+
evaluate_embed,
|
|
279
|
+
EARLY_EMBED_TYPES,
|
|
280
|
+
LATE_EMBED_TYPES
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
# Set up context for embed resolution
|
|
284
|
+
context = {
|
|
285
|
+
"artifact_service": my_artifact_service,
|
|
286
|
+
"session_context": {
|
|
287
|
+
"app_name": "sales_analyzer",
|
|
288
|
+
"user_id": "user123",
|
|
289
|
+
"session_id": "sess456"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
# Simple embed resolution for dynamic content
|
|
294
|
+
template = """
|
|
295
|
+
Sales Report Generated: «datetime:%Y-%m-%d %H:%M:%S»
|
|
296
|
+
Total Revenue: $«math:«artifact_content:sales.csv >>> jsonpath:$.total_revenue» * 1.08 | .2f»
|
|
297
|
+
Report ID: «uuid:new»
|
|
298
|
+
Tax Rate Applied: 8%
|
|
299
|
+
"""
|
|
300
|
+
|
|
301
|
+
# Resolve embeds recursively with safety limits
|
|
302
|
+
resolved_content = await resolve_embeds_recursively_in_string(
|
|
303
|
+
text=template,
|
|
304
|
+
context=context,
|
|
305
|
+
resolver_func=evaluate_embed,
|
|
306
|
+
types_to_resolve=EARLY_EMBED_TYPES | LATE_EMBED_TYPES,
|
|
307
|
+
log_identifier="[SalesReport]",
|
|
308
|
+
config={"max_artifact_size": 1024*1024}, # 1MB limit
|
|
309
|
+
max_depth=5
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
# Complex data transformation pipeline
|
|
313
|
+
data_analysis = """
|
|
314
|
+
Product Analysis:
|
|
315
|
+
«artifact_content:products.csv:latest >>> select_cols:name,category,price,sales >>> filter_rows_eq:category:electronics >>> slice_rows:0:10 >>> format:json_pretty»
|
|
316
|
+
|
|
317
|
+
Summary Statistics:
|
|
318
|
+
«artifact_content:summary.txt >>> head:5»
|
|
319
|
+
|
|
320
|
+
Top Performers:
|
|
321
|
+
«artifact_content:sales.json >>> jsonpath:$.top_products[*].name >>> format:text»
|
|
322
|
+
"""
|
|
323
|
+
|
|
324
|
+
analysis_result = await resolve_embeds_recursively_in_string(
|
|
325
|
+
text=data_analysis,
|
|
326
|
+
context=context,
|
|
327
|
+
resolver_func=evaluate_embed,
|
|
328
|
+
types_to_resolve=LATE_EMBED_TYPES,
|
|
329
|
+
log_identifier="[Analysis]",
|
|
330
|
+
config={},
|
|
331
|
+
max_depth=3
|
|
332
|
+
)
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### 6. Integrated Workflow Example
|
|
336
|
+
|
|
337
|
+
```python
|
|
338
|
+
from solace_agent_mesh.common.utils import is_text_based_mime_type
|
|
339
|
+
from solace_agent_mesh.common.utils.in_memory_cache import InMemoryCache
|
|
340
|
+
from solace_agent_mesh.common.utils.message_utils import validate_message_size
|
|
341
|
+
from solace_agent_mesh.common.utils.embeds import resolve_embeds_recursively_in_string, evaluate_embed
|
|
342
|
+
from solace_agent_mesh.common.utils.push_notification_auth import PushNotificationSenderAuth
|
|
343
|
+
import hashlib
|
|
344
|
+
|
|
345
|
+
async def process_and_notify_report(user_id: str, template: str, context: dict, notification_urls: list):
|
|
346
|
+
"""Complete workflow integrating
|
|
347
|
+
|
|
348
|
+
# content_hash: 0f48341a035bc4fbdb720885186fe04075f8fbca7ddeee6a151b00b4c667c47a
|
|
@@ -45,7 +45,7 @@ AGENT_DEFAULTS = {
|
|
|
45
45
|
"agent_card_skills_str": "[]",
|
|
46
46
|
"agent_card_publishing_interval": 10,
|
|
47
47
|
"agent_discovery_enabled": True,
|
|
48
|
-
"inter_agent_communication_allow_list": [
|
|
48
|
+
"inter_agent_communication_allow_list": [],
|
|
49
49
|
"inter_agent_communication_deny_list": [],
|
|
50
50
|
"inter_agent_communication_timeout": DEFAULT_COMMUNICATION_TIMEOUT,
|
|
51
51
|
"namespace": "${NAMESPACE}",
|