Skip to content

feat(agentgateway): list connected systems and filter MCP tools by GTID - #264

Open
I542102 wants to merge 12 commits into
SAP:mainfrom
I542102:main
Open

feat(agentgateway): list connected systems and filter MCP tools by GTID#264
I542102 wants to merge 12 commits into
SAP:mainfrom
I542102:main

Conversation

@I542102

@I542102 I542102 commented Aug 10, 2026

Copy link
Copy Markdown

Disclaimer: Do not include SAP-internal or customer-specific information in this PR (e.g. internal system URLs, customer names, tenant IDs, or confidential configurations). This is a public repository.

Description

Adds two capabilities to the Agent Gateway LoB flow:

  1. list_active_integrations / list_connected_systems — new client method that reads Destination Service instance fragments to discover which backend systems (e.g. SAP PCE, SAP S/4HANA) are connected for the current subscriber tenant. Returns a list of ConnectedSystem dicts with global_tenant_id, system_type, and integration_dependency.

  2. GTID filter for list_mcp_tools — adds gtids field to MCPToolFilter, forwarded to the Destination Service as a label filter on sap-managed-runtime-gtid, allowing callers to scope MCP tool discovery to specific connected systems.

Key design decisions:

  • FragmentLabel enum moved to _models.py alongside other public data models
  • ConnectedSystem TypedDict replaces ActiveIntegration (more aligned with connectivity semantics)
  • list_active_integrations is LoB-only and raises AgentGatewaySDKError for customer agent flows
  • A2A fragments excluded from the connected-systems filter (MCP-only)

Related Issue

Closes #AFSDK-4288

Type of Change

  • New feature (non-breaking change that adds functionality)

How to Test

  1. Deploy a LoB agent with at least one connected backend system (e.g. SAP PCE destination fragment present)
  2. Call agw_client.list_active_integrations() — expect a list of ConnectedSystem dicts
  3. Use a returned global_tenant_id in MCPToolFilter(gtids=[...]) and call list_mcp_tools() — expect only tools from that system
  4. Call list_active_integrations() from a customer agent — expect AgentGatewaySDKError

Checklist

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Additional Notes

  • ActiveIntegration is kept as a backward-compatible alias in _fragments.py but ConnectedSystem is the canonical export going forward
  • MCPToolFilter.global_tenant_ids renamed to gtids to match the abbreviated form used consistently in labels and docs

I542102 and others added 8 commits August 7, 2026 16:44
…d typed return

- Extract global_tenant_id, system_type, integration_dependency from
  fragment labels instead of parsing the fragment URL
- Rename list_active_integrations to _list_active_integrations (private)
- Add ActiveIntegration TypedDict for strong return type; export it from
  the agentgateway package
- Skip fragments only when system_type label is absent (gtid and ord_id
  are guaranteed to be present by the writer)
- Update unit tests to mock get_fragment_labels instead of URL parsing
…gment

Fragments missing the system_type label are now included in the result
with system_type set to None, and a debug log is emitted. Previously the
fragment was silently dropped, causing incomplete results for older
integrations.
…flict

Resolves conflict in _fragments.py by adopting main's private label
constants (_LABEL_GTID, _LABEL_ORD_ID, _LABEL_SYSTEM_TYPE) and updating
the GTID filter in _list_fragments_by_label to use _LABEL_GTID.
add global id filter for lob agents
@I542102
I542102 requested a review from a team as a code owner August 10, 2026 17:41
Comment thread src/sap_cloud_sdk/agentgateway/_fragments.py
Comment thread src/sap_cloud_sdk/agentgateway/_fragments.py Outdated
Comment thread src/sap_cloud_sdk/agentgateway/_fragments.py Outdated
Comment thread src/sap_cloud_sdk/agentgateway/_models.py Outdated
Comment thread src/sap_cloud_sdk/agentgateway/agw_client.py
"integration_dependency": "sap-pce-apiResource-PA-v1",
}

def test_fragment_with_missing_labels_gets_none_values(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure you also test on a sample agent (can be locally) poiting out to one destination service, to ensure scenarios are ok for empty labels and so on

@NicoleMGomes

Copy link
Copy Markdown
Contributor

Verify failing checks and fulfill PR template.

Also check skills in the repo and use it ;)

@I542102 I542102 changed the title Add listing of sanatized integrations and filter for lob agents feat(agentgateway): list connected systems and filter MCP tools by GTID Aug 10, 2026
I542102 and others added 4 commits August 10, 2026 16:19
…and GTID filtering

- Move FragmentLabel enum to _models.py (single source of truth)
- Rename ActiveIntegration → ConnectedSystem with all fragment metadata fields
- Remove A2A from _list_active_integrations filter (MCP-only)
- Rename MCPToolFilter.global_tenant_ids → gtids; simplify docstring
- Guard list_active_integrations against customer agent flow
- Export ConnectedSystem from __init__.py; remove ActiveIntegration
- Add gtids filter test and customer agent guard tests
- Add BDD integration tests for connected systems scenarios
- Bump version to 0.43.0
…strings

- Fix ConnectedSystem construction to use global_tenant_id (not gtids)
- Rename list_mcp_fragments param global_tenant_ids → gtids in tests
- Replace GTID_LABEL_KEY usage with string literal in test_lob.py
- Update test names and MCPToolFilter usages to use gtids field
- Fix agw_client.py docstring example to use gtids instead of global_tenant_ids
- Add ConnectedSystem TypedDict to _models.py (was referenced but never defined)
- Fix ruff format violations in _fragments.py and agw_client.py
- Update test_operation.py count for AGENTGATEWAY_LIST_ACTIVE_INTEGRATIONS
- Sync uv.lock version to 0.43.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants