diff --git a/pyproject.toml b/pyproject.toml index f50b9557..c6b0bcde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "sap-cloud-sdk" -version = "0.45.0" +version = "0.45.1" description = "SAP Cloud SDK for Python" readme = "README.md" license = "Apache-2.0" diff --git a/src/sap_cloud_sdk/extensibility/client.py b/src/sap_cloud_sdk/extensibility/client.py index 3e317236..d6deda28 100644 --- a/src/sap_cloud_sdk/extensibility/client.py +++ b/src/sap_cloud_sdk/extensibility/client.py @@ -199,6 +199,7 @@ def get_extension_capability_implementation( tenant="1d2e1a41-a28b-431f-9e3f-42e9704bfa75", ) """ + logger.info("Fetching extension capabilities for tenant=%s", tenant) try: return self._transport.get_extension_capability_implementation( capability_id=capability_id, @@ -415,6 +416,7 @@ async def _discover_n8n_tools( f"MCP tool '{_EXECUTE_WORKFLOW_TOOL_NAME}' on server '{_N8N_MCP_SERVER_NAME}' " "not found via Agent Gateway." ) + logger.info("Fetched n8n execute_tool: %s", _EXECUTE_WORKFLOW_TOOL_NAME) get_exec_tool = next( ( @@ -430,6 +432,7 @@ async def _discover_n8n_tools( f"MCP tool '{_GET_EXECUTION_TOOL_NAME}' on server '{_N8N_MCP_SERVER_NAME}' " "not found via Agent Gateway." ) + logger.info("Fetched n8n get_exec_tool: %s", _GET_EXECUTION_TOOL_NAME) return execute_tool, get_exec_tool @@ -455,6 +458,7 @@ async def _execute_workflow_via_agw( }, }, } + logger.info("Executing workflow id=%s", hook.n8n_workflow_config.workflow_id) try: result_str = await agw_client.call_mcp_tool( execute_tool, @@ -480,6 +484,11 @@ async def _execute_workflow_via_agw( ) execution_id = data.get("executionId") + logger.info( + "Workflow execution complete: execution_id=%s, status=%s", + execution_id, + status, + ) return str(execution_id), status @staticmethod @@ -511,6 +520,11 @@ async def _poll_hook_execution( ) -> Optional[Message]: deadline = time.monotonic() + hook.timeout last_status = initial_status + logger.info( + "Polling for workflow %s execution result (timeout=%ss)", + hook.n8n_workflow_config.workflow_id, + hook.timeout, + ) while time.monotonic() < deadline: await asyncio.sleep(_HOOK_POLL_INTERVAL) @@ -541,6 +555,7 @@ async def _poll_hook_execution( ) if last_status == "success": + logger.info("Execution %s completed successfully", execution_id) return self._extract_message(data) if last_status in _EXECUTION_TERMINAL_STATUSES: @@ -615,12 +630,21 @@ async def call_hook_agw( agw_client = create_agw_client( tenant_subdomain, _telemetry_source=Module.EXTENSIBILITY ) + logger.info( + "AGW client created successfully for tenant_subdomain=%s", tenant_subdomain + ) execute_tool, get_exec_tool = await self._discover_n8n_tools( agw_client, user_token ) + logger.info("Discovered n8n tools") execution_id, status = await self._execute_workflow_via_agw( agw_client, execute_tool, hook, user_token, message, headers ) + logger.info( + "Workflow triggered: execution_id=%s, initial_status=%s", + execution_id, + status, + ) return await self._poll_hook_execution( agw_client, get_exec_tool, hook, execution_id, user_token, status )