solace-agent-mesh 0.2.3__py3-none-any.whl → 1.0.1__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 +93 -0
- solace_agent_mesh/agent/adk/app_llm_agent.py +26 -0
- solace_agent_mesh/agent/adk/callbacks.py +1694 -0
- solace_agent_mesh/agent/adk/filesystem_artifact_service.py +381 -0
- solace_agent_mesh/agent/adk/invocation_monitor.py +295 -0
- solace_agent_mesh/agent/adk/models/lite_llm.py +872 -0
- solace_agent_mesh/agent/adk/models/models_llm.txt +94 -0
- solace_agent_mesh/agent/adk/runner.py +353 -0
- solace_agent_mesh/agent/adk/services.py +240 -0
- solace_agent_mesh/agent/adk/setup.py +751 -0
- solace_agent_mesh/agent/adk/stream_parser.py +214 -0
- solace_agent_mesh/agent/adk/tool_wrapper.py +139 -0
- solace_agent_mesh/agent/agent_llm.txt +41 -0
- solace_agent_mesh/agent/protocol/event_handlers.py +1469 -0
- solace_agent_mesh/agent/protocol/protocol_llm.txt +21 -0
- solace_agent_mesh/agent/sac/app.py +640 -0
- solace_agent_mesh/agent/sac/component.py +3388 -0
- solace_agent_mesh/agent/sac/patch_adk.py +111 -0
- solace_agent_mesh/agent/sac/sac_llm.txt +105 -0
- solace_agent_mesh/agent/sac/task_execution_context.py +176 -0
- solace_agent_mesh/agent/testing/__init__.py +3 -0
- solace_agent_mesh/agent/testing/debug_utils.py +135 -0
- solace_agent_mesh/agent/testing/testing_llm.txt +90 -0
- solace_agent_mesh/agent/tools/__init__.py +14 -0
- solace_agent_mesh/agent/tools/audio_tools.py +1622 -0
- solace_agent_mesh/agent/tools/builtin_artifact_tools.py +1954 -0
- solace_agent_mesh/agent/tools/builtin_data_analysis_tools.py +238 -0
- solace_agent_mesh/agent/tools/general_agent_tools.py +569 -0
- solace_agent_mesh/agent/tools/image_tools.py +1184 -0
- solace_agent_mesh/agent/tools/peer_agent_tool.py +289 -0
- solace_agent_mesh/agent/tools/registry.py +36 -0
- solace_agent_mesh/agent/tools/test_tools.py +135 -0
- solace_agent_mesh/agent/tools/tool_definition.py +45 -0
- solace_agent_mesh/agent/tools/tools_llm.txt +104 -0
- solace_agent_mesh/agent/tools/web_tools.py +381 -0
- solace_agent_mesh/agent/utils/artifact_helpers.py +927 -0
- solace_agent_mesh/agent/utils/config_parser.py +47 -0
- solace_agent_mesh/agent/utils/context_helpers.py +60 -0
- solace_agent_mesh/agent/utils/utils_llm.txt +153 -0
- solace_agent_mesh/assets/docs/404.html +16 -0
- solace_agent_mesh/assets/docs/assets/css/styles.906a1503.css +1 -0
- solace_agent_mesh/assets/docs/assets/images/Solace_AI_Framework_With_Broker-85f0a306a9bcdd20b390b7a949f6d862.png +0 -0
- solace_agent_mesh/assets/docs/assets/images/sac-flows-80d5b603c6aafd33e87945680ce0abf3.png +0 -0
- solace_agent_mesh/assets/docs/assets/images/sac_parts_of_a_component-cb3d0424b1d0c17734c5435cca6b4082.png +0 -0
- solace_agent_mesh/assets/docs/assets/js/04989206.674a8007.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/0e682baa.79f0ab22.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1001.0182a8bd.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1023fc19.015679ca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1039.0bd46aa1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/149.b797a808.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.91c7bc01.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/165.6a39807d.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/165.6a39807d.js.LICENSE.txt +9 -0
- solace_agent_mesh/assets/docs/assets/js/166ab619.7d97ccaf.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/17896441.a5e82f9b.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/17896441.a5e82f9b.js.LICENSE.txt +7 -0
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.23bccffb.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2130.ab9fd314.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/21ceee5f.614fa8dd.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2237.5e477fc6.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2334.622a6395.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.8909df92.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3219.adc1d663.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/332e10b5.7a103f42.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3624.b524e433.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/375.708d48db.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3834.b6cd790e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3d406171.f722eaf5.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4250.95455b28.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.36090198.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4356.d169ab5b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/442a8107.5ba94b65.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4458.518e66fa.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4488.c7cc3442.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4494.6ee23046.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4855.fc4444b6.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4866.22daefc0.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4950.ca4caeda.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4c2787c2.66ee00e9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5388.7a136447.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/55f47984.c484bf96.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5607.081356f8.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5864.b0d0e9de.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.bda20761.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5e95c892.558d5167.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6143.0a1464c9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6395.e9c73649.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6796.51d2c9b7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6976.379be23b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6978.ee0b945c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7040.cb436723.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7195.412f418a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7280.3fb73bdb.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/768e31b0.a12673db.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7845.e33e7c4c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7900.69516146.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8356.8a379c04.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/85387663.6bf41934.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8567.4732c6b7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8573.cb04eda5.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8577.1d54e766.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8591.d7c16be6.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/8591.d7c16be6.js.LICENSE.txt +61 -0
- solace_agent_mesh/assets/docs/assets/js/8709.7ecd4047.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8731.49e930c2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8908.f9d1b506.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9157.b4093d07.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9278.a4fd875d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/945fb41e.74d728aa.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9616.b75c2f6d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9793.c6d16376.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.1bf8f61c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.26ca071f.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a7bd4aaa.2204d2f7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a94703ab.0438dbc2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/aba21aa0.c42a534c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/aba87c2f.d3e2dcc3.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ae4415af.8e279b5d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/b7006a3a.40b10c9d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bac0be12.f50d9bac.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bb2ef573.207e6990.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c2c06897.63b76e9e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cc969b05.954186d4.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.ca6eed8c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ced92a13.fb92e7ca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cee5d587.f5b73ca1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f284c35a.ecc3d195.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f897a61a.2c2e152c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/fbfa3e75.aca209c9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/main.7ed3319f.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/main.7ed3319f.js.LICENSE.txt +81 -0
- solace_agent_mesh/assets/docs/assets/js/runtime~main.d9520ae2.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +128 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +91 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +201 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +91 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +55 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +82 -0
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +60 -0
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +48 -0
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +54 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +17 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +45 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +76 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +150 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +54 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +267 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +136 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +116 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +80 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +164 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +57 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +72 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +102 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +99 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +90 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +107 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +152 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +103 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +170 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +200 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +54 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +69 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +59 -0
- solace_agent_mesh/assets/docs/img/Solace_AI_Framework_README.png +0 -0
- solace_agent_mesh/assets/docs/img/Solace_AI_Framework_With_Broker.png +0 -0
- solace_agent_mesh/assets/docs/img/logo.png +0 -0
- solace_agent_mesh/assets/docs/img/sac-flows.png +0 -0
- solace_agent_mesh/assets/docs/img/sac_parts_of_a_component.png +0 -0
- solace_agent_mesh/assets/docs/img/solace-logo.png +0 -0
- solace_agent_mesh/assets/docs/lunr-index-1753813536522.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -0
- solace_agent_mesh/assets/docs/search-doc-1753813536522.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -0
- solace_agent_mesh/assets/docs/sitemap.xml +1 -0
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/add_cmd/__init__.py +15 -0
- solace_agent_mesh/cli/commands/add_cmd/add_cmd_llm.txt +250 -0
- solace_agent_mesh/cli/commands/add_cmd/agent_cmd.py +659 -0
- solace_agent_mesh/cli/commands/add_cmd/gateway_cmd.py +322 -0
- solace_agent_mesh/cli/commands/add_cmd/web_add_agent_step.py +93 -0
- solace_agent_mesh/cli/commands/add_cmd/web_add_gateway_step.py +118 -0
- solace_agent_mesh/cli/commands/docs_cmd.py +57 -0
- solace_agent_mesh/cli/commands/eval_cmd.py +64 -0
- solace_agent_mesh/cli/commands/init_cmd/__init__.py +404 -0
- solace_agent_mesh/cli/commands/init_cmd/broker_step.py +201 -0
- solace_agent_mesh/cli/commands/init_cmd/directory_step.py +28 -0
- solace_agent_mesh/cli/commands/init_cmd/env_step.py +197 -0
- solace_agent_mesh/cli/commands/init_cmd/init_cmd_llm.txt +365 -0
- solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +387 -0
- solace_agent_mesh/cli/commands/init_cmd/project_files_step.py +38 -0
- solace_agent_mesh/cli/commands/init_cmd/web_init_step.py +110 -0
- solace_agent_mesh/cli/commands/init_cmd/webui_gateway_step.py +183 -0
- solace_agent_mesh/cli/commands/plugin_cmd/__init__.py +18 -0
- solace_agent_mesh/cli/commands/plugin_cmd/add_cmd.py +372 -0
- solace_agent_mesh/cli/commands/plugin_cmd/build_cmd.py +86 -0
- solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +138 -0
- solace_agent_mesh/cli/commands/plugin_cmd/create_cmd.py +309 -0
- solace_agent_mesh/cli/commands/plugin_cmd/official_registry.py +174 -0
- solace_agent_mesh/cli/commands/plugin_cmd/plugin_cmd_llm.txt +305 -0
- solace_agent_mesh/cli/commands/run_cmd.py +158 -0
- solace_agent_mesh/cli/main.py +17 -294
- solace_agent_mesh/cli/utils.py +135 -204
- solace_agent_mesh/client/webui/frontend/static/assets/authCallback-DvlO62me.js +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/client-bp6u3qVZ.js +49 -0
- solace_agent_mesh/client/webui/frontend/static/assets/favicon-BLgzUch9.ico +0 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-An0a5j5k.js +663 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-Bu5-4Bac.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +14 -0
- solace_agent_mesh/client/webui/frontend/static/index.html +15 -0
- solace_agent_mesh/common/__init__.py +1 -0
- solace_agent_mesh/common/a2a_protocol.py +564 -0
- solace_agent_mesh/common/agent_registry.py +42 -0
- solace_agent_mesh/common/client/__init__.py +4 -0
- solace_agent_mesh/common/client/card_resolver.py +21 -0
- solace_agent_mesh/common/client/client.py +85 -0
- solace_agent_mesh/common/client/client_llm.txt +133 -0
- solace_agent_mesh/common/common_llm.txt +144 -0
- solace_agent_mesh/common/constants.py +1 -14
- solace_agent_mesh/common/middleware/__init__.py +12 -0
- solace_agent_mesh/common/middleware/config_resolver.py +130 -0
- solace_agent_mesh/common/middleware/middleware_llm.txt +174 -0
- solace_agent_mesh/common/middleware/registry.py +125 -0
- solace_agent_mesh/common/server/__init__.py +4 -0
- solace_agent_mesh/common/server/server.py +122 -0
- solace_agent_mesh/common/server/server_llm.txt +169 -0
- solace_agent_mesh/common/server/task_manager.py +291 -0
- solace_agent_mesh/common/server/utils.py +28 -0
- solace_agent_mesh/common/services/__init__.py +4 -0
- solace_agent_mesh/common/services/employee_service.py +162 -0
- solace_agent_mesh/common/services/identity_service.py +129 -0
- solace_agent_mesh/common/services/providers/__init__.py +4 -0
- solace_agent_mesh/common/services/providers/local_file_identity_service.py +148 -0
- solace_agent_mesh/common/services/providers/providers_llm.txt +113 -0
- solace_agent_mesh/common/services/services_llm.txt +132 -0
- solace_agent_mesh/common/types.py +411 -0
- solace_agent_mesh/common/utils/__init__.py +7 -0
- solace_agent_mesh/common/utils/asyncio_macos_fix.py +86 -0
- solace_agent_mesh/common/utils/embeds/__init__.py +33 -0
- solace_agent_mesh/common/utils/embeds/constants.py +55 -0
- solace_agent_mesh/common/utils/embeds/converter.py +452 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +124 -0
- solace_agent_mesh/common/utils/embeds/evaluators.py +394 -0
- solace_agent_mesh/common/utils/embeds/modifiers.py +816 -0
- solace_agent_mesh/common/utils/embeds/resolver.py +865 -0
- solace_agent_mesh/common/utils/embeds/types.py +14 -0
- solace_agent_mesh/common/utils/in_memory_cache.py +108 -0
- solace_agent_mesh/common/utils/log_formatters.py +44 -0
- solace_agent_mesh/common/utils/mime_helpers.py +106 -0
- solace_agent_mesh/common/utils/push_notification_auth.py +134 -0
- solace_agent_mesh/common/utils/utils_llm.txt +67 -0
- solace_agent_mesh/config_portal/backend/common.py +66 -24
- solace_agent_mesh/config_portal/backend/plugin_catalog/constants.py +23 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/models.py +49 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/registry_manager.py +160 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/scraper.py +525 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog_server.py +216 -0
- solace_agent_mesh/config_portal/backend/server.py +550 -140
- solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DNxCwAGB.js +48 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/components-B7lKcHVY.js +140 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{entry.client-DX1misIU.js → entry.client-CEumGClk.js} +3 -3
- solace_agent_mesh/config_portal/frontend/static/client/assets/index-DSo1AH_7.js +68 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-d2b54a97.js +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{root-BApq5dPK.js → root-C4XmHinv.js} +2 -2
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-DxRwaWiE.css +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/index.html +3 -3
- solace_agent_mesh/core_a2a/__init__.py +1 -0
- solace_agent_mesh/core_a2a/core_a2a_llm.txt +88 -0
- solace_agent_mesh/core_a2a/service.py +331 -0
- solace_agent_mesh/evaluation/config_loader.py +657 -0
- solace_agent_mesh/evaluation/evaluator.py +667 -0
- solace_agent_mesh/evaluation/message_organizer.py +568 -0
- solace_agent_mesh/evaluation/report/benchmark_info.html +35 -0
- solace_agent_mesh/evaluation/report/chart_section.html +141 -0
- solace_agent_mesh/evaluation/report/detailed_breakdown.html +28 -0
- solace_agent_mesh/evaluation/report/modal.html +59 -0
- solace_agent_mesh/evaluation/report/modal_chart_functions.js +411 -0
- solace_agent_mesh/evaluation/report/modal_script.js +296 -0
- solace_agent_mesh/evaluation/report/modal_styles.css +340 -0
- solace_agent_mesh/evaluation/report/performance_metrics_styles.css +93 -0
- solace_agent_mesh/evaluation/report/templates/footer.html +2 -0
- solace_agent_mesh/evaluation/report/templates/header.html +340 -0
- solace_agent_mesh/evaluation/report_data_processor.py +972 -0
- solace_agent_mesh/evaluation/report_generator.py +613 -0
- solace_agent_mesh/evaluation/run.py +613 -0
- solace_agent_mesh/evaluation/subscriber.py +872 -0
- solace_agent_mesh/evaluation/summary_builder.py +775 -0
- solace_agent_mesh/evaluation/test_case_loader.py +714 -0
- solace_agent_mesh/gateway/base/__init__.py +1 -0
- solace_agent_mesh/gateway/base/app.py +266 -0
- solace_agent_mesh/gateway/base/base_llm.txt +119 -0
- solace_agent_mesh/gateway/base/component.py +1542 -0
- solace_agent_mesh/gateway/base/task_context.py +74 -0
- solace_agent_mesh/gateway/gateway_llm.txt +125 -0
- solace_agent_mesh/gateway/http_sse/app.py +190 -0
- solace_agent_mesh/gateway/http_sse/component.py +1602 -0
- solace_agent_mesh/gateway/http_sse/components/__init__.py +7 -0
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +65 -0
- solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +108 -0
- solace_agent_mesh/gateway/http_sse/dependencies.py +316 -0
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +63 -0
- solace_agent_mesh/gateway/http_sse/main.py +442 -0
- solace_agent_mesh/gateway/http_sse/routers/__init__.py +4 -0
- solace_agent_mesh/gateway/http_sse/routers/agents.py +41 -0
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +821 -0
- solace_agent_mesh/gateway/http_sse/routers/auth.py +212 -0
- solace_agent_mesh/gateway/http_sse/routers/config.py +55 -0
- solace_agent_mesh/gateway/http_sse/routers/people.py +69 -0
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +37 -0
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +80 -0
- solace_agent_mesh/gateway/http_sse/routers/sse.py +138 -0
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +294 -0
- solace_agent_mesh/gateway/http_sse/routers/users.py +59 -0
- solace_agent_mesh/gateway/http_sse/routers/visualization.py +1131 -0
- solace_agent_mesh/gateway/http_sse/services/__init__.py +4 -0
- solace_agent_mesh/gateway/http_sse/services/agent_service.py +69 -0
- solace_agent_mesh/gateway/http_sse/services/people_service.py +158 -0
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +179 -0
- solace_agent_mesh/gateway/http_sse/services/task_service.py +121 -0
- solace_agent_mesh/gateway/http_sse/session_manager.py +187 -0
- solace_agent_mesh/gateway/http_sse/sse_manager.py +328 -0
- solace_agent_mesh/llm.txt +228 -0
- solace_agent_mesh/llm_detail.txt +2835 -0
- solace_agent_mesh/templates/agent_template.yaml +53 -0
- solace_agent_mesh/templates/eval_backend_template.yaml +54 -0
- solace_agent_mesh/templates/gateway_app_template.py +73 -0
- solace_agent_mesh/templates/gateway_component_template.py +400 -0
- solace_agent_mesh/templates/gateway_config_template.yaml +43 -0
- solace_agent_mesh/templates/main_orchestrator.yaml +55 -0
- solace_agent_mesh/templates/plugin_agent_config_template.yaml +122 -0
- solace_agent_mesh/templates/plugin_custom_config_template.yaml +27 -0
- solace_agent_mesh/templates/plugin_custom_template.py +10 -0
- solace_agent_mesh/templates/plugin_gateway_config_template.yaml +63 -0
- solace_agent_mesh/templates/plugin_pyproject_template.toml +33 -0
- solace_agent_mesh/templates/plugin_readme_template.md +34 -0
- solace_agent_mesh/templates/plugin_tools_template.py +224 -0
- solace_agent_mesh/templates/shared_config.yaml +66 -0
- solace_agent_mesh/templates/templates_llm.txt +147 -0
- solace_agent_mesh/templates/webui.yaml +53 -0
- solace_agent_mesh-1.0.1.dist-info/METADATA +432 -0
- solace_agent_mesh-1.0.1.dist-info/RECORD +359 -0
- solace_agent_mesh-1.0.1.dist-info/entry_points.txt +3 -0
- {solace_agent_mesh-0.2.3.dist-info → solace_agent_mesh-1.0.1.dist-info}/licenses/LICENSE +1 -1
- solace_agent_mesh/agents/base_agent_component.py +0 -226
- solace_agent_mesh/agents/global/actions/agent_state_change.py +0 -54
- solace_agent_mesh/agents/global/actions/clear_history.py +0 -32
- solace_agent_mesh/agents/global/actions/convert_file_to_markdown.py +0 -160
- solace_agent_mesh/agents/global/actions/create_file.py +0 -70
- solace_agent_mesh/agents/global/actions/error_action.py +0 -45
- solace_agent_mesh/agents/global/actions/plantuml_diagram.py +0 -163
- solace_agent_mesh/agents/global/actions/plotly_graph.py +0 -152
- solace_agent_mesh/agents/global/actions/retrieve_file.py +0 -51
- solace_agent_mesh/agents/global/global_agent_component.py +0 -38
- solace_agent_mesh/agents/image_processing/actions/create_image.py +0 -75
- solace_agent_mesh/agents/image_processing/actions/describe_image.py +0 -115
- solace_agent_mesh/agents/image_processing/image_processing_agent_component.py +0 -23
- solace_agent_mesh/agents/slack/__init__.py +0 -1
- solace_agent_mesh/agents/slack/actions/__init__.py +0 -1
- solace_agent_mesh/agents/slack/actions/post_message.py +0 -177
- solace_agent_mesh/agents/slack/slack_agent_component.py +0 -59
- solace_agent_mesh/agents/web_request/actions/do_image_search.py +0 -84
- solace_agent_mesh/agents/web_request/actions/do_news_search.py +0 -47
- solace_agent_mesh/agents/web_request/actions/do_suggestion_search.py +0 -34
- solace_agent_mesh/agents/web_request/actions/do_web_request.py +0 -135
- solace_agent_mesh/agents/web_request/actions/download_file.py +0 -69
- solace_agent_mesh/agents/web_request/web_request_agent_component.py +0 -33
- solace_agent_mesh/assets/web-visualizer/assets/index-D0qORgkg.css +0 -1
- solace_agent_mesh/assets/web-visualizer/assets/index-DnDr1pnu.js +0 -109
- solace_agent_mesh/assets/web-visualizer/index.html +0 -14
- solace_agent_mesh/assets/web-visualizer/vite.svg +0 -1
- solace_agent_mesh/cli/commands/add/__init__.py +0 -3
- solace_agent_mesh/cli/commands/add/add.py +0 -88
- solace_agent_mesh/cli/commands/add/agent.py +0 -110
- solace_agent_mesh/cli/commands/add/copy_from_plugin.py +0 -92
- solace_agent_mesh/cli/commands/add/gateway.py +0 -374
- solace_agent_mesh/cli/commands/build.py +0 -670
- solace_agent_mesh/cli/commands/chat/__init__.py +0 -3
- solace_agent_mesh/cli/commands/chat/chat.py +0 -361
- solace_agent_mesh/cli/commands/config.py +0 -29
- solace_agent_mesh/cli/commands/init/__init__.py +0 -3
- solace_agent_mesh/cli/commands/init/ai_provider_step.py +0 -93
- solace_agent_mesh/cli/commands/init/broker_step.py +0 -99
- solace_agent_mesh/cli/commands/init/builtin_agent_step.py +0 -83
- solace_agent_mesh/cli/commands/init/check_if_already_done.py +0 -13
- solace_agent_mesh/cli/commands/init/create_config_file_step.py +0 -65
- solace_agent_mesh/cli/commands/init/create_other_project_files_step.py +0 -147
- solace_agent_mesh/cli/commands/init/file_service_step.py +0 -73
- solace_agent_mesh/cli/commands/init/init.py +0 -92
- solace_agent_mesh/cli/commands/init/project_structure_step.py +0 -16
- solace_agent_mesh/cli/commands/init/web_init_step.py +0 -32
- solace_agent_mesh/cli/commands/plugin/__init__.py +0 -3
- solace_agent_mesh/cli/commands/plugin/add.py +0 -100
- solace_agent_mesh/cli/commands/plugin/build.py +0 -268
- solace_agent_mesh/cli/commands/plugin/create.py +0 -117
- solace_agent_mesh/cli/commands/plugin/plugin.py +0 -124
- solace_agent_mesh/cli/commands/plugin/remove.py +0 -73
- solace_agent_mesh/cli/commands/run.py +0 -68
- solace_agent_mesh/cli/commands/visualizer.py +0 -138
- solace_agent_mesh/cli/config.py +0 -85
- solace_agent_mesh/common/action.py +0 -91
- solace_agent_mesh/common/action_list.py +0 -37
- solace_agent_mesh/common/action_response.py +0 -340
- solace_agent_mesh/common/mysql_database.py +0 -40
- solace_agent_mesh/common/postgres_database.py +0 -85
- solace_agent_mesh/common/prompt_templates.py +0 -28
- solace_agent_mesh/common/stimulus_utils.py +0 -152
- solace_agent_mesh/common/time.py +0 -24
- solace_agent_mesh/common/utils.py +0 -712
- solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DMmCawWe.js +0 -42
- solace_agent_mesh/config_portal/frontend/static/client/assets/components-ZIfdTbrV.js +0 -191
- solace_agent_mesh/config_portal/frontend/static/client/assets/index-BJHAE5s4.js +0 -17
- solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-dd988f05.js +0 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-DX4gQ516.css +0 -1
- solace_agent_mesh/configs/agent_global.yaml +0 -74
- solace_agent_mesh/configs/agent_image_processing.yaml +0 -82
- solace_agent_mesh/configs/agent_slack.yaml +0 -64
- solace_agent_mesh/configs/agent_web_request.yaml +0 -75
- solace_agent_mesh/configs/conversation_to_file.yaml +0 -56
- solace_agent_mesh/configs/error_catcher.yaml +0 -56
- solace_agent_mesh/configs/monitor.yaml +0 -0
- solace_agent_mesh/configs/monitor_stim_and_errors_to_slack.yaml +0 -109
- solace_agent_mesh/configs/monitor_user_feedback.yaml +0 -58
- solace_agent_mesh/configs/orchestrator.yaml +0 -241
- solace_agent_mesh/configs/service_embedding.yaml +0 -81
- solace_agent_mesh/configs/service_llm.yaml +0 -265
- solace_agent_mesh/configs/visualize_websocket.yaml +0 -55
- solace_agent_mesh/gateway/components/gateway_base.py +0 -47
- solace_agent_mesh/gateway/components/gateway_input.py +0 -278
- solace_agent_mesh/gateway/components/gateway_output.py +0 -298
- solace_agent_mesh/gateway/identity/bamboohr_identity.py +0 -18
- solace_agent_mesh/gateway/identity/identity_base.py +0 -10
- solace_agent_mesh/gateway/identity/identity_provider.py +0 -60
- solace_agent_mesh/gateway/identity/no_identity.py +0 -9
- solace_agent_mesh/gateway/identity/passthru_identity.py +0 -9
- solace_agent_mesh/monitors/base_monitor_component.py +0 -26
- solace_agent_mesh/monitors/feedback/user_feedback_monitor.py +0 -75
- solace_agent_mesh/monitors/stim_and_errors/stim_and_error_monitor.py +0 -560
- solace_agent_mesh/orchestrator/__init__.py +0 -0
- solace_agent_mesh/orchestrator/action_manager.py +0 -237
- solace_agent_mesh/orchestrator/components/__init__.py +0 -0
- solace_agent_mesh/orchestrator/components/orchestrator_action_manager_timeout_component.py +0 -58
- solace_agent_mesh/orchestrator/components/orchestrator_action_response_component.py +0 -179
- solace_agent_mesh/orchestrator/components/orchestrator_register_component.py +0 -107
- solace_agent_mesh/orchestrator/components/orchestrator_stimulus_processor_component.py +0 -527
- solace_agent_mesh/orchestrator/components/orchestrator_streaming_output_component.py +0 -260
- solace_agent_mesh/orchestrator/orchestrator_main.py +0 -172
- solace_agent_mesh/orchestrator/orchestrator_prompt.py +0 -539
- solace_agent_mesh/services/__init__.py +0 -0
- solace_agent_mesh/services/authorization/providers/base_authorization_provider.py +0 -56
- solace_agent_mesh/services/bamboo_hr_service/__init__.py +0 -3
- solace_agent_mesh/services/bamboo_hr_service/bamboo_hr.py +0 -182
- solace_agent_mesh/services/common/__init__.py +0 -4
- solace_agent_mesh/services/common/auto_expiry.py +0 -45
- solace_agent_mesh/services/common/singleton.py +0 -18
- solace_agent_mesh/services/file_service/__init__.py +0 -14
- solace_agent_mesh/services/file_service/file_manager/__init__.py +0 -0
- solace_agent_mesh/services/file_service/file_manager/bucket_file_manager.py +0 -149
- solace_agent_mesh/services/file_service/file_manager/file_manager_base.py +0 -162
- solace_agent_mesh/services/file_service/file_manager/memory_file_manager.py +0 -64
- solace_agent_mesh/services/file_service/file_manager/volume_file_manager.py +0 -106
- solace_agent_mesh/services/file_service/file_service.py +0 -437
- solace_agent_mesh/services/file_service/file_service_constants.py +0 -54
- solace_agent_mesh/services/file_service/file_transformations.py +0 -141
- solace_agent_mesh/services/file_service/file_utils.py +0 -324
- solace_agent_mesh/services/file_service/transformers/__init__.py +0 -5
- solace_agent_mesh/services/history_service/__init__.py +0 -3
- solace_agent_mesh/services/history_service/history_providers/__init__.py +0 -0
- solace_agent_mesh/services/history_service/history_providers/base_history_provider.py +0 -54
- solace_agent_mesh/services/history_service/history_providers/file_history_provider.py +0 -74
- solace_agent_mesh/services/history_service/history_providers/index.py +0 -40
- solace_agent_mesh/services/history_service/history_providers/memory_history_provider.py +0 -33
- solace_agent_mesh/services/history_service/history_providers/mongodb_history_provider.py +0 -66
- solace_agent_mesh/services/history_service/history_providers/redis_history_provider.py +0 -66
- solace_agent_mesh/services/history_service/history_providers/sql_history_provider.py +0 -93
- solace_agent_mesh/services/history_service/history_service.py +0 -413
- solace_agent_mesh/services/history_service/long_term_memory/__init__.py +0 -0
- solace_agent_mesh/services/history_service/long_term_memory/long_term_memory.py +0 -399
- solace_agent_mesh/services/llm_service/components/llm_request_component.py +0 -340
- solace_agent_mesh/services/llm_service/components/llm_service_component_base.py +0 -152
- solace_agent_mesh/services/middleware_service/__init__.py +0 -0
- solace_agent_mesh/services/middleware_service/middleware_service.py +0 -20
- solace_agent_mesh/templates/action.py +0 -38
- solace_agent_mesh/templates/agent.py +0 -29
- solace_agent_mesh/templates/agent.yaml +0 -70
- solace_agent_mesh/templates/gateway-config-template.yaml +0 -6
- solace_agent_mesh/templates/gateway-default-config.yaml +0 -28
- solace_agent_mesh/templates/gateway-flows.yaml +0 -78
- solace_agent_mesh/templates/gateway-header.yaml +0 -16
- solace_agent_mesh/templates/gateway_base.py +0 -15
- solace_agent_mesh/templates/gateway_input.py +0 -98
- solace_agent_mesh/templates/gateway_output.py +0 -71
- solace_agent_mesh/templates/plugin-gateway-default-config.yaml +0 -29
- solace_agent_mesh/templates/plugin-pyproject.toml +0 -30
- solace_agent_mesh/templates/rest-api-default-config.yaml +0 -31
- solace_agent_mesh/templates/rest-api-flows.yaml +0 -81
- solace_agent_mesh/templates/slack-default-config.yaml +0 -16
- solace_agent_mesh/templates/slack-flows.yaml +0 -81
- solace_agent_mesh/templates/solace-agent-mesh-default.yaml +0 -86
- solace_agent_mesh/templates/solace-agent-mesh-plugin-default.yaml +0 -8
- solace_agent_mesh/templates/web-default-config.yaml +0 -10
- solace_agent_mesh/templates/web-flows.yaml +0 -76
- solace_agent_mesh/tools/__init__.py +0 -0
- solace_agent_mesh/tools/components/__init__.py +0 -0
- solace_agent_mesh/tools/components/conversation_formatter.py +0 -111
- solace_agent_mesh/tools/components/file_resolver_component.py +0 -58
- solace_agent_mesh/tools/config/runtime_config.py +0 -26
- solace_agent_mesh-0.2.3.dist-info/METADATA +0 -172
- solace_agent_mesh-0.2.3.dist-info/RECORD +0 -193
- solace_agent_mesh-0.2.3.dist-info/entry_points.txt +0 -3
- /solace_agent_mesh/{agents → agent}/__init__.py +0 -0
- /solace_agent_mesh/{agents/global → agent/adk}/__init__.py +0 -0
- /solace_agent_mesh/{agents/global/actions → agent/protocol}/__init__.py +0 -0
- /solace_agent_mesh/{agents/image_processing → agent/sac}/__init__.py +0 -0
- /solace_agent_mesh/{agents/image_processing/actions → agent/utils}/__init__.py +0 -0
- /solace_agent_mesh/{agents/web_request → config_portal/backend/plugin_catalog}/__init__.py +0 -0
- /solace_agent_mesh/{agents/web_request/actions → evaluation}/__init__.py +0 -0
- /solace_agent_mesh/gateway/{components → http_sse}/__init__.py +0 -0
- {solace_agent_mesh-0.2.3.dist-info → solace_agent_mesh-1.0.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handles ADK Agent and Runner initialization, including tool loading and callback assignment.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Dict, List, Optional, Union, Callable, Tuple, Set
|
|
6
|
+
import functools
|
|
7
|
+
import inspect
|
|
8
|
+
from solace_ai_connector.common.log import log
|
|
9
|
+
from solace_ai_connector.common.utils import import_module
|
|
10
|
+
|
|
11
|
+
from .app_llm_agent import AppLlmAgent
|
|
12
|
+
from .tool_wrapper import ADKToolWrapper
|
|
13
|
+
from google.adk.runners import Runner
|
|
14
|
+
from google.adk.models import BaseLlm
|
|
15
|
+
from google.adk.tools import BaseTool, ToolContext
|
|
16
|
+
from google.adk import tools as adk_tools_module
|
|
17
|
+
from google.adk.agents.callback_context import CallbackContext
|
|
18
|
+
from google.adk.models.llm_request import LlmRequest
|
|
19
|
+
from google.adk.models.llm_response import LlmResponse
|
|
20
|
+
from google.adk.tools.mcp_tool import MCPToolset
|
|
21
|
+
from google.adk.tools.mcp_tool.mcp_session_manager import SseServerParams, StdioConnectionParams
|
|
22
|
+
|
|
23
|
+
from mcp import StdioServerParameters
|
|
24
|
+
|
|
25
|
+
from ..tools.registry import tool_registry
|
|
26
|
+
from ..tools.tool_definition import BuiltinTool
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
from ...agent.adk import callbacks as adk_callbacks
|
|
30
|
+
from ...agent.adk.models.lite_llm import LiteLlm
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
async def load_adk_tools(
|
|
34
|
+
component,
|
|
35
|
+
) -> Tuple[List[Union[BaseTool, Callable]], List[BuiltinTool]]:
|
|
36
|
+
"""
|
|
37
|
+
Loads all configured tools for the agent.
|
|
38
|
+
- Explicitly configured tools (Python, MCP, ADK Built-ins) from YAML.
|
|
39
|
+
- SAM Built-in tools (Artifact, Data, etc.) from the tool registry,
|
|
40
|
+
filtered by agent configuration.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
component: The SamAgentComponent instance.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
A tuple containing:
|
|
47
|
+
- A list of loaded tool callables/instances for the ADK agent.
|
|
48
|
+
- A list of enabled BuiltinTool definition objects for prompt generation.
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
ImportError: If a configured tool or its dependencies cannot be loaded.
|
|
52
|
+
"""
|
|
53
|
+
loaded_tools: List[Union[BaseTool, Callable]] = []
|
|
54
|
+
enabled_builtin_tools: List[BuiltinTool] = []
|
|
55
|
+
loaded_tool_names: Set[str] = set()
|
|
56
|
+
tools_config = component.get_config("tools", [])
|
|
57
|
+
|
|
58
|
+
if not tools_config:
|
|
59
|
+
log.info(
|
|
60
|
+
"%s No explicit tools configured in 'tools' list.", component.log_identifier
|
|
61
|
+
)
|
|
62
|
+
else:
|
|
63
|
+
log.info(
|
|
64
|
+
"%s Loading tools from 'tools' list configuration...",
|
|
65
|
+
component.log_identifier,
|
|
66
|
+
)
|
|
67
|
+
for tool_config in tools_config:
|
|
68
|
+
tool_type = tool_config.get("tool_type", "").lower()
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
if tool_type == "python":
|
|
72
|
+
module_name = tool_config.get("component_module")
|
|
73
|
+
function_name = tool_config.get("function_name")
|
|
74
|
+
tool_name = tool_config.get("tool_name")
|
|
75
|
+
tool_description = tool_config.get("tool_description")
|
|
76
|
+
base_path = tool_config.get("component_base_path")
|
|
77
|
+
if not module_name or not function_name:
|
|
78
|
+
raise ValueError(
|
|
79
|
+
"'component_module' and 'function_name' required for python tool."
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
module = import_module(module_name, base_path=base_path)
|
|
83
|
+
func = getattr(module, function_name)
|
|
84
|
+
if not callable(func):
|
|
85
|
+
raise TypeError(
|
|
86
|
+
f"'{function_name}' in module '{module_name}' is not callable."
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
specific_tool_config = tool_config.get("tool_config")
|
|
90
|
+
tool_callable = ADKToolWrapper(
|
|
91
|
+
func,
|
|
92
|
+
specific_tool_config,
|
|
93
|
+
function_name,
|
|
94
|
+
raw_string_args=tool_config.get("raw_string_args", []),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
if tool_name:
|
|
98
|
+
function_name = tool_name
|
|
99
|
+
tool_callable.__name__ = tool_name
|
|
100
|
+
|
|
101
|
+
if tool_description:
|
|
102
|
+
tool_callable.__doc__ = tool_description
|
|
103
|
+
|
|
104
|
+
if function_name not in loaded_tool_names:
|
|
105
|
+
loaded_tools.append(tool_callable)
|
|
106
|
+
loaded_tool_names.add(function_name)
|
|
107
|
+
log.info(
|
|
108
|
+
"%s Loaded Python tool: %s from %s.",
|
|
109
|
+
component.log_identifier,
|
|
110
|
+
function_name,
|
|
111
|
+
module_name,
|
|
112
|
+
)
|
|
113
|
+
else:
|
|
114
|
+
log.debug(
|
|
115
|
+
"%s Python tool '%s' already loaded. Skipping duplicate.",
|
|
116
|
+
component.log_identifier,
|
|
117
|
+
function_name,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
elif tool_type == "builtin":
|
|
121
|
+
tool_name = tool_config.get("tool_name")
|
|
122
|
+
if not tool_name:
|
|
123
|
+
raise ValueError("'tool_name' required for builtin tool.")
|
|
124
|
+
|
|
125
|
+
if tool_name in loaded_tool_names:
|
|
126
|
+
log.debug(
|
|
127
|
+
"%s Tool '%s' already loaded. Skipping duplicate.",
|
|
128
|
+
component.log_identifier,
|
|
129
|
+
tool_name,
|
|
130
|
+
)
|
|
131
|
+
continue
|
|
132
|
+
|
|
133
|
+
sam_tool_def = tool_registry.get_tool_by_name(tool_name)
|
|
134
|
+
if sam_tool_def:
|
|
135
|
+
specific_tool_config = tool_config.get("tool_config")
|
|
136
|
+
tool_callable = ADKToolWrapper(
|
|
137
|
+
sam_tool_def.implementation,
|
|
138
|
+
specific_tool_config,
|
|
139
|
+
sam_tool_def.name,
|
|
140
|
+
raw_string_args=sam_tool_def.raw_string_args,
|
|
141
|
+
)
|
|
142
|
+
loaded_tools.append(tool_callable)
|
|
143
|
+
enabled_builtin_tools.append(sam_tool_def)
|
|
144
|
+
loaded_tool_names.add(sam_tool_def.name)
|
|
145
|
+
log.info(
|
|
146
|
+
"%s Loaded SAM built-in tool: %s",
|
|
147
|
+
component.log_identifier,
|
|
148
|
+
sam_tool_def.name,
|
|
149
|
+
)
|
|
150
|
+
continue
|
|
151
|
+
|
|
152
|
+
adk_tool = getattr(adk_tools_module, tool_name, None)
|
|
153
|
+
if adk_tool and isinstance(adk_tool, (BaseTool, Callable)):
|
|
154
|
+
loaded_tools.append(adk_tool)
|
|
155
|
+
loaded_tool_names.add(tool_name)
|
|
156
|
+
log.info(
|
|
157
|
+
"%s Loaded ADK built-in tool: %s",
|
|
158
|
+
component.log_identifier,
|
|
159
|
+
tool_name,
|
|
160
|
+
)
|
|
161
|
+
continue
|
|
162
|
+
|
|
163
|
+
raise ValueError(
|
|
164
|
+
f"Built-in tool '{tool_name}' not found in SAM or ADK registry."
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
elif tool_type == "builtin-group":
|
|
168
|
+
group_name = tool_config.get("group_name")
|
|
169
|
+
if not group_name:
|
|
170
|
+
raise ValueError("'group_name' required for builtin-group.")
|
|
171
|
+
|
|
172
|
+
tools_in_group = tool_registry.get_tools_by_category(group_name)
|
|
173
|
+
if not tools_in_group:
|
|
174
|
+
log.warning("No tools found for built-in group: %s", group_name)
|
|
175
|
+
continue
|
|
176
|
+
|
|
177
|
+
initializers_to_run: Dict[Callable, Dict] = {}
|
|
178
|
+
for tool_def in tools_in_group:
|
|
179
|
+
if (
|
|
180
|
+
tool_def.initializer
|
|
181
|
+
and tool_def.initializer not in initializers_to_run
|
|
182
|
+
):
|
|
183
|
+
initializers_to_run[tool_def.initializer] = tool_config.get(
|
|
184
|
+
"config", {}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
for init_func, init_config in initializers_to_run.items():
|
|
188
|
+
try:
|
|
189
|
+
log.info(
|
|
190
|
+
"%s Running initializer '%s' for tool group '%s'.",
|
|
191
|
+
component.log_identifier,
|
|
192
|
+
init_func.__name__,
|
|
193
|
+
group_name,
|
|
194
|
+
)
|
|
195
|
+
init_func(component, init_config)
|
|
196
|
+
log.info(
|
|
197
|
+
"%s Successfully executed initializer '%s' for tool group '%s'.",
|
|
198
|
+
component.log_identifier,
|
|
199
|
+
init_func.__name__,
|
|
200
|
+
group_name,
|
|
201
|
+
)
|
|
202
|
+
except Exception as e:
|
|
203
|
+
log.exception(
|
|
204
|
+
"%s Failed to run initializer '%s' for tool group '%s': %s",
|
|
205
|
+
component.log_identifier,
|
|
206
|
+
init_func.__name__,
|
|
207
|
+
group_name,
|
|
208
|
+
e,
|
|
209
|
+
)
|
|
210
|
+
raise e
|
|
211
|
+
|
|
212
|
+
group_tool_count = 0
|
|
213
|
+
for tool_def in tools_in_group:
|
|
214
|
+
if tool_def.name not in loaded_tool_names:
|
|
215
|
+
specific_tool_config = tool_config.get(
|
|
216
|
+
"tool_configs", {}
|
|
217
|
+
).get(tool_def.name)
|
|
218
|
+
tool_callable = ADKToolWrapper(
|
|
219
|
+
tool_def.implementation,
|
|
220
|
+
specific_tool_config,
|
|
221
|
+
tool_def.name,
|
|
222
|
+
raw_string_args=tool_def.raw_string_args,
|
|
223
|
+
)
|
|
224
|
+
loaded_tools.append(tool_callable)
|
|
225
|
+
enabled_builtin_tools.append(tool_def)
|
|
226
|
+
loaded_tool_names.add(tool_def.name)
|
|
227
|
+
group_tool_count += 1
|
|
228
|
+
log.info(
|
|
229
|
+
"Loaded %d tools from built-in group: %s",
|
|
230
|
+
group_tool_count,
|
|
231
|
+
group_name,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
elif tool_type == "mcp":
|
|
235
|
+
tool_name = tool_config.get("tool_name")
|
|
236
|
+
if not tool_name:
|
|
237
|
+
log.info(
|
|
238
|
+
"%s No specific 'tool_name' for MCP tool, will load all tools from server unless tool_filter is specified in MCPToolset itself.",
|
|
239
|
+
component.log_identifier,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
connection_params_config = tool_config.get("connection_params")
|
|
243
|
+
if not connection_params_config:
|
|
244
|
+
raise ValueError("'connection_params' required for mcp tool.")
|
|
245
|
+
|
|
246
|
+
connection_type = connection_params_config.get("type", "").lower()
|
|
247
|
+
connection_args = {
|
|
248
|
+
k: v for k, v in connection_params_config.items() if k != "type"
|
|
249
|
+
}
|
|
250
|
+
connection_args["timeout"] = connection_args.get("timeout", 30)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
environment_variables = tool_config.get("environment_variables")
|
|
254
|
+
env_param = {}
|
|
255
|
+
if connection_type == "stdio" and environment_variables:
|
|
256
|
+
if isinstance(environment_variables, dict):
|
|
257
|
+
env_param = environment_variables
|
|
258
|
+
log.debug(
|
|
259
|
+
"%s Found environment_variables for stdio MCP tool.",
|
|
260
|
+
component.log_identifier,
|
|
261
|
+
)
|
|
262
|
+
else:
|
|
263
|
+
log.warning(
|
|
264
|
+
"%s 'environment_variables' provided for stdio MCP tool but it is not a dictionary. Ignoring.",
|
|
265
|
+
component.log_identifier,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
if connection_type == "stdio":
|
|
269
|
+
cmd_arg = connection_args.get("command")
|
|
270
|
+
args_list = connection_args.get("args", [])
|
|
271
|
+
if isinstance(cmd_arg, list):
|
|
272
|
+
command_str = " ".join(cmd_arg)
|
|
273
|
+
elif isinstance(cmd_arg, str):
|
|
274
|
+
command_str = cmd_arg
|
|
275
|
+
else:
|
|
276
|
+
raise ValueError(
|
|
277
|
+
f"MCP tool 'command' parameter must be a string or a list of strings, got {type(cmd_arg)}"
|
|
278
|
+
)
|
|
279
|
+
if not isinstance(args_list, list):
|
|
280
|
+
raise ValueError(
|
|
281
|
+
f"MCP tool 'args' parameter must be a list, got {type(args_list)}"
|
|
282
|
+
)
|
|
283
|
+
final_connection_args = {
|
|
284
|
+
k: v
|
|
285
|
+
for k, v in connection_args.items()
|
|
286
|
+
if k not in ["command", "args", "timeout"]
|
|
287
|
+
}
|
|
288
|
+
connection_params = StdioConnectionParams(
|
|
289
|
+
server_params=StdioServerParameters(
|
|
290
|
+
command=command_str,
|
|
291
|
+
args=args_list,
|
|
292
|
+
**final_connection_args,
|
|
293
|
+
env=env_param if env_param else None,
|
|
294
|
+
),
|
|
295
|
+
timeout=connection_args.get("timeout")
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
elif connection_type == "sse":
|
|
299
|
+
connection_params = SseServerParams(**connection_args)
|
|
300
|
+
else:
|
|
301
|
+
raise ValueError(
|
|
302
|
+
f"Unsupported MCP connection type: {connection_type}"
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
tool_filter_list = [tool_name] if tool_name else None
|
|
306
|
+
if tool_filter_list:
|
|
307
|
+
log.info(
|
|
308
|
+
"%s MCP tool config specifies tool_name: '%s'. Applying as tool_filter.",
|
|
309
|
+
component.log_identifier,
|
|
310
|
+
tool_name,
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
mcp_toolset_instance = MCPToolset(
|
|
314
|
+
connection_params=connection_params,
|
|
315
|
+
tool_filter=tool_filter_list,
|
|
316
|
+
)
|
|
317
|
+
loaded_tools.append(mcp_toolset_instance)
|
|
318
|
+
log.info(
|
|
319
|
+
"%s Initialized MCPToolset (filter: %s) for server: %s",
|
|
320
|
+
component.log_identifier,
|
|
321
|
+
(tool_filter_list if tool_filter_list else "none (all tools)"),
|
|
322
|
+
connection_params,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
else:
|
|
326
|
+
log.warning(
|
|
327
|
+
"%s Unknown tool type '%s' in config: %s",
|
|
328
|
+
component.log_identifier,
|
|
329
|
+
tool_type,
|
|
330
|
+
tool_config,
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
except Exception as e:
|
|
334
|
+
log.error(
|
|
335
|
+
"%s Failed to load tool config %s: %s",
|
|
336
|
+
component.log_identifier,
|
|
337
|
+
tool_config,
|
|
338
|
+
e,
|
|
339
|
+
)
|
|
340
|
+
raise e
|
|
341
|
+
|
|
342
|
+
internal_tool_names = ["_notify_artifact_save"]
|
|
343
|
+
if component.get_config("enable_auto_continuation", True):
|
|
344
|
+
internal_tool_names.append("_continue_generation")
|
|
345
|
+
|
|
346
|
+
for tool_name in internal_tool_names:
|
|
347
|
+
if tool_name in loaded_tool_names:
|
|
348
|
+
log.debug(
|
|
349
|
+
"%s Internal tool '%s' was already loaded explicitly. Skipping implicit load.",
|
|
350
|
+
component.log_identifier,
|
|
351
|
+
tool_name,
|
|
352
|
+
)
|
|
353
|
+
continue
|
|
354
|
+
|
|
355
|
+
tool_def = tool_registry.get_tool_by_name(tool_name)
|
|
356
|
+
if tool_def:
|
|
357
|
+
# Wrap the implementation to ensure its description is passed to the LLM
|
|
358
|
+
tool_callable = ADKToolWrapper(
|
|
359
|
+
tool_def.implementation,
|
|
360
|
+
None, # No specific config for internal tools
|
|
361
|
+
tool_def.name,
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
tool_callable.__doc__ = tool_def.description
|
|
365
|
+
|
|
366
|
+
loaded_tools.append(tool_callable)
|
|
367
|
+
enabled_builtin_tools.append(tool_def)
|
|
368
|
+
loaded_tool_names.add(tool_def.name)
|
|
369
|
+
log.info(
|
|
370
|
+
"%s Implicitly loaded internal framework tool: %s",
|
|
371
|
+
component.log_identifier,
|
|
372
|
+
tool_def.name,
|
|
373
|
+
)
|
|
374
|
+
else:
|
|
375
|
+
log.warning(
|
|
376
|
+
"%s Could not find internal framework tool '%s' in registry. Related features may not work.",
|
|
377
|
+
component.log_identifier,
|
|
378
|
+
tool_name,
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
log.info(
|
|
382
|
+
"%s Finished loading tools. Total tools for ADK: %d. Total SAM built-ins for prompt: %d. Peer tools added dynamically.",
|
|
383
|
+
component.log_identifier,
|
|
384
|
+
len(loaded_tools),
|
|
385
|
+
len(enabled_builtin_tools),
|
|
386
|
+
)
|
|
387
|
+
return loaded_tools, enabled_builtin_tools
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def initialize_adk_agent(
|
|
391
|
+
component,
|
|
392
|
+
loaded_explicit_tools: List[Union[BaseTool, Callable]],
|
|
393
|
+
enabled_builtin_tools: List[BuiltinTool],
|
|
394
|
+
) -> AppLlmAgent:
|
|
395
|
+
"""
|
|
396
|
+
Initializes the ADK LlmAgent based on component configuration.
|
|
397
|
+
Assigns callbacks for peer tool injection, dynamic instruction injection,
|
|
398
|
+
artifact metadata injection, embed resolution, and logging.
|
|
399
|
+
|
|
400
|
+
Args:
|
|
401
|
+
component: The A2A_ADK_HostComponent instance.
|
|
402
|
+
loaded_explicit_tools: The list of pre-loaded non-peer tools.
|
|
403
|
+
|
|
404
|
+
Returns:
|
|
405
|
+
An initialized LlmAgent instance.
|
|
406
|
+
|
|
407
|
+
Raises:
|
|
408
|
+
ValueError: If configuration is invalid.
|
|
409
|
+
ImportError: If required dependencies are missing.
|
|
410
|
+
Exception: For other initialization errors.
|
|
411
|
+
"""
|
|
412
|
+
agent_name = component.get_config("agent_name")
|
|
413
|
+
log.info(
|
|
414
|
+
"%s Initializing ADK Agent '%s' (Peer tools & instructions added via callback)...",
|
|
415
|
+
component.log_identifier,
|
|
416
|
+
agent_name,
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
model_config = component.get_config("model")
|
|
420
|
+
adk_model_instance: Union[str, BaseLlm]
|
|
421
|
+
if isinstance(model_config, str):
|
|
422
|
+
adk_model_instance = model_config
|
|
423
|
+
elif isinstance(model_config, dict):
|
|
424
|
+
if model_config.get("type") is None:
|
|
425
|
+
# Use setdefault to add keys only if they are not already present in the YAML
|
|
426
|
+
model_config.setdefault("num_retries", 3)
|
|
427
|
+
model_config.setdefault("timeout", 120)
|
|
428
|
+
log.info(
|
|
429
|
+
"%s Applying default resilience settings for LiteLlm model (num_retries=%s, timeout=%s). These can be overridden in YAML.",
|
|
430
|
+
component.log_identifier,
|
|
431
|
+
model_config["num_retries"],
|
|
432
|
+
model_config["timeout"],
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
try:
|
|
436
|
+
|
|
437
|
+
adk_model_instance = LiteLlm(**model_config)
|
|
438
|
+
log.info(
|
|
439
|
+
"%s Initialized LiteLlm model: %s",
|
|
440
|
+
component.log_identifier,
|
|
441
|
+
model_config.get("model"),
|
|
442
|
+
)
|
|
443
|
+
except ImportError:
|
|
444
|
+
log.error(
|
|
445
|
+
"%s LiteLlm dependency not found. Cannot use dictionary model config.",
|
|
446
|
+
component.log_identifier,
|
|
447
|
+
)
|
|
448
|
+
raise
|
|
449
|
+
except Exception as e:
|
|
450
|
+
log.error(
|
|
451
|
+
"%s Failed to initialize model from dictionary config: %s",
|
|
452
|
+
component.log_identifier,
|
|
453
|
+
e,
|
|
454
|
+
)
|
|
455
|
+
raise
|
|
456
|
+
else:
|
|
457
|
+
raise ValueError(
|
|
458
|
+
f"{component.log_identifier} Invalid 'model' configuration type: {type(model_config)}"
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
instruction = component._resolve_instruction_provider(
|
|
462
|
+
component.get_config("instruction", "")
|
|
463
|
+
)
|
|
464
|
+
global_instruction = component._resolve_instruction_provider(
|
|
465
|
+
component.get_config("global_instruction", "")
|
|
466
|
+
)
|
|
467
|
+
planner = component.get_config("planner")
|
|
468
|
+
code_executor = component.get_config("code_executor")
|
|
469
|
+
|
|
470
|
+
try:
|
|
471
|
+
agent = AppLlmAgent(
|
|
472
|
+
name=agent_name,
|
|
473
|
+
model=adk_model_instance,
|
|
474
|
+
instruction=instruction,
|
|
475
|
+
global_instruction=global_instruction,
|
|
476
|
+
tools=loaded_explicit_tools,
|
|
477
|
+
planner=planner,
|
|
478
|
+
code_executor=code_executor,
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
agent.host_component = component
|
|
482
|
+
log.debug(
|
|
483
|
+
"%s Attached host_component reference to AppLlmAgent.",
|
|
484
|
+
component.log_identifier,
|
|
485
|
+
)
|
|
486
|
+
callbacks_in_order_for_before_model = []
|
|
487
|
+
|
|
488
|
+
callbacks_in_order_for_before_model.append(
|
|
489
|
+
adk_callbacks.repair_history_callback
|
|
490
|
+
)
|
|
491
|
+
log.info(
|
|
492
|
+
"%s Added repair_history_callback to before_model chain.",
|
|
493
|
+
component.log_identifier,
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
if hasattr(component, "_inject_peer_tools_callback"):
|
|
497
|
+
callbacks_in_order_for_before_model.append(
|
|
498
|
+
component._inject_peer_tools_callback
|
|
499
|
+
)
|
|
500
|
+
log.info(
|
|
501
|
+
"%s Added _inject_peer_tools_callback to before_model chain.",
|
|
502
|
+
component.log_identifier,
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
if hasattr(component, "_filter_tools_by_capability_callback"):
|
|
506
|
+
callbacks_in_order_for_before_model.append(
|
|
507
|
+
component._filter_tools_by_capability_callback
|
|
508
|
+
)
|
|
509
|
+
log.info(
|
|
510
|
+
"%s Added _filter_tools_by_capability_callback to before_model chain.",
|
|
511
|
+
component.log_identifier,
|
|
512
|
+
)
|
|
513
|
+
if hasattr(component, "_inject_gateway_instructions_callback"):
|
|
514
|
+
callbacks_in_order_for_before_model.append(
|
|
515
|
+
component._inject_gateway_instructions_callback
|
|
516
|
+
)
|
|
517
|
+
log.info(
|
|
518
|
+
"%s Added _inject_gateway_instructions_callback to before_model chain.",
|
|
519
|
+
component.log_identifier,
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
dynamic_instruction_callback_with_component = functools.partial(
|
|
523
|
+
adk_callbacks.inject_dynamic_instructions_callback,
|
|
524
|
+
host_component=component,
|
|
525
|
+
active_builtin_tools=enabled_builtin_tools,
|
|
526
|
+
)
|
|
527
|
+
callbacks_in_order_for_before_model.append(
|
|
528
|
+
dynamic_instruction_callback_with_component
|
|
529
|
+
)
|
|
530
|
+
log.info(
|
|
531
|
+
"%s Added inject_dynamic_instructions_callback to before_model chain.",
|
|
532
|
+
component.log_identifier,
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
solace_llm_trigger_callback_with_component = functools.partial(
|
|
536
|
+
adk_callbacks.solace_llm_invocation_callback, host_component=component
|
|
537
|
+
)
|
|
538
|
+
|
|
539
|
+
def final_before_model_wrapper(
|
|
540
|
+
callback_context: CallbackContext, llm_request: LlmRequest
|
|
541
|
+
) -> Optional[LlmResponse]:
|
|
542
|
+
early_response: Optional[LlmResponse] = None
|
|
543
|
+
for cb_func in callbacks_in_order_for_before_model:
|
|
544
|
+
response = cb_func(callback_context, llm_request)
|
|
545
|
+
if response:
|
|
546
|
+
early_response = response
|
|
547
|
+
break
|
|
548
|
+
|
|
549
|
+
solace_llm_trigger_callback_with_component(callback_context, llm_request)
|
|
550
|
+
|
|
551
|
+
if early_response:
|
|
552
|
+
return early_response
|
|
553
|
+
|
|
554
|
+
return None
|
|
555
|
+
|
|
556
|
+
agent.before_model_callback = final_before_model_wrapper
|
|
557
|
+
log.info(
|
|
558
|
+
"%s Final before_model_callback chain (Solace logging now occurs last) assigned to agent.",
|
|
559
|
+
component.log_identifier,
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
tool_invocation_start_cb_with_component = functools.partial(
|
|
563
|
+
adk_callbacks.notify_tool_invocation_start_callback,
|
|
564
|
+
host_component=component,
|
|
565
|
+
)
|
|
566
|
+
agent.before_tool_callback = tool_invocation_start_cb_with_component
|
|
567
|
+
log.info(
|
|
568
|
+
"%s Assigned notify_tool_invocation_start_callback as before_tool_callback.",
|
|
569
|
+
component.log_identifier,
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
large_response_cb_with_component = functools.partial(
|
|
573
|
+
adk_callbacks.manage_large_mcp_tool_responses_callback,
|
|
574
|
+
host_component=component,
|
|
575
|
+
)
|
|
576
|
+
metadata_injection_cb_with_component = functools.partial(
|
|
577
|
+
adk_callbacks.after_tool_callback_inject_metadata, host_component=component
|
|
578
|
+
)
|
|
579
|
+
track_artifacts_cb_with_component = functools.partial(
|
|
580
|
+
adk_callbacks.track_produced_artifacts_callback, host_component=component
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
async def chained_after_tool_callback(
|
|
584
|
+
tool: BaseTool,
|
|
585
|
+
args: Dict,
|
|
586
|
+
tool_context: ToolContext,
|
|
587
|
+
tool_response: Dict,
|
|
588
|
+
) -> Optional[Dict]:
|
|
589
|
+
log.debug(
|
|
590
|
+
"%s Tool callback chain started for tool: %s, response type: %s",
|
|
591
|
+
component.log_identifier,
|
|
592
|
+
tool.name,
|
|
593
|
+
type(tool_response).__name__,
|
|
594
|
+
)
|
|
595
|
+
|
|
596
|
+
try:
|
|
597
|
+
processed_by_large_handler = await large_response_cb_with_component(
|
|
598
|
+
tool, args, tool_context, tool_response
|
|
599
|
+
)
|
|
600
|
+
response_for_metadata_injector = (
|
|
601
|
+
processed_by_large_handler
|
|
602
|
+
if processed_by_large_handler is not None
|
|
603
|
+
else tool_response
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
final_response_after_metadata = (
|
|
607
|
+
await metadata_injection_cb_with_component(
|
|
608
|
+
tool, args, tool_context, response_for_metadata_injector
|
|
609
|
+
)
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
final_result = (
|
|
613
|
+
final_response_after_metadata
|
|
614
|
+
if final_response_after_metadata is not None
|
|
615
|
+
else response_for_metadata_injector
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
# Track produced artifacts. This callback does not modify the response.
|
|
619
|
+
await track_artifacts_cb_with_component(
|
|
620
|
+
tool, args, tool_context, final_result
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
log.debug(
|
|
624
|
+
"%s Tool callback chain completed for tool: %s, final response type: %s",
|
|
625
|
+
component.log_identifier,
|
|
626
|
+
tool.name,
|
|
627
|
+
type(final_result).__name__,
|
|
628
|
+
)
|
|
629
|
+
|
|
630
|
+
return final_result
|
|
631
|
+
|
|
632
|
+
except Exception as e:
|
|
633
|
+
log.exception(
|
|
634
|
+
"%s Error in tool callback chain for tool %s: %s",
|
|
635
|
+
component.log_identifier,
|
|
636
|
+
tool.name,
|
|
637
|
+
e,
|
|
638
|
+
)
|
|
639
|
+
return tool_response
|
|
640
|
+
|
|
641
|
+
agent.after_tool_callback = chained_after_tool_callback
|
|
642
|
+
log.info(
|
|
643
|
+
"%s Chained 'manage_large_mcp_tool_responses_callback' and 'after_tool_callback_inject_metadata' as after_tool_callback.",
|
|
644
|
+
component.log_identifier,
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
# --- After Model Callbacks Chain ---
|
|
648
|
+
# The callbacks are executed in the order they are added to this list.
|
|
649
|
+
callbacks_in_order_for_after_model = []
|
|
650
|
+
|
|
651
|
+
# 1. Fenced Artifact Block Processing (must run before auto-continue)
|
|
652
|
+
artifact_block_cb = functools.partial(
|
|
653
|
+
adk_callbacks.process_artifact_blocks_callback, host_component=component
|
|
654
|
+
)
|
|
655
|
+
callbacks_in_order_for_after_model.append(artifact_block_cb)
|
|
656
|
+
log.info(
|
|
657
|
+
"%s Added process_artifact_blocks_callback to after_model chain.",
|
|
658
|
+
component.log_identifier,
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
# 2. Auto-Continuation (may short-circuit the chain)
|
|
662
|
+
auto_continue_cb = functools.partial(
|
|
663
|
+
adk_callbacks.auto_continue_on_max_tokens_callback, host_component=component
|
|
664
|
+
)
|
|
665
|
+
callbacks_in_order_for_after_model.append(auto_continue_cb)
|
|
666
|
+
log.info(
|
|
667
|
+
"%s Added auto_continue_on_max_tokens_callback to after_model chain.",
|
|
668
|
+
component.log_identifier,
|
|
669
|
+
)
|
|
670
|
+
|
|
671
|
+
# 3. Solace LLM Response Logging
|
|
672
|
+
solace_llm_response_cb = functools.partial(
|
|
673
|
+
adk_callbacks.solace_llm_response_callback, host_component=component
|
|
674
|
+
)
|
|
675
|
+
callbacks_in_order_for_after_model.append(solace_llm_response_cb)
|
|
676
|
+
|
|
677
|
+
# 4. Chunk Logging
|
|
678
|
+
log_chunk_cb = functools.partial(
|
|
679
|
+
adk_callbacks.log_streaming_chunk_callback, host_component=component
|
|
680
|
+
)
|
|
681
|
+
callbacks_in_order_for_after_model.append(log_chunk_cb)
|
|
682
|
+
|
|
683
|
+
async def final_after_model_wrapper(
|
|
684
|
+
callback_context: CallbackContext, llm_response: LlmResponse
|
|
685
|
+
) -> Optional[LlmResponse]:
|
|
686
|
+
for cb_func in callbacks_in_order_for_after_model:
|
|
687
|
+
# Await async callbacks, call sync callbacks
|
|
688
|
+
if inspect.iscoroutinefunction(cb_func):
|
|
689
|
+
response = await cb_func(callback_context, llm_response)
|
|
690
|
+
else:
|
|
691
|
+
response = cb_func(callback_context, llm_response)
|
|
692
|
+
|
|
693
|
+
# If a callback returns a response, it hijacks the flow.
|
|
694
|
+
if response:
|
|
695
|
+
return response
|
|
696
|
+
return None
|
|
697
|
+
|
|
698
|
+
agent.after_model_callback = final_after_model_wrapper
|
|
699
|
+
log.info(
|
|
700
|
+
"%s Chained all after_model_callbacks and assigned to agent.",
|
|
701
|
+
component.log_identifier,
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
log.info(
|
|
705
|
+
"%s ADK Agent '%s' created. Callbacks assigned.",
|
|
706
|
+
component.log_identifier,
|
|
707
|
+
agent_name,
|
|
708
|
+
)
|
|
709
|
+
return agent
|
|
710
|
+
except Exception as e:
|
|
711
|
+
log.error(
|
|
712
|
+
"%s Failed to create ADK Agent '%s': %s",
|
|
713
|
+
component.log_identifier,
|
|
714
|
+
agent_name,
|
|
715
|
+
e,
|
|
716
|
+
)
|
|
717
|
+
raise
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
def initialize_adk_runner(component) -> Runner:
|
|
721
|
+
"""
|
|
722
|
+
Initializes the ADK Runner.
|
|
723
|
+
|
|
724
|
+
Args:
|
|
725
|
+
component: The A2A_ADK_HostComponent instance.
|
|
726
|
+
|
|
727
|
+
Returns:
|
|
728
|
+
An initialized Runner instance.
|
|
729
|
+
|
|
730
|
+
Raises:
|
|
731
|
+
Exception: For runner initialization errors.
|
|
732
|
+
"""
|
|
733
|
+
agent_name = component.get_config("agent_name")
|
|
734
|
+
log.info(
|
|
735
|
+
"%s Initializing ADK Runner for agent '%s'...",
|
|
736
|
+
component.log_identifier,
|
|
737
|
+
agent_name,
|
|
738
|
+
)
|
|
739
|
+
try:
|
|
740
|
+
runner = Runner(
|
|
741
|
+
app_name=agent_name,
|
|
742
|
+
agent=component.adk_agent,
|
|
743
|
+
session_service=component.session_service,
|
|
744
|
+
artifact_service=component.artifact_service,
|
|
745
|
+
memory_service=component.memory_service,
|
|
746
|
+
)
|
|
747
|
+
log.info("%s ADK Runner created successfully.", component.log_identifier)
|
|
748
|
+
return runner
|
|
749
|
+
except Exception as e:
|
|
750
|
+
log.error("%s Failed to create ADK Runner: %s", component.log_identifier, e)
|
|
751
|
+
raise
|