From 346b8e39cfe103f9746d98eabd1349ec84a831d7 Mon Sep 17 00:00:00 2001 From: Rachit Mehta Date: Mon, 1 Jun 2026 10:49:59 -0400 Subject: [PATCH 1/3] feat: add python wasm release workflow --- .../python-pypi-publish-on-release.yml | 4 +- .../python-wasm-pypi-publish-on-release.yml | 167 ++++++++++++++++++ strands-py-wasm/pyproject.toml | 7 +- 3 files changed, 170 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/python-wasm-pypi-publish-on-release.yml diff --git a/.github/workflows/python-pypi-publish-on-release.yml b/.github/workflows/python-pypi-publish-on-release.yml index e051593fa..fae5a3001 100644 --- a/.github/workflows/python-pypi-publish-on-release.yml +++ b/.github/workflows/python-pypi-publish-on-release.yml @@ -7,7 +7,7 @@ on: jobs: call-test-lint: - if: startsWith(github.event.release.tag_name, 'python/v') + if: startsWith(github.event.release.tag_name, 'python/v1.') uses: ./.github/workflows/python-test-lint.yml permissions: contents: read @@ -18,7 +18,7 @@ jobs: build: name: Build distribution - if: startsWith(github.event.release.tag_name, 'python/v') + if: startsWith(github.event.release.tag_name, 'python/v1.') permissions: contents: read needs: diff --git a/.github/workflows/python-wasm-pypi-publish-on-release.yml b/.github/workflows/python-wasm-pypi-publish-on-release.yml new file mode 100644 index 000000000..ab7a768ce --- /dev/null +++ b/.github/workflows/python-wasm-pypi-publish-on-release.yml @@ -0,0 +1,167 @@ +name: "Python WASM: Publish Package" + +on: + release: + types: + - published + workflow_dispatch: + inputs: + version: + description: "Version to build (e.g. 2.0.0-rc.1). Skips deploy." + required: true + type: string + +jobs: + call-ts-check: + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v') + uses: ./.github/workflows/typescript-ts-check.yml + permissions: + contents: read + with: + ref: ${{ github.event.release.target_commitish || github.sha }} + + call-ts-test: + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v') + uses: ./.github/workflows/typescript-ts-test.yml + permissions: + contents: read + with: + ref: ${{ github.event.release.target_commitish || github.sha }} + + call-py-check: + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v') + uses: ./.github/workflows/wasm-py-check.yml + permissions: + contents: read + with: + ref: ${{ github.event.release.target_commitish || github.sha }} + + build-wasm: + name: Build WASM component + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v') + needs: + - call-ts-check + - call-ts-test + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: '22' + package-manager-cache: false + + - name: Install dependencies + run: npm ci + + - name: Build TypeScript SDK + run: npm run build -w strands-ts + + - name: Build WASM component + run: npm run build -w strands-wasm + + - name: Upload WASM artifact + uses: actions/upload-artifact@v7 + with: + name: strands-agent-wasm + path: strands-wasm/dist/strands-agent.wasm + + build-wheel: + name: Build Python wheel + needs: + - build-wasm + - call-py-check + runs-on: ubuntu-latest + permissions: + contents: read + defaults: + run: + working-directory: strands-py-wasm + + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install hatch + + - name: Copy root LICENSE and NOTICE + run: | + cp ../LICENSE.APACHE LICENSE.APACHE + cp ../NOTICE . + + - name: Download WASM artifact + uses: actions/download-artifact@v8 + with: + name: strands-agent-wasm + path: strands-wasm/dist/ + + - name: Extract version + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ inputs.version }}" + else + VERSION=${GITHUB_REF#refs/tags/python-wasm/v} + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + - name: Validate version + run: | + if [[ ${{ steps.version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then + echo "Valid version format" + exit 0 + else + echo "Invalid version format" + exit 1 + fi + + - name: Stamp version + run: sed -i 's/^version = .*/version = "${{ steps.version.outputs.version }}"/' pyproject.toml + + - name: Build + run: hatch build + + - name: Store the distribution packages + uses: actions/upload-artifact@v7 + with: + name: python-wasm-package-distributions + path: strands-py-wasm/dist/ + + deploy: + name: Upload release to PyPI + if: github.event_name != 'workflow_dispatch' + needs: + - build-wheel + runs-on: ubuntu-latest + + environment: + name: pypi-wasm + url: https://pypi.org/p/strands-agents + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v8 + with: + name: python-wasm-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/strands-py-wasm/pyproject.toml b/strands-py-wasm/pyproject.toml index cd4d14764..5d4ea2e51 100644 --- a/strands-py-wasm/pyproject.toml +++ b/strands-py-wasm/pyproject.toml @@ -28,8 +28,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ - # Imports as `wasmtime`. Pinned to pgrayy/wasm-deps git URL until upstream PRs land. - "pgrayy-wasmtime @ git+https://github.com/pgrayy/wasm-deps.git@4b5dc41512109ebafe4c4f1edd592c739872c640#subdirectory=wasmtime-py", + "pgrayy-wasmtime>=46.0.7", "botocore>=1.29.0,<2.0.0", ] @@ -44,10 +43,6 @@ Homepage = "https://github.com/strands-agents/sdk-python" Documentation = "https://strandsagents.com" -[tool.hatch.metadata] -# pgrayy-wasmtime is pinned via a git URL until upstream PRs land. -allow-direct-references = true - [tool.hatch.build.targets.wheel] packages = ["src/strands"] From 21b38ef4c5ef8317e327b03374f3ad71a6d0f10a Mon Sep 17 00:00:00 2001 From: Rachit Mehta Date: Mon, 1 Jun 2026 13:02:29 -0400 Subject: [PATCH 2/3] address comments --- strands-py-wasm/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strands-py-wasm/pyproject.toml b/strands-py-wasm/pyproject.toml index 5d4ea2e51..8589413fb 100644 --- a/strands-py-wasm/pyproject.toml +++ b/strands-py-wasm/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ - "pgrayy-wasmtime>=46.0.7", + "pgrayy-wasmtime>=46.0.7,<48.0.0", "botocore>=1.29.0,<2.0.0", ] From 50bb7022e3f1be6aa55335048a3d2ff6b94279a6 Mon Sep 17 00:00:00 2001 From: Rachit Mehta Date: Mon, 1 Jun 2026 17:08:06 -0400 Subject: [PATCH 3/3] address comments --- .github/workflows/python-wasm-pypi-publish-on-release.yml | 2 +- strands-py-wasm/pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-wasm-pypi-publish-on-release.yml b/.github/workflows/python-wasm-pypi-publish-on-release.yml index ab7a768ce..087780a02 100644 --- a/.github/workflows/python-wasm-pypi-publish-on-release.yml +++ b/.github/workflows/python-wasm-pypi-publish-on-release.yml @@ -153,7 +153,7 @@ jobs: environment: name: pypi-wasm - url: https://pypi.org/p/strands-agents + url: https://pypi.org/p/strands-agents-wasm permissions: id-token: write diff --git a/strands-py-wasm/pyproject.toml b/strands-py-wasm/pyproject.toml index 8589413fb..f21aee4eb 100644 --- a/strands-py-wasm/pyproject.toml +++ b/strands-py-wasm/pyproject.toml @@ -4,8 +4,8 @@ build-backend = "hatchling.build" [project] -name = "strands-agents" -version = "2.0.0a1" +name = "strands-agents-wasm" +version = "0.0.1" description = "A model-driven approach to building AI agents in just a few lines of code" requires-python = ">=3.10" license = "Apache-2.0"