Skip to main content

Web2Agent Protocol SDK — discover and interact with W2A-enabled websites

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

w2a-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

w2a-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file w2a-0.1.0.tar.gz.

File metadata

  • Download URL: w2a-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for w2a-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5eed6aee1d1f71fd82b3e9b16faa48cc8315cf7550669f9345c6b9d37e248862
MD5 358de8b22c865a6842032814da12a70e
BLAKE2b-256 2fadc35b7844630c93db887c0b7f78e3098467b06c444ef330db9fb2840c1908

See more details on using hashes here.

File details

Details for the file w2a-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: w2a-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for w2a-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0b1901e6f181ecda570d59becc58b3fe1699303804472d72e3f20825d2c2579
MD5 1bf7e8b8a86ee67f627fee9a48c2c074
BLAKE2b-256 1b85fac4c024f5600aa4e836b26d25c51c3d8afb8f09a38ad88b9c707ead4c33

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page