feat(extensibility): implement call_hook_agw#156
Open
yashmeet29 wants to merge 21 commits into
Open
Conversation
1. n8n ord id is already a constant 2. made the new call_hook method instance level, removed the comment from the old method 3. agw_client created in cloud sdk, tenant subdomain passed as parameter from agent 4. Caching as a future improvement
Member
Please provide a more detailed description of this pull request using our template pull_request_template.md |
NicoleMGomes
requested changes
Jun 23, 2026
|
|
||
| _EXECUTE_WORKFLOW_TOOL_NAME = "execute_workflow" | ||
| _GET_EXECUTION_TOOL_NAME = "get_execution" | ||
| _N8N_MCP_SERVER_NAME = "sap.btpn8n:apiResource:ManagedN8nMcpServer:v1" |
Contributor
There was a problem hiding this comment.
ORD ID is dynamically discovered using SPII. As far as I know, agent should also have formation with n8n.
Contributor
There was a problem hiding this comment.
Agent does have a formation with n8n, but other mcp servers may also be part of the formation. In that case we need to use the ORD ID to filter through the fragments.
Also this ORD ID will be constant for hooks, they are only using n8n for now
| ), | ||
| None, | ||
| ) | ||
| if execute_tool is None: |
Contributor
There was a problem hiding this comment.
Let's breakdown in functions and organize code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
call_hook_agw, an async method onExtensibilityClientthat calls an n8n hook via the Agent Gateway (AGW) MCP transport, as an alternative to the existingcall_hookmethod which uses a direct HTTP connection.The method:
create_agw_client.(name, server_name)key to matchexecute_workflowandget_executiontools on thesap.btpn8n:apiResource:ManagedN8nMcpServer:v1server specifically.execute_workflowwith the workflow ID, method, body (serialised from the optional Message payload), and headers.Type of Change
Please check the relevant option:
How to Test
Checklist
Additional Notes
call_hook_agwusesOperation.EXTENSIBILITY_CALL_HOOKfor telemetry — the same operation name as the existingcall_hook. This is intentional reuse of a pre-existing enum value; no new telemetry operation was introduced.Tool lookup uses a composite key
(name, server_name)to avoid false matches when multiple MCP servers expose tools with the same name. The server name issap.btpn8n:apiResource:ManagedN8nMcpServer:v1.Two distinct terminal-status sets are used:
_EXECUTE_TERMINAL_STATUSES(checked against the initialexecute_workflowresponse, includes"unknown") and_EXECUTION_TERMINAL_STATUSES(checked during the poll loop, excludes"unknown").11 new unit tests cover: tool-not-found for both tools, composite-key correctness (wrong server ignored, correct tool selected among duplicates), synchronous success, success after polling, terminal status from execute and from poll, timeout, AGW exception propagation, and workflow ID forwarding.