solace-agent-mesh 1.4.11__py3-none-any.whl → 1.5.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 +3 -4
- solace_agent_mesh/agent/adk/adk_llm_detail.txt +566 -0
- solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
- solace_agent_mesh/agent/adk/artifacts/s3_artifact_service.py +1 -0
- solace_agent_mesh/agent/adk/callbacks.py +51 -2
- solace_agent_mesh/agent/adk/models/lite_llm.py +1 -0
- solace_agent_mesh/agent/adk/models/models_llm.txt +1 -2
- solace_agent_mesh/agent/adk/services.py +30 -15
- solace_agent_mesh/agent/adk/setup.py +4 -0
- solace_agent_mesh/agent/agent_llm.txt +1 -1
- solace_agent_mesh/agent/agent_llm_detail.txt +1702 -0
- solace_agent_mesh/agent/protocol/event_handlers.py +2 -13
- solace_agent_mesh/agent/protocol/protocol_llm.txt +15 -2
- solace_agent_mesh/agent/protocol/protocol_llm_detail.txt +92 -0
- solace_agent_mesh/agent/sac/component.py +51 -21
- solace_agent_mesh/agent/sac/sac_llm.txt +15 -1
- solace_agent_mesh/agent/sac/sac_llm_detail.txt +200 -0
- solace_agent_mesh/agent/sac/task_execution_context.py +73 -0
- solace_agent_mesh/agent/testing/testing_llm_detail.txt +68 -0
- solace_agent_mesh/agent/tools/tools_llm.txt +148 -154
- solace_agent_mesh/agent/tools/tools_llm_detail.txt +274 -0
- solace_agent_mesh/agent/utils/utils_llm.txt +1 -1
- solace_agent_mesh/agent/utils/utils_llm_detail.txt +149 -0
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/0e682baa.d54b8668.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/483cef9a.bf9398af.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{main.dc155742.js → main.0c149855.js} +2 -2
- solace_agent_mesh/assets/docs/assets/js/{runtime~main.0d2ff2b6.js → runtime~main.c66557e4.js} +1 -1
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/rbac-setup-guilde/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +8 -4
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/litellm_models/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +7 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +3 -3
- solace_agent_mesh/assets/docs/lunr-index-1760032255022.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1760032255022.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-j1LW-wlq.js → authCallback-DwrxZE0E.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-B9p_nFNA.js → client-DarGQzyw.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-CZbpmwfA.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-C__uuUkB.js +339 -0
- solace_agent_mesh/client/webui/frontend/static/assets/{vendor-CS5YMf8a.js → vendor-BKIeiHj_.js} +80 -70
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
- solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
- solace_agent_mesh/common/a2a/a2a_llm.txt +1 -1
- solace_agent_mesh/common/a2a/a2a_llm_detail.txt +193 -0
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +1 -1
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm_detail.txt +736 -0
- solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +23 -0
- solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +93 -15
- solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +23 -0
- solace_agent_mesh/common/common_llm.txt +24 -39
- solace_agent_mesh/common/common_llm_detail.txt +2562 -0
- solace_agent_mesh/common/data_parts.py +9 -1
- solace_agent_mesh/common/middleware/middleware_llm_detail.txt +185 -0
- solace_agent_mesh/common/sac/sac_llm.txt +1 -1
- solace_agent_mesh/common/sac/sac_llm_detail.txt +82 -0
- solace_agent_mesh/common/sam_events/sam_events_llm.txt +104 -0
- solace_agent_mesh/common/sam_events/sam_events_llm_detail.txt +115 -0
- solace_agent_mesh/common/services/identity_service.py +7 -4
- solace_agent_mesh/common/services/providers/local_file_identity_service.py +4 -2
- solace_agent_mesh/common/services/services_llm.txt +57 -6
- solace_agent_mesh/common/services/services_llm_detail.txt +459 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
- solace_agent_mesh/common/utils/utils_llm.txt +75 -87
- solace_agent_mesh/common/utils/utils_llm_detail.txt +572 -0
- solace_agent_mesh/core_a2a/core_a2a_llm_detail.txt +101 -0
- solace_agent_mesh/gateway/base/app.py +1 -1
- solace_agent_mesh/gateway/base/base_llm.txt +1 -1
- solace_agent_mesh/gateway/base/base_llm_detail.txt +235 -0
- solace_agent_mesh/gateway/base/component.py +1 -1
- solace_agent_mesh/gateway/gateway_llm.txt +242 -235
- solace_agent_mesh/gateway/gateway_llm_detail.txt +3885 -0
- solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +295 -0
- solace_agent_mesh/gateway/http_sse/alembic/env.py +10 -1
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251006_98882922fa59_add_tasks_events_feedback_chat_tasks.py +190 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +155 -0
- solace_agent_mesh/gateway/http_sse/alembic.ini +1 -1
- solace_agent_mesh/gateway/http_sse/app.py +148 -2
- solace_agent_mesh/gateway/http_sse/component.py +368 -60
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +46 -6
- solace_agent_mesh/gateway/http_sse/components/task_logger_forwarder.py +108 -0
- solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +1 -1
- solace_agent_mesh/gateway/http_sse/dependencies.py +116 -26
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +172 -172
- solace_agent_mesh/gateway/http_sse/http_sse_llm_detail.txt +3278 -0
- solace_agent_mesh/gateway/http_sse/main.py +146 -41
- solace_agent_mesh/gateway/http_sse/repository/__init__.py +3 -12
- solace_agent_mesh/gateway/http_sse/repository/chat_task_repository.py +103 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +5 -3
- solace_agent_mesh/gateway/http_sse/repository/entities/chat_task.py +75 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +263 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/feedback.py +20 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +0 -16
- solace_agent_mesh/gateway/http_sse/repository/entities/task.py +25 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/task_event.py +21 -0
- solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +81 -0
- solace_agent_mesh/gateway/http_sse/repository/interfaces.py +73 -18
- solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -5
- solace_agent_mesh/gateway/http_sse/repository/models/chat_task_model.py +31 -0
- solace_agent_mesh/gateway/http_sse/repository/models/feedback_model.py +21 -0
- solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +266 -0
- solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +3 -3
- solace_agent_mesh/gateway/http_sse/repository/models/task_event_model.py +25 -0
- solace_agent_mesh/gateway/http_sse/repository/models/task_model.py +32 -0
- solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +340 -0
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +4 -53
- solace_agent_mesh/gateway/http_sse/repository/task_repository.py +173 -0
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +1 -1
- solace_agent_mesh/gateway/http_sse/routers/config.py +26 -4
- solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +346 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +3 -3
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +83 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +2 -10
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/task_requests.py +58 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +5 -3
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +107 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +1 -15
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/task_responses.py +30 -0
- solace_agent_mesh/gateway/http_sse/routers/feedback.py +37 -0
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +255 -204
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +220 -40
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +168 -42
- solace_agent_mesh/gateway/http_sse/services/data_retention_service.py +272 -0
- solace_agent_mesh/gateway/http_sse/services/feedback_service.py +241 -0
- solace_agent_mesh/gateway/http_sse/services/people_service.py +0 -80
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +177 -13
- solace_agent_mesh/gateway/http_sse/services/session_service.py +151 -84
- solace_agent_mesh/gateway/http_sse/services/task_logger_service.py +317 -0
- solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +25 -14
- solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +285 -0
- solace_agent_mesh/gateway/http_sse/shared/types.py +7 -0
- solace_agent_mesh/gateway/http_sse/utils/__init__.py +1 -0
- solace_agent_mesh/gateway/http_sse/utils/stim_utils.py +32 -0
- solace_agent_mesh/gateway/http_sse/utils/utils_llm.txt +47 -0
- solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
- solace_agent_mesh/solace_agent_mesh_llm_detail.txt +8599 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/METADATA +1 -1
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/RECORD +179 -131
- solace_agent_mesh/agent/adk/invocation_monitor.py +0 -295
- solace_agent_mesh/assets/docs/assets/js/0e682baa.d054e1d8.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/483cef9a.4736f2d8.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1759514789087.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1759514789087.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-ChRwcV89.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-DnnE01OM.js +0 -339
- solace_agent_mesh/gateway/http_sse/repository/entities/message.py +0 -41
- solace_agent_mesh/gateway/http_sse/repository/message_repository.py +0 -84
- solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +0 -45
- /solace_agent_mesh/assets/docs/assets/js/{main.dc155742.js.LICENSE.txt → main.0c149855.js.LICENSE.txt} +0 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,125 +1,167 @@
|
|
|
1
|
-
# DEVELOPER GUIDE
|
|
1
|
+
# DEVELOPER GUIDE: http_sse
|
|
2
2
|
|
|
3
3
|
## Quick Summary
|
|
4
|
-
The `http_sse` directory implements a complete HTTP/SSE (Server-Sent Events) gateway for the A2A (Agent-to-Agent) system.
|
|
4
|
+
The `http_sse` directory implements a complete HTTP/SSE (Server-Sent Events) gateway for the A2A (Agent-to-Agent) system. It serves as a bridge between web-based user interfaces and the backend A2A messaging fabric, providing real-time communication capabilities through HTTP REST APIs and Server-Sent Events streaming.
|
|
5
5
|
|
|
6
|
-
The architecture
|
|
6
|
+
The architecture centers around the `WebUIBackendComponent`, a custom Solace AI Connector (SAC) component that hosts an embedded FastAPI web server. This component manages shared resources including the `SSEManager` for real-time updates, `SessionManager` for user sessions, and `AgentRegistry` for agent discovery. The system provides comprehensive functionality including session management, task logging, data retention, feedback collection, and A2A message visualization.
|
|
7
7
|
|
|
8
|
-
Subdirectories organize the
|
|
9
|
-
- `routers/` defines the REST API endpoints (e.g., `/tasks`, `/agents`).
|
|
10
|
-
- `services/` contains the business logic that the API endpoints call.
|
|
11
|
-
- `dependencies.py` uses FastAPI's dependency injection system to provide the routers and services with safe access to the shared resources managed by the main component.
|
|
12
|
-
- `components/` contains specialized SAC components, for example, to forward A2A messages for real-time visualization.
|
|
13
|
-
|
|
14
|
-
This design creates a clean separation of concerns, where the web layer (FastAPI) is decoupled from the core messaging and state management layer (SAC Component).
|
|
8
|
+
Subdirectories organize functionality by layer: `routers/` defines REST API endpoints, `services/` contains business logic, `repository/` handles data persistence, `components/` provides specialized SAC components, and `shared/` contains common utilities. The `dependencies.py` file uses FastAPI's dependency injection to provide clean separation between the web layer and core messaging components.
|
|
15
9
|
|
|
16
10
|
## Files and Subdirectories Overview
|
|
17
11
|
- **Direct files:**
|
|
18
|
-
- `__init__.py`: Standard Python package initializer
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
12
|
+
- `__init__.py`: Standard Python package initializer
|
|
13
|
+
- `alembic.ini`: Alembic database migration configuration
|
|
14
|
+
- `app.py`: Main SAC `WebUIBackendApp` class defining configuration schema and component creation
|
|
15
|
+
- `component.py`: Core SAC component hosting FastAPI server and managing shared resources
|
|
16
|
+
- `dependencies.py`: FastAPI dependency injectors for accessing shared resources
|
|
17
|
+
- `main.py`: FastAPI application instance with middleware, routing, and exception handling
|
|
18
|
+
- `session_manager.py`: Web user session management and A2A identity mapping
|
|
19
|
+
- `sse_manager.py`: Server-Sent Event connection management for real-time streaming
|
|
20
|
+
- `sse_event_buffer.py`: Thread-safe buffer for early SSE events before client connection
|
|
25
21
|
- **Subdirectories:**
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
22
|
+
- `alembic/`: Database migration configuration and version files
|
|
23
|
+
- `components/`: Specialized SAC components for message forwarding and visualization
|
|
24
|
+
- `repository/`: Data access layer with Repository pattern and SQLAlchemy ORM models
|
|
25
|
+
- `routers/`: FastAPI router modules defining REST API endpoints
|
|
26
|
+
- `services/`: Business logic layer for domain-specific operations
|
|
27
|
+
- `shared/`: Common utilities, constants, enums, and exception handling
|
|
28
|
+
- `utils/`: Utility functions for creating .stim file structures from task data
|
|
29
29
|
|
|
30
30
|
## Developer API Reference
|
|
31
31
|
|
|
32
32
|
### Direct Files
|
|
33
33
|
|
|
34
34
|
#### app.py
|
|
35
|
-
**Purpose:**
|
|
35
|
+
**Purpose:** Defines the main SAC application class with configuration schema for the HTTP/SSE gateway
|
|
36
36
|
**Import:** `from solace_agent_mesh.gateway.http_sse.app import WebUIBackendApp`
|
|
37
37
|
|
|
38
38
|
**Classes/Functions/Constants:**
|
|
39
|
-
- **`WebUIBackendApp(BaseGatewayApp)`**:
|
|
40
|
-
-
|
|
39
|
+
- **`WebUIBackendApp(BaseGatewayApp)`**: Main application class extending BaseGatewayApp with WebUI-specific configuration
|
|
40
|
+
- `get_component() -> WebUIBackendComponent | None`: Retrieves the running component instance
|
|
41
|
+
- `_get_gateway_component_class() -> type[BaseGatewayComponent]`: Returns WebUIBackendComponent class
|
|
42
|
+
- **`SPECIFIC_APP_SCHEMA_PARAMS: List[Dict[str, Any]]`**: Configuration parameters including session_secret_key, FastAPI settings, frontend configuration, database settings, and feature flags
|
|
41
43
|
|
|
42
44
|
#### component.py
|
|
43
|
-
**Purpose:**
|
|
45
|
+
**Purpose:** Core SAC component hosting FastAPI server and managing all shared resources and A2A logic
|
|
44
46
|
**Import:** `from solace_agent_mesh.gateway.http_sse.component import WebUIBackendComponent`
|
|
45
47
|
|
|
46
48
|
**Classes/Functions/Constants:**
|
|
47
|
-
- **`WebUIBackendComponent(BaseGatewayComponent)`**:
|
|
48
|
-
- **Public Accessor Methods
|
|
49
|
-
- `get_sse_manager() -> SSEManager`: Returns
|
|
50
|
-
- `get_session_manager() -> SessionManager`: Returns
|
|
51
|
-
- `get_agent_registry() -> AgentRegistry`: Returns
|
|
52
|
-
- `get_core_a2a_service() -> CoreA2AService`: Returns
|
|
53
|
-
- `get_shared_artifact_service() ->
|
|
54
|
-
- `get_namespace() -> str`: Returns
|
|
55
|
-
- `get_gateway_id() -> str`: Returns
|
|
56
|
-
- **Core
|
|
57
|
-
- `publish_a2a(topic: str, payload:
|
|
58
|
-
- **
|
|
59
|
-
- `_start_listener()`: Starts
|
|
60
|
-
- `_stop_listener()`: Stops
|
|
61
|
-
- `_translate_external_input(...)`:
|
|
62
|
-
- `_send_update_to_external(...)`: Sends
|
|
63
|
-
- `_send_final_response_to_external(...)`: Sends
|
|
64
|
-
- `_send_error_to_external(...)`: Sends
|
|
49
|
+
- **`WebUIBackendComponent(BaseGatewayComponent)`**: Main component class implementing the gateway functionality
|
|
50
|
+
- **Public Accessor Methods:**
|
|
51
|
+
- `get_sse_manager() -> SSEManager`: Returns SSE manager for real-time updates
|
|
52
|
+
- `get_session_manager() -> SessionManager`: Returns session manager
|
|
53
|
+
- `get_agent_registry() -> AgentRegistry`: Returns agent registry
|
|
54
|
+
- `get_core_a2a_service() -> CoreA2AService`: Returns core A2A service
|
|
55
|
+
- `get_shared_artifact_service() -> BaseArtifactService | None`: Returns artifact service
|
|
56
|
+
- `get_namespace() -> str`: Returns A2A namespace
|
|
57
|
+
- `get_gateway_id() -> str`: Returns unique gateway identifier
|
|
58
|
+
- **Core Methods:**
|
|
59
|
+
- `publish_a2a(topic: str, payload: dict, user_properties: dict | None = None)`: Publishes A2A messages
|
|
60
|
+
- **GDK Implementation Methods:**
|
|
61
|
+
- `_start_listener()`: Starts FastAPI server
|
|
62
|
+
- `_stop_listener()`: Stops FastAPI server
|
|
63
|
+
- `_translate_external_input(...)`: Converts HTTP requests to A2A messages
|
|
64
|
+
- `_send_update_to_external(...)`: Sends intermediate updates via SSE
|
|
65
|
+
- `_send_final_response_to_external(...)`: Sends final responses via SSE
|
|
66
|
+
- `_send_error_to_external(...)`: Sends error notifications via SSE
|
|
65
67
|
|
|
66
68
|
#### dependencies.py
|
|
67
|
-
**Purpose:**
|
|
68
|
-
**Import:** `from solace_agent_mesh.gateway.http_sse.dependencies import
|
|
69
|
+
**Purpose:** FastAPI dependency injectors providing access to shared resources
|
|
70
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.dependencies import get_sac_component, get_agent_registry, get_sse_manager, get_user_id`
|
|
69
71
|
|
|
70
72
|
**Functions:**
|
|
71
|
-
- `get_sac_component() -> WebUIBackendComponent`: Returns
|
|
72
|
-
- `get_agent_registry() -> AgentRegistry`: Returns
|
|
73
|
-
- `get_sse_manager() -> SSEManager`: Returns
|
|
74
|
-
- `get_session_manager() -> SessionManager`: Returns
|
|
75
|
-
- `get_user_id(request: Request) -> str`: Returns
|
|
76
|
-
- `get_publish_a2a_func() -> PublishFunc`: Returns
|
|
77
|
-
- `get_core_a2a_service() -> CoreA2AService`: Returns
|
|
78
|
-
- `get_shared_artifact_service() ->
|
|
73
|
+
- `get_sac_component() -> WebUIBackendComponent`: Returns main component instance
|
|
74
|
+
- `get_agent_registry() -> AgentRegistry`: Returns agent registry
|
|
75
|
+
- `get_sse_manager() -> SSEManager`: Returns SSE manager
|
|
76
|
+
- `get_session_manager() -> SessionManager`: Returns session manager
|
|
77
|
+
- `get_user_id(request: Request) -> str`: Returns current user identity
|
|
78
|
+
- `get_publish_a2a_func() -> PublishFunc`: Returns A2A publishing function
|
|
79
|
+
- `get_core_a2a_service() -> CoreA2AService`: Returns core A2A service
|
|
80
|
+
- `get_shared_artifact_service() -> BaseArtifactService | None`: Returns artifact service
|
|
81
|
+
- `get_db() -> Generator[Session, None, None]`: Returns database session
|
|
82
|
+
- `ValidatedUserConfig(required_scopes: list[str])`: Dependency class for scope validation
|
|
79
83
|
|
|
80
84
|
#### main.py
|
|
81
|
-
**Purpose:**
|
|
85
|
+
**Purpose:** FastAPI application instance with middleware, routing, and exception handling
|
|
82
86
|
**Import:** `from solace_agent_mesh.gateway.http_sse.main import app, setup_dependencies`
|
|
83
87
|
|
|
84
88
|
**Classes/Functions/Constants:**
|
|
85
|
-
- **`app: FastAPI`**:
|
|
86
|
-
- **`setup_dependencies(component: WebUIBackendComponent)`**: Configures middleware, routers, and dependency injection
|
|
89
|
+
- **`app: FastAPI`**: Main FastAPI application instance
|
|
90
|
+
- **`setup_dependencies(component: WebUIBackendComponent, database_url: str = None)`**: Configures middleware, routers, and dependency injection
|
|
91
|
+
- **Exception Handlers:**
|
|
92
|
+
- `http_exception_handler()`: Handles HTTP exceptions with format detection
|
|
93
|
+
- `validation_exception_handler()`: Handles Pydantic validation errors
|
|
94
|
+
- `generic_exception_handler()`: Handles unexpected exceptions
|
|
87
95
|
|
|
88
96
|
#### session_manager.py
|
|
89
|
-
**Purpose:** Manages web user sessions and mapping to A2A Client IDs
|
|
97
|
+
**Purpose:** Manages web user sessions and mapping to A2A Client IDs
|
|
90
98
|
**Import:** `from solace_agent_mesh.gateway.http_sse.session_manager import SessionManager`
|
|
91
99
|
|
|
92
100
|
**Classes/Functions/Constants:**
|
|
93
|
-
- **`SessionManager(secret_key: str, app_config: Dict[str, Any])`**:
|
|
94
|
-
- `get_a2a_client_id(request: Request) -> str`: Returns
|
|
95
|
-
- `start_new_a2a_session(request: Request) -> str`: Creates
|
|
96
|
-
- `ensure_a2a_session(request: Request) -> str`: Ensures
|
|
97
|
-
- `store_auth_tokens(request: Request, access_token: str, refresh_token:
|
|
98
|
-
- `get_access_token(request: Request) ->
|
|
101
|
+
- **`SessionManager(secret_key: str, app_config: Dict[str, Any])`**: Session management class
|
|
102
|
+
- `get_a2a_client_id(request: Request) -> str | None`: Returns A2A client ID
|
|
103
|
+
- `start_new_a2a_session(request: Request) -> str`: Creates new A2A session
|
|
104
|
+
- `ensure_a2a_session(request: Request) -> str`: Ensures session exists
|
|
105
|
+
- `store_auth_tokens(request: Request, access_token: str, refresh_token: str | None)`: Stores auth tokens
|
|
106
|
+
- `get_access_token(request: Request) -> str | None`: Retrieves access token
|
|
107
|
+
- `dep_get_client_id() -> Callable`: Returns FastAPI dependency callable
|
|
99
108
|
|
|
100
109
|
#### sse_manager.py
|
|
101
|
-
**Purpose:** Manages Server-Sent Event
|
|
110
|
+
**Purpose:** Manages Server-Sent Event connections for streaming task updates
|
|
102
111
|
**Import:** `from solace_agent_mesh.gateway.http_sse.sse_manager import SSEManager`
|
|
103
112
|
|
|
104
113
|
**Classes/Functions/Constants:**
|
|
105
|
-
- **`SSEManager(max_queue_size: int
|
|
106
|
-
- `create_sse_connection(task_id: str) -> asyncio.Queue`: Creates
|
|
107
|
-
- `send_event(task_id: str, event_data: Dict[str, Any], event_type: str)`: Sends
|
|
108
|
-
- `close_all_for_task(task_id: str)`: Closes
|
|
109
|
-
- `close_all()`: Closes all active
|
|
114
|
+
- **`SSEManager(max_queue_size: int, event_buffer: SSEEventBuffer)`**: SSE connection manager
|
|
115
|
+
- `create_sse_connection(task_id: str) -> asyncio.Queue`: Creates SSE connection queue
|
|
116
|
+
- `send_event(task_id: str, event_data: Dict[str, Any], event_type: str)`: Sends event to connections
|
|
117
|
+
- `close_all_for_task(task_id: str)`: Closes connections for specific task
|
|
118
|
+
- `close_all()`: Closes all active connections
|
|
119
|
+
|
|
120
|
+
#### sse_event_buffer.py
|
|
121
|
+
**Purpose:** Thread-safe buffer for holding early SSE events before client connection
|
|
122
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.sse_event_buffer import SSEEventBuffer`
|
|
123
|
+
|
|
124
|
+
**Classes/Functions/Constants:**
|
|
125
|
+
- **`SSEEventBuffer(max_queue_size: int, max_age_seconds: int)`**: Event buffering system
|
|
126
|
+
- `buffer_event(task_id: str, event: Dict[str, Any])`: Buffers event for task
|
|
127
|
+
- `get_and_remove_buffer(task_id: str) -> Optional[List[Dict[str, Any]]]`: Retrieves and removes buffer
|
|
128
|
+
- `cleanup_stale_buffers()`: Removes old buffers
|
|
110
129
|
|
|
111
130
|
### Subdirectory APIs
|
|
112
131
|
|
|
132
|
+
#### alembic/
|
|
133
|
+
**Purpose:** Database migration configuration and version files for schema management
|
|
134
|
+
**Key Exports:** Migration functions for schema evolution (upgrade/downgrade operations)
|
|
135
|
+
**Import Examples:**
|
|
136
|
+
```python
|
|
137
|
+
# These are migration files executed by Alembic CLI, not directly imported
|
|
138
|
+
# Access via Alembic commands:
|
|
139
|
+
# alembic upgrade head
|
|
140
|
+
# alembic downgrade base
|
|
141
|
+
```
|
|
142
|
+
|
|
113
143
|
#### components/
|
|
114
|
-
**Purpose:**
|
|
115
|
-
**Key Exports:** `VisualizationForwarderComponent`
|
|
144
|
+
**Purpose:** Specialized SAC components for message forwarding and visualization
|
|
145
|
+
**Key Exports:** `VisualizationForwarderComponent`, `TaskLoggerForwarderComponent`
|
|
116
146
|
**Import Examples:**
|
|
117
147
|
```python
|
|
118
148
|
from solace_agent_mesh.gateway.http_sse.components import VisualizationForwarderComponent
|
|
149
|
+
from solace_agent_mesh.gateway.http_sse.components.task_logger_forwarder import TaskLoggerForwarderComponent
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### repository/
|
|
153
|
+
**Purpose:** Data access layer implementing Repository pattern with SQLAlchemy ORM models
|
|
154
|
+
**Key Exports:** Repository interfaces, implementations, domain entities, and SQLAlchemy models
|
|
155
|
+
**Import Examples:**
|
|
156
|
+
```python
|
|
157
|
+
from solace_agent_mesh.gateway.http_sse.repository import (
|
|
158
|
+
ISessionRepository, IMessageRepository, SessionRepository, MessageRepository,
|
|
159
|
+
Session, Message, SessionHistory, Base, SessionModel, MessageModel
|
|
160
|
+
)
|
|
119
161
|
```
|
|
120
162
|
|
|
121
163
|
#### routers/
|
|
122
|
-
**Purpose:**
|
|
164
|
+
**Purpose:** FastAPI router modules defining REST API endpoints
|
|
123
165
|
**Key Exports:** Router instances for agents, tasks, SSE, artifacts, auth, config, sessions, people, users, visualization
|
|
124
166
|
**Import Examples:**
|
|
125
167
|
```python
|
|
@@ -128,15 +170,33 @@ from solace_agent_mesh.gateway.http_sse.routers.tasks import CancelTaskApiPayloa
|
|
|
128
170
|
```
|
|
129
171
|
|
|
130
172
|
#### services/
|
|
131
|
-
**Purpose:**
|
|
132
|
-
**Key Exports:** `
|
|
173
|
+
**Purpose:** Business logic layer for domain-specific operations
|
|
174
|
+
**Key Exports:** `AgentCardService`, `TaskService`, `PeopleService`, `SessionService`, `FeedbackService`, `TaskLoggerService`
|
|
133
175
|
**Import Examples:**
|
|
134
176
|
```python
|
|
135
|
-
from solace_agent_mesh.gateway.http_sse.services.
|
|
177
|
+
from solace_agent_mesh.gateway.http_sse.services.agent_card_service import AgentCardService
|
|
136
178
|
from solace_agent_mesh.gateway.http_sse.services.task_service import TaskService
|
|
137
179
|
from solace_agent_mesh.gateway.http_sse.services.people_service import PeopleService
|
|
138
180
|
```
|
|
139
181
|
|
|
182
|
+
#### shared/
|
|
183
|
+
**Purpose:** Common utilities, constants, enums, and exception handling
|
|
184
|
+
**Key Exports:** Authentication utilities, timestamp functions, enums, exception handlers, and type definitions
|
|
185
|
+
**Import Examples:**
|
|
186
|
+
```python
|
|
187
|
+
from solace_agent_mesh.gateway.http_sse.shared import get_current_user, now_epoch_ms
|
|
188
|
+
from solace_agent_mesh.gateway.http_sse.shared.enums import SenderType, TaskStatus
|
|
189
|
+
from solace_agent_mesh.gateway.http_sse.shared.types import UserId, SessionId, PaginationInfo
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### utils/
|
|
193
|
+
**Purpose:** Utility functions for creating .stim file structures from task data
|
|
194
|
+
**Key Exports:** `create_stim_from_task_data`
|
|
195
|
+
**Import Examples:**
|
|
196
|
+
```python
|
|
197
|
+
from solace_agent_mesh.gateway.http_sse.utils.stim_utils import create_stim_from_task_data
|
|
198
|
+
```
|
|
199
|
+
|
|
140
200
|
## Complete Usage Guide
|
|
141
201
|
|
|
142
202
|
### 1. Setting Up the Gateway Application
|
|
@@ -155,13 +215,27 @@ app_config = {
|
|
|
155
215
|
"cors_allowed_origins": ["http://localhost:3000"],
|
|
156
216
|
"frontend_welcome_message": "Welcome to my A2A system!",
|
|
157
217
|
"frontend_bot_name": "My Assistant",
|
|
158
|
-
#
|
|
218
|
+
# Database configuration for persistence
|
|
219
|
+
"session_service": {
|
|
220
|
+
"type": "sql",
|
|
221
|
+
"database_url": "sqlite:///./sessions.db"
|
|
222
|
+
},
|
|
223
|
+
# Task logging configuration
|
|
224
|
+
"task_logging": {
|
|
225
|
+
"enabled": True,
|
|
226
|
+
"log_status_updates": True,
|
|
227
|
+
"log_artifact_events": True
|
|
228
|
+
},
|
|
229
|
+
# Data retention configuration
|
|
230
|
+
"data_retention": {
|
|
231
|
+
"enabled": True,
|
|
232
|
+
"task_retention_days": 90,
|
|
233
|
+
"cleanup_interval_hours": 24
|
|
234
|
+
}
|
|
159
235
|
}
|
|
160
236
|
|
|
161
|
-
# Initialize the app
|
|
237
|
+
# Initialize and run the app
|
|
162
238
|
webui_app = WebUIBackendApp(app_info=app_config)
|
|
163
|
-
|
|
164
|
-
# Run the app (this starts the FastAPI server)
|
|
165
239
|
webui_app.run()
|
|
166
240
|
```
|
|
167
241
|
|
|
@@ -173,7 +247,9 @@ from solace_agent_mesh.gateway.http_sse.dependencies import (
|
|
|
173
247
|
get_agent_registry,
|
|
174
248
|
get_user_id,
|
|
175
249
|
get_publish_a2a_func,
|
|
176
|
-
get_core_a2a_service
|
|
250
|
+
get_core_a2a_service,
|
|
251
|
+
get_sse_manager,
|
|
252
|
+
ValidatedUserConfig
|
|
177
253
|
)
|
|
178
254
|
from solace_agent_mesh.common.agent_registry import AgentRegistry
|
|
179
255
|
|
|
@@ -183,7 +259,8 @@ router = APIRouter()
|
|
|
183
259
|
async def my_custom_endpoint(
|
|
184
260
|
user_id: str = Depends(get_user_id),
|
|
185
261
|
agent_registry: AgentRegistry = Depends(get_agent_registry),
|
|
186
|
-
publish_func = Depends(get_publish_a2a_func)
|
|
262
|
+
publish_func = Depends(get_publish_a2a_func),
|
|
263
|
+
user_config: dict = Depends(ValidatedUserConfig(["custom:endpoint:access"]))
|
|
187
264
|
):
|
|
188
265
|
# Access discovered agents
|
|
189
266
|
agents = agent_registry.get_all_agents()
|
|
@@ -195,105 +272,28 @@ async def my_custom_endpoint(
|
|
|
195
272
|
user_properties={"clientId": user_id}
|
|
196
273
|
)
|
|
197
274
|
|
|
198
|
-
return {"
|
|
275
|
+
return {"agents": len(agents), "user": user_id}
|
|
199
276
|
```
|
|
200
277
|
|
|
201
|
-
### 3.
|
|
278
|
+
### 3. Working with Sessions and Messages
|
|
202
279
|
|
|
203
280
|
```python
|
|
204
|
-
from fastapi import
|
|
205
|
-
from
|
|
206
|
-
from solace_agent_mesh.gateway.http_sse.dependencies import get_sse_manager
|
|
207
|
-
from solace_agent_mesh.gateway.http_sse.sse_manager import SSEManager
|
|
208
|
-
import asyncio
|
|
209
|
-
import json
|
|
210
|
-
|
|
211
|
-
router = APIRouter()
|
|
212
|
-
|
|
213
|
-
@router.get("/my-sse-endpoint/{task_id}")
|
|
214
|
-
async def my_sse_endpoint(
|
|
215
|
-
task_id: str,
|
|
216
|
-
sse_manager: SSEManager = Depends(get_sse_manager)
|
|
217
|
-
):
|
|
218
|
-
# Create SSE connection for the task
|
|
219
|
-
connection_queue = await sse_manager.create_sse_connection(task_id)
|
|
220
|
-
|
|
221
|
-
async def event_generator():
|
|
222
|
-
try:
|
|
223
|
-
while True:
|
|
224
|
-
# Wait for events from the queue
|
|
225
|
-
event = await connection_queue.get()
|
|
226
|
-
if event is None: # Close signal
|
|
227
|
-
break
|
|
228
|
-
|
|
229
|
-
# Format as SSE
|
|
230
|
-
yield f"event: {event['event']}\n"
|
|
231
|
-
yield f"data: {event['data']}\n\n"
|
|
232
|
-
|
|
233
|
-
except asyncio.CancelledError:
|
|
234
|
-
pass
|
|
235
|
-
finally:
|
|
236
|
-
# Clean up connection
|
|
237
|
-
await sse_manager.remove_sse_connection(task_id, connection_queue)
|
|
238
|
-
|
|
239
|
-
return StreamingResponse(
|
|
240
|
-
event_generator(),
|
|
241
|
-
media_type="text/event-stream",
|
|
242
|
-
headers={
|
|
243
|
-
"Cache-Control": "no-cache",
|
|
244
|
-
"Connection": "keep-alive",
|
|
245
|
-
}
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
# Send events to SSE connections
|
|
249
|
-
async def send_custom_event(sse_manager: SSEManager, task_id: str):
|
|
250
|
-
await sse_manager.send_event(
|
|
251
|
-
task_id=task_id,
|
|
252
|
-
event_data={"message": "Custom event", "timestamp": "2024-01-01T00:00:00Z"},
|
|
253
|
-
event_type="custom_event"
|
|
254
|
-
)
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### 4. Working with Sessions and User Identity
|
|
258
|
-
|
|
259
|
-
```python
|
|
260
|
-
from fastapi import APIRouter, Depends, Request
|
|
281
|
+
from fastapi import Depends
|
|
282
|
+
from sqlalchemy.orm import Session
|
|
261
283
|
from solace_agent_mesh.gateway.http_sse.dependencies import (
|
|
262
|
-
|
|
263
|
-
get_user_id,
|
|
264
|
-
ensure_session_id
|
|
284
|
+
get_db, get_session_business_service_optional
|
|
265
285
|
)
|
|
266
|
-
from solace_agent_mesh.gateway.http_sse.
|
|
267
|
-
|
|
268
|
-
router = APIRouter()
|
|
286
|
+
from solace_agent_mesh.gateway.http_sse.services.session_service import SessionService
|
|
287
|
+
from solace_agent_mesh.gateway.http_sse.shared.enums import SenderType
|
|
269
288
|
|
|
270
|
-
@router.post("/
|
|
271
|
-
async def
|
|
272
|
-
|
|
289
|
+
@router.post("/sessions/{session_id}/messages")
|
|
290
|
+
async def add_message_to_session(
|
|
291
|
+
session_id: str,
|
|
292
|
+
message_text: str,
|
|
273
293
|
user_id: str = Depends(get_user_id),
|
|
274
|
-
|
|
275
|
-
|
|
294
|
+
db: Session = Depends(get_db),
|
|
295
|
+
session_service: SessionService = Depends(get_session_business_service_optional)
|
|
276
296
|
):
|
|
277
|
-
|
|
278
|
-
new_session_id = session_manager.start_new_a2a_session(request)
|
|
279
|
-
|
|
280
|
-
return {
|
|
281
|
-
"user_id": user_id,
|
|
282
|
-
"old_session_id": session_id,
|
|
283
|
-
"new_session_id": new_session_id,
|
|
284
|
-
"message": "New conversation started"
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
### 5. Using Services for Business Logic
|
|
289
|
-
|
|
290
|
-
```python
|
|
291
|
-
from fastapi import APIRouter, Depends
|
|
292
|
-
from solace_agent_mesh.gateway.http_sse.dependencies import (
|
|
293
|
-
get_agent_service,
|
|
294
|
-
get_task_service,
|
|
295
|
-
get_people_service
|
|
296
|
-
)
|
|
297
|
-
from solace_agent_mesh.gateway.http_sse.services.agent_service import AgentService
|
|
297
|
+
if session_
|
|
298
298
|
|
|
299
|
-
# content_hash:
|
|
299
|
+
# content_hash: 1ec069cbf74863d29b45cd3b1031e6ab820e1b30d7c8b631488a54630a936828
|