MatrixLink — Client for MCP Gateway discovery, Orchestrator invoke, and A2A agent messaging.
Project description
MatrixLink
MatrixLink is a compact, production-ready Python client for composing AI systems in the MatrixHub ecosystem:
- MCP Gateway discovery — find orchestrators and A2A agents by skill, tags, and modes, filtered by health/fitness.
- A2A messaging — call stateless agents via
POST /message/send(optional SSE for streaming). - Orchestrator invoke — call MCP Server flows via
POST /invoke/<flow>. - Cloud-portable endpoints — resolve service URLs from environment only (Local, IBM Code Engine, Google Cloud Run, AWS App Runner, Azure Container Apps, Knative/Kubernetes).
Ship faster with safe vendor agility: swap agents/orchestrators without changing app code.
Why MatrixLink
Consultancies need to deliver reliable AI workflows quickly, across many client environments, with minimal rework:
-
One SDK, many runtimes Same code works from local-dev to any major serverless/container platform. No provider-specific forks.
-
Faster delivery Discover proven agents/orchestrators from MatrixHub and wire them in minutes instead of rewriting capabilities.
-
Governance-ready Works with MCP Gateway for RBAC, visibility scoping, health & fitness signals, and controlled rollouts (canary/blue-green).
-
Vendor flexibility Keep multiple implementations for the same
skilland select at runtime. Avoid hard binds to any one provider. -
Low-friction handoff Ship portable solutions that customers can run in their preferred cloud with env-only changes.
Installation
pip install matrixlink
# or
pipx install matrixlink
Requires Python 3.10+.
Quickstart
from matrixlink import MCPClient, A2AClient, OrchestratorClient
# 1) Discover agents by skill via MCP Gateway
mcp = MCPClient() # reads MCP_BASE_URL or resolves with CLOUD_PROVIDER hints
agents = mcp.discover_agents(skill="report.generate")
# 2) Send a message to the best agent (A2A)
a2a = A2AClient() # picks A2A_SERVICE_TOKEN from env if set
resp = a2a.send_message(agents[0]["endpoint"], {"title": "Weekly", "bullets": ["A", "B", "C"]})
# 3) Invoke an orchestrator flow (MCP server)
orch = OrchestratorClient("https://orchestrator.example.com")
result = orch.invoke("finance.generateReport", {"period": "Q3", "kpis": ["rev", "margin"]})
No MCP? You can still use A2AClient and OrchestratorClient directly with explicit URLs; add MCP later when you want discovery, health routing, and policy.
API Overview
MCPClient — discovery (via MCP Gateway)
from matrixlink import MCPClient
mcp = MCPClient()
servers = mcp.discover_servers(role="orchestrator", tags=["domain:finance"])
agents = mcp.discover_agents(
skill="report.generate",
input_mode="json",
output_mode="json"
)
A2AClient — agent messaging
from matrixlink import A2AClient
client = A2AClient() # uses A2A_SERVICE_TOKEN if set
result = client.send_message("https://agents.example.com/agent-synth", {"foo": "bar"})
OrchestratorClient — flow invoke
from matrixlink import OrchestratorClient
orch = OrchestratorClient("https://orchestrator.example.com")
reply = orch.invoke("finance.generateReport", {"period": "Q3"})
Optional Server-Sent Events (SSE) helpers are included for streaming responses.
Configuration (env first)
MatrixLink prefers environment variables (you can also pass kwargs).
Core
MCP_BASE_URL— MCP Gateway base URL (e.g.,https://mcp.example.com)MCP_BEARER_TOKEN— bearer token for MCP callsA2A_SERVICE_TOKEN— bearer token for agent (east–west) callsTENANT_HEADER— tenancy header name (default:X-Tenant-Id)REQUEST_TIMEOUT— HTTP timeout seconds (default:30)
Provider hints (optional)
CLOUD_PROVIDER—local(default),ce,gcrun,apprunner,aca,knativeDOMAIN_SUFFIX— e.g.,proj.region.codeengine.appdomain.cloudMCP_SERVICE_NAME— defaultmcp-gatewayORCH_SERVICE_NAME— defaultorchestratorAGENTS_DOMAIN_PREFIX— defaultagentsORCH_BASE_URL,AGENTS_BASE_URL— explicit overrides
If you set explicit
*_BASE_URL, provider hints are ignored.
Supported cloud providers (and how resolution works)
MatrixLink resolves service endpoints from env only. You can:
- Set explicit URLs (
MCP_BASE_URL,ORCH_BASE_URL,AGENTS_BASE_URL), or - Provide provider hints and let MatrixLink compose URLs from service names + domain suffix.
| Provider | Minimal env example | Notes |
|---|---|---|
| Local / Docker | CLOUD_PROVIDER=local + MCP_BASE_URL=http://localhost:4444 |
Ideal for dev/test. |
| IBM Code Engine | CLOUD_PROVIDER=ce + DOMAIN_SUFFIX=proj.region.codeengine.appdomain.cloud + MCP_SERVICE_NAME=mcp-gateway |
Works with internal CE hostnames or custom domains. |
| Google Cloud Run | CLOUD_PROVIDER=gcrun + explicit MCP_BASE_URL/ORCH_BASE_URL/AGENTS_BASE_URL |
Prefer custom domains or Cloud Run URLs. |
| AWS App Runner | CLOUD_PROVIDER=apprunner + explicit *_BASE_URL |
Use App Runner service URLs or custom domain. |
| Azure Container Apps | CLOUD_PROVIDER=aca + DOMAIN_SUFFIX=<env>.azurecontainerapps.io + service names |
Use ACA default domains or custom hostnames. |
| Knative / Kubernetes | CLOUD_PROVIDER=knative + DOMAIN_SUFFIX=apps.example.internal + service names |
Works with cluster DNS / service mesh. |
This lets consulting teams hand off solutions to clients on their platform of choice with no code changes.
Patterns consultants use with MatrixLink
- Domain Orchestrator — encode business logic in an MCP Server; discover skills at runtime; swap agent providers without redeploying callers.
- BFF / Edge Facade — keep a thin API layer; use
OrchestratorClientinside to call flows; pass through tenancy and request IDs. - Multi-tenant apps — enforce
X-Tenant-Idthroughout; leverage MCP visibility (private|team|global) to segment catalogs by client or BU. - Progressive hardening — start with explicit URLs; add MCP Gateway for discovery, health, and fitness; introduce canary/blue-green via tags.
- Hybrid & multi-cloud — keep agents/orchestrators near data; choose endpoints per region/provider purely by env.
Error handling
Exceptions live in matrixlink.errors:
DiscoveryError— MCP discovery problemsAuthError— missing/invalid tokensHTTPError— non-2xx responsesTimeoutError— request timed out
from matrixlink.errors import DiscoveryError, HTTPError
try:
agent = MCPClient().discover_agents(skill="doc.classify")[0]
except DiscoveryError:
# no agent found / MCP unreachable
...
Security & operations
- Keep tokens in a secret manager; never bake into images.
- Propagate
X-Request-Idand yourTENANT_HEADERend-to-end for traceability. - If using SSE, ensure your edge does not buffer
text/event-stream. - Keep MCP Gateway and your edge warm (min scale = 1) for low-latency discovery; let agents/orchestrators scale to zero.
Versioning
Semantic versioning. Breaking changes bump major.
Links
- Docs — https://agent-matrix.github.io/matrixlink/
- Source — https://github.com/agent-matrix/matrixlink
- Issues — https://github.com/agent-matrix/matrixlink/issues
License
Apache 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matrixlink-0.1.0.tar.gz.
File metadata
- Download URL: matrixlink-0.1.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63ebda8624a6de42d32b5e59ffe7113194a895aab3f6c7773a10bc772224be26
|
|
| MD5 |
f2fe2f6b7930d2c34bb4f3bbe2884554
|
|
| BLAKE2b-256 |
b3cf7adacf7a3d5714e5056d8ee7ea6f7fc0dd0a1a0202aba5304b1ef091907b
|
Provenance
The following attestation bundles were made for matrixlink-0.1.0.tar.gz:
Publisher:
release.yml on agent-matrix/matrixlink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrixlink-0.1.0.tar.gz -
Subject digest:
63ebda8624a6de42d32b5e59ffe7113194a895aab3f6c7773a10bc772224be26 - Sigstore transparency entry: 541392054
- Sigstore integration time:
-
Permalink:
agent-matrix/matrixlink@cba1fb33eabe96ea8a8ec0e2e33d9bfaaafa916b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/agent-matrix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cba1fb33eabe96ea8a8ec0e2e33d9bfaaafa916b -
Trigger Event:
release
-
Statement type:
File details
Details for the file matrixlink-0.1.0-py3-none-any.whl.
File metadata
- Download URL: matrixlink-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efdb0a062bcc25853bc599eb862d9f42f66c32a6e30712939d72c31334cb6b17
|
|
| MD5 |
3ff50c32858a105d35a78760d26da702
|
|
| BLAKE2b-256 |
bdf5056e31f2f95c8db309c6d3afea1ec59c0cbc12513121c70106b929312d8c
|
Provenance
The following attestation bundles were made for matrixlink-0.1.0-py3-none-any.whl:
Publisher:
release.yml on agent-matrix/matrixlink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrixlink-0.1.0-py3-none-any.whl -
Subject digest:
efdb0a062bcc25853bc599eb862d9f42f66c32a6e30712939d72c31334cb6b17 - Sigstore transparency entry: 541392072
- Sigstore integration time:
-
Permalink:
agent-matrix/matrixlink@cba1fb33eabe96ea8a8ec0e2e33d9bfaaafa916b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/agent-matrix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cba1fb33eabe96ea8a8ec0e2e33d9bfaaafa916b -
Trigger Event:
release
-
Statement type: