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.
Release files for matrixlink 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| matrixlink-0.1.0.tar.gz | 12.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| matrixlink-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / matrixlink-0.1.0.tar.gz
| Download URL | matrixlink-0.1.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63ebda8624a6de42d32b5e59ffe7113194a895aab3f6c7773a10bc772224be26
|
|
BLAKE2b-256 checksum How to use checksums |
b3cf7adacf7a3d5714e5056d8ee7ea6f7fc0dd0a1a0202aba5304b1ef091907b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2025.
Transparency logRelease files / matrixlink-0.1.0-py3-none-any.whl
| Download URL | matrixlink-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efdb0a062bcc25853bc599eb862d9f42f66c32a6e30712939d72c31334cb6b17
|
|
BLAKE2b-256 checksum How to use checksums |
bdf5056e31f2f95c8db309c6d3afea1ec59c0cbc12513121c70106b929312d8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2025.
Transparency log