Skip to main content

Solace Agent Mesh Link SDK

Status: Early Access, version 0.1.0. The API can change in any release, and CHANGELOG.md lists each change. Apache 2.0, part of the Solace Agent Mesh (SAM) project.

sam-link-sdk lets an agent you wrote in Python join a running Solace Agent Mesh as a first-class agent. Write a handler, or use LangChain, LangGraph, the OpenAI Agents SDK, Google ADK, CrewAI, Strands Agents, Microsoft Agent Framework, Hermes Agent, or any framework that emits OpenTelemetry GenAI spans. The agent connects to SAM over one WebSocket, the link. It then appears in SAM's agent list, can be chatted with from the web UI, shows its model and tool steps in the Activity Monitor, reports token usage to SAM's analytics, and is governed by SAM: required scopes, tool approvals and the audit trail. The SDK does not run a mesh of its own.

Install

Python 3.11 or later. The base install is the core and the link and needs only websockets; each framework has an extra (pick your framework).

pip install sam-link-sdk
pip install "sam-link-sdk[langchain]"

Quick start

You need a SAM with the agent_link app enabled and its URL (what that is; on a shared SAM it is the administrator's step), and SAM's sam command line client to try the agent. Agent Mesh Desktop gives you both on your own computer.

  1. Issue the agent's token. The command writes it to the file and prints its SHA-256 digest:

    sam-link-sdk link-token --out claims-triage.link-token
    
  2. Register the agent in SAM: add claims-triage and the digest to the agent_link app's configuration and restart SAM (the configuration).

  3. Point the agent at SAM:

    export SAM_LINK_URL=wss://<sam-host>/gw/<gateway_id>/v1/connect
    export SAM_LINK_TOKEN_FILE=$PWD/claims-triage.link-token
    

    Use ws://localhost:8800/gw/agent-link/v1/connect for a SAM on your own machine over plain HTTP (8800 is the port of SAM's web UI).

  4. Save this as agent.py and run python agent.py. It needs no model:

import asyncio
import logging

from sam_link_sdk import AgentConfig, MeshAgent, TaskContext


async def handle(ctx: TaskContext) -> str:
    await ctx.progress("Looking the claim up")
    return f"Received: {ctx.text}"


async def main() -> None:
    logging.basicConfig(level=logging.INFO)
    config = AgentConfig(name="claims-triage", description="Triages insurance claims")
    await MeshAgent(config, handle).run_forever()


if __name__ == "__main__":
    asyncio.run(main())

The log shows agent link open agent=claims-triage ... protocol=2 and agent started. Check that SAM lists the agent, then send it a task:

curl -s https://<sam-host>/api/v1/agentCards | jq '.data[].name'
sam task send "Triage claim P-1182" --agent claims-triage --url https://<sam-host>

The reply is Received: Triage claim P-1182. Or pick the agent in the web UI's chat. If it does not join, docs/agent-link.md lists what the log says and what to change.

Pick your framework

Each page starts with a short agent you can run, and every adapter shares the same names (docs/frameworks/README.md). The LangChain agent, for example, is this handler in place of the one above (pip install "sam-link-sdk[openai]", and set OPENAI_API_KEY):

async def handle(ctx: TaskContext) -> str:
    return await run_agent(ctx, model, [lookup_policy], system_prompt="You triage insurance claims.")

with model = ChatOpenAI(model="gpt-4o-mini", stream_usage=True). On an OpenAI-compatible endpoint (a LiteLLM proxy, a local server), stream_usage=True is what makes SAM's token analytics show real counts instead of zero. The full runnable file is docs/frameworks/langchain.md.

Framework Extra Minimum version
LangChain langchain (openai adds langchain-openai) langchain-core 1.6.9
LangGraph langgraph langgraph 1.2.14
OpenAI Agents SDK openai-agents openai-agents 0.20.0
Google ADK adk google-adk 2.14.1
CrewAI crewai crewai 1.15.27
Strands Agents strands strands-agents 1.61.1
Microsoft Agent Framework agent-framework agent-framework-core 1.22.0
OpenTelemetry GenAI spans, for any other framework otel opentelemetry-sdk 1.45.2
Hermes Agent (experimental, no extra) a checkout, Python 3.14

The extras foundry and agentcore are for request-driven runtimes (docs/serverless.md).

Documentation

docs/README.md has a list of tasks ("I want to add tools, ask the user, call another agent, limit cost, deploy serverless") and a short glossary. Working on the SDK itself: CONTRIBUTING.md.

Getting help

Licence

Apache License 2.0, in LICENSE.

Metadata

Release files for sam-link-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sam-link-sdk 0.1.0
File Size Uploaded Provenance Actions
sam_link_sdk-0.1.0.tar.gz 213.8 kB With provenance Details for sam_link_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sam-link-sdk 0.1.0
File Interpreter ABI Platform Actions
sam_link_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for sam_link_sdk-0.1.0-py3-none-any.whl

Total release size: 473.1 kB

Security for sam-link-sdk 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page