Skip to main content

W2A SDK

Agent developer SDKs for the Web2Agent Protocol.

One file at /.well-known/agents.json tells any AI agent what a website can do. These SDKs are how your agent reads and uses that file.


Packages

Package Runtime Install
w2a Python 3.9+ pip install w2a
w2a-client Node.js / Browser / Edge npm install w2a-client
w2a-mcp MCP (Claude, Cursor, Cline) npm install -g w2a-mcp

Python — 30 second start

import asyncio
from w2a import discover

async def main():
    site = await discover("w2a-protocol.org")

    print(f"Connected to: {site.name}")
    print(f"Skills available: {len(site.skills)}\n")

    for skill in site.public_skills:
        print(f"  {skill.id}")
        print(f"  {skill.intent}")
        print(f"  {skill.action}\n")

asyncio.run(main())

JavaScript / TypeScript

import { discover } from 'w2a-client'

const site = await discover('w2a-protocol.org')

console.log(`${site.name} — ${site.skills.length} skills`)

// Find a skill by natural language
const validator = site.findSkill('validate')
console.log(validator?.action) // POST /api/validate

// Call a skill directly
const client = new W2AClient()
const result = await client.call(site, 'check_site', { url: 'stripe.com' })

MCP — Claude Desktop / Cursor

Add to your ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "w2a": {
      "command": "npx",
      "args": ["w2a-mcp", "--url", "https://yoursite.com"]
    }
  }
}

Every skill in the site's agents.json becomes a tool Claude can call.


LangChain

from w2a.integrations.langchain import W2ATool
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI

# Each W2A skill becomes a LangChain tool
tools = await W2ATool.from_url("w2a-protocol.org")

llm = ChatOpenAI(model="gpt-4")
agent = initialize_agent(tools, llm, agent=AgentType.OPENAI_FUNCTIONS)
result = agent.run("Check if stripe.com is W2A enabled")

Handling sites without W2A

Not every site has adopted W2A yet. Handle it gracefully:

from w2a import discover
from w2a.exceptions import ManifestNotFound

try:
    site = await discover("stripe.com")
    # Use W2A skills
except ManifestNotFound:
    # Fall back to your own approach
    print("Site not W2A-enabled yet")
import { discover, ManifestNotFoundError } from 'w2a-client'

try {
  const site = await discover('stripe.com')
} catch (err) {
  if (err instanceof ManifestNotFoundError) {
    // Site hasn't adopted W2A yet
  }
}

Repository structure

sdk/
├── python/          pip install w2a
│   ├── w2a/
│   │   ├── __init__.py
│   │   ├── client.py
│   │   ├── models.py
│   │   └── exceptions.py
│   ├── pyproject.toml
│   └── README.md
├── javascript/      npm install w2a-client
│   ├── src/
│   │   └── index.ts
│   └── package.json
└── mcp/             npm install -g w2a-mcp
    ├── src/
    │   └── index.js
    └── package.json

integrations/
└── langchain/       from w2a.integrations.langchain import W2ATool
    └── tool.py

The protocol

agents.json format, spec, and validator: github.com/Nijjwol23/w2a

Generate a manifest for your site: w2a-protocol.org/tools


Apache 2.0 · w2a-protocol.org

Metadata

Release files for w2a 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 w2a 0.1.0
File Size Uploaded Provenance
w2a-0.1.0.tar.gz 10.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for w2a 0.1.0
File Interpreter ABI Platform
w2a-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / w2a-0.1.0.tar.gz

Download URL w2a-0.1.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5eed6aee1d1f71fd82b3e9b16faa48cc8315cf7550669f9345c6b9d37e248862
BLAKE2b-256 checksum
How to use checksums
2fadc35b7844630c93db887c0b7f78e3098467b06c444ef330db9fb2840c1908
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / w2a-0.1.0-py3-none-any.whl

Download URL w2a-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0b1901e6f181ecda570d59becc58b3fe1699303804472d72e3f20825d2c2579
BLAKE2b-256 checksum
How to use checksums
1b85fac4c024f5600aa4e836b26d25c51c3d8afb8f09a38ad88b9c707ead4c33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for w2a 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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