Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
sdk: publish as @sam-mesh/sdk and sam-mesh, behind a switch
Antonio Ojea60585c9e20e4
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 2e60d005..ed4d6b5d 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -40,7 +40,10 @@ jobs:# through trusted publishing: npm and PyPI accept this workflow's OIDC# token for the packages once an owner has registered it on each registry# (see sdk/README.md); no publishing secret is stored in the repository.+ # Off until that registration is done: set the repository variable+ # PUBLISH_SDKS to "true" to turn it on.publish-sdks:+ if: vars.PUBLISH_SDKS == 'true'runs-on: ubuntu-latestneeds: goreleaserpermissions:@@ -64,7 +67,7 @@ jobs:python-version: "3.12"- name: Stamp the release version on both SDKsrun: ./hack/sdk-version.sh "${SDK_VERSION#v}"- - name: Build and publish @agent-mesh/sdk+ - name: Build and publish @sam-mesh/sdk# npm's trusted publishing needs npm 11.5 or later; Node 22 ships 10.working-directory: sdk/jsrun: |@@ -72,12 +75,12 @@ jobs:npm cinpm run buildnpm publish --provenance --access public- - name: Build agent-mesh+ - name: Build sam-meshworking-directory: sdk/pythonrun: |python -m pip install --upgrade buildpython -m build- - name: Publish agent-mesh+ - name: Publish sam-meshuses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2with:packages-dir: sdk/python/dist/diff --git a/hack/sdk-version.sh b/hack/sdk-version.shindex 3057550c..b84a70db 100755--- a/hack/sdk-version.sh+++ b/hack/sdk-version.sh@@ -14,7 +14,7 @@# limitations under the License.# Stamps one version on both native SDKs, so a release publishes-# @agent-mesh/sdk and agent-mesh at the version of its tag. The release+# @sam-mesh/sdk and sam-mesh at the version of its tag. The release# workflow runs it on the tag; a developer never needs to.## ./hack/sdk-version.sh 1.2.3diff --git a/sdk/README.md b/sdk/README.mdindex 458c363a..9bac8bf6 100644--- a/sdk/README.md+++ b/sdk/README.md@@ -3,9 +3,9 @@This directory holds the SDKs that let an agent join a SAM mesh from insideits own process, without a `sam-node` sidecar. Two languages are in scope:-- [`js/`](js/) — `@agent-mesh/sdk`, TypeScript for Node.js, built on+- [`js/`](js/) — `@sam-mesh/sdk`, TypeScript for Node.js, built on[js-libp2p](https://github.com/libp2p/js-libp2p).-- [`python/`](python/) — `agent-mesh` (import `agent_mesh`), built on+- [`python/`](python/) — `sam-mesh` (import `agent_mesh`), built on[py-libp2p](https://github.com/libp2p/py-libp2p).The motivation is [issue #480](https://github.com/google/sam/issues/480). The@@ -46,7 +46,7 @@ Milestones 1 to 5 are implemented and tested in both languages:| Control plane pull on `sam-node`'s interval: `/keys` verified against the trusted set, credential refresh after a rotation, `/info` bans and router addresses | yes | yes || Gossip events from the control plane (`/sam/mesh/events/v1`, StrictSign): ban enforced at once, key rotation adopted, policy update pulls | yes | yes || Banned peers refused: connections dropped and denied, handshakes and requests refused, dials refused | yes | yes |-| Published to a registry from the release workflow | npm `@agent-mesh/sdk` | PyPI `agent-mesh` |+| Published to a registry from the release workflow | npm `@sam-mesh/sdk` | PyPI `sam-mesh` |A member built this way is on the mesh and uses it in both directions: itfinds a service in the DHT and calls it through the router, verifying the@@ -382,12 +382,19 @@ holds against the control plane's records.dial one; its connections are dropped when the ban lands.- Publishing: `.github/workflows/release.yml` stamps the release tag'sversion on both packages (`hack/sdk-version.sh`) and publishes- `@agent-mesh/sdk` to npm and `agent-mesh` to PyPI through trusted- publishing. One-time setup by a package owner: on npmjs.com, add- `google/sam` with workflow `release.yml` as a trusted publisher of- `@agent-mesh/sdk`; on pypi.org, add the same repository and workflow as- a trusted publisher of `agent-mesh` (environment left empty). No- publishing token is stored in the repository.+ `@sam-mesh/sdk` to npm and `sam-mesh` to PyPI through trusted+ publishing. The job runs only when the repository variable+ `PUBLISH_SDKS` is `true`, so a release before the registries are set up+ stays green. One-time setup by a package owner: on npmjs.com, create the+ `sam-mesh` organization, publish `@sam-mesh/sdk` 0.1.0 once by hand+ (`cd sdk/js && npm publish --access public`; the trusted-publisher+ settings live on the package page, which exists only after that), then+ register `google/sam` with workflow `release.yml` under the package's+ Settings, Trusted publishing; on pypi.org, add a pending publisher for+ project `sam-mesh` with the same repository and workflow (environment+ left empty), which reserves the name and lets the first tag create the+ project. Then set `PUBLISH_SDKS`. No publishing token is stored in the+ repository.- Docs: `site/content/docs/guides/native-sdks.md`.- Tests. Unit: a fake control plane rotates its key and bans a peer; eachSDK learns both from a pull, refreshes under the new key and only underdiff --git a/sdk/js/README.md b/sdk/js/README.mdindex f9149278..94aadbc9 100644--- a/sdk/js/README.md+++ b/sdk/js/README.md@@ -1,4 +1,4 @@-# @agent-mesh/sdk+# @sam-mesh/sdkNative JavaScript SDK for joining a SAM agent mesh from inside the agentprocess. It replaces the `sam-node` sidecar for agents written for Node.js.@@ -11,19 +11,20 @@ calling their tools). Serving tools is the next milestone; see## Install```bash-cd sdk/js && npm ci && npm run build+npm install @sam-mesh/sdk # from npm, released with the repository+cd sdk/js && npm ci && npm run build # from a checkout```Requires Node.js 22.18 or later. Runtime dependencies are-`@bufbuild/protobuf`, `@biscuit-auth/biscuit-wasm`, `@modelcontextprotocol/sdk`-and the js-libp2p packages (`libp2p`, `@libp2p/tcp`, `@libp2p/tls`,+`@bufbuild/protobuf`, `@biscuit-auth/biscuit-wasm`, `@modelcontextprotocol/sdk`,+`zod` and the js-libp2p packages (`libp2p`, `@libp2p/tcp`, `@libp2p/tls`,`@chainsafe/libp2p-yamux`, `@libp2p/circuit-relay-v2`, `@libp2p/identify`,-`@libp2p/kad-dht`, `@libp2p/ping`).+`@libp2p/kad-dht`, `@libp2p/ping`, `@libp2p/gossipsub`, `@libp2p/peer-id`).## Use```ts-import { AgentMesh } from "@agent-mesh/sdk";+import { AgentMesh } from "@sam-mesh/sdk";import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import { z } from "zod";diff --git a/sdk/js/package-lock.json b/sdk/js/package-lock.jsonindex dbbe6f43..1390da22 100644--- a/sdk/js/package-lock.json+++ b/sdk/js/package-lock.json@@ -1,11 +1,11 @@{- "name": "@agent-mesh/sdk",+ "name": "@sam-mesh/sdk","version": "0.1.0","lockfileVersion": 3,"requires": true,"packages": {"": {- "name": "@agent-mesh/sdk",+ "name": "@sam-mesh/sdk","version": "0.1.0","license": "Apache-2.0","dependencies": {diff --git a/sdk/js/package.json b/sdk/js/package.jsonindex 8a33ef53..36f9a14e 100644--- a/sdk/js/package.json+++ b/sdk/js/package.json@@ -1,5 +1,5 @@{- "name": "@agent-mesh/sdk",+ "name": "@sam-mesh/sdk","version": "0.1.0","description": "Native SDK for joining a SAM agent mesh from inside a Node.js agent process","license": "Apache-2.0",diff --git a/sdk/python/README.md b/sdk/python/README.mdindex 4a499cd4..16134b40 100644--- a/sdk/python/README.md+++ b/sdk/python/README.md@@ -1,4 +1,4 @@-# agent-mesh (Python)+# sam-mesh (Python)Native Python SDK for joining a SAM agent mesh from inside the agentprocess. It replaces the `sam-node` sidecar for agents written in Python.@@ -12,13 +12,14 @@ calling their tools). Serving tools is the next milestone; see## Install```bash-pip install -e 'sdk/python[test]'+pip install sam-mesh # from PyPI, released with the repository+pip install -e 'sdk/python[test]' # from a checkout```Runtime dependencies are `cryptography`, `protobuf`, `biscuit-python`,-`libp2p` (py-libp2p 0.7, trio-based), `multiaddr` and `mcp` (2.x). Python-3.11 or later. py-libp2p's `fastecdsa` builds from source against GMP-(`libgmp-dev` on Debian).+`libp2p` (py-libp2p 0.7, trio-based), `multiaddr`, `mcp` (2.x), `h11` and+`httpx`. Python 3.11 or later. py-libp2p's `fastecdsa` builds from source+against GMP (`libgmp-dev` on Debian).## Usediff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.tomlindex 08f6e2c4..bfa3afb3 100644--- a/sdk/python/pyproject.toml+++ b/sdk/python/pyproject.toml@@ -3,7 +3,7 @@ requires = ["hatchling>=1.25"]build-backend = "hatchling.build"[project]-name = "agent-mesh"+name = "sam-mesh"version = "0.1.0"description = "Native SDK for joining a SAM agent mesh from inside a Python agent process"readme = "README.md"diff --git a/site/content/docs/guides/native-sdks.md b/site/content/docs/guides/native-sdks.mdindex 94dec5b9..59e8c13e 100644--- a/site/content/docs/guides/native-sdks.md+++ b/site/content/docs/guides/native-sdks.md@@ -18,8 +18,8 @@ agent (see [Headless enrollment](../headless-enrollment/)).## Install```bash-npm install @agent-mesh/sdk # Node.js 22 or later-pip install agent-mesh # Python 3.11 or later+npm install @sam-mesh/sdk # Node.js 22 or later+pip install sam-mesh # Python 3.11 or later```Both packages are published from the repository's release workflow, at the@@ -36,7 +36,7 @@ agent enrolls once and resumes with `load` afterwards.JavaScript:```ts-import { AgentMesh } from "@agent-mesh/sdk";+import { AgentMesh } from "@sam-mesh/sdk";const mesh = await AgentMesh.enroll({controlPlaneUrl: "https://hub.sam-mesh.dev",