Skip to main content

langchain-w2a

PyPI version License: Apache 2.0 Tests

LangChain integration for the Web2Agent Protocol.

Turns any W2A-enabled website's declared skills into typed LangChain tools — one tool per skill, with Pydantic input schemas built from the site's agents.json.

pip install langchain-w2a

What is W2A?

W2A is an open standard where websites declare their capabilities at /.well-known/agents.json. Instead of crawling 40–50 pages to understand what a site does, your agent reads one file.

robots.txt  →  what not to crawl  (1994)
sitemap.xml →  where pages are    (2005)
agents.json →  what a site can do (2026)

Three ways to use it

1. Toolkit — typed tools from a known site

from langchain_w2a import W2AToolkit
from langchain.agents import create_agent

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

agent = create_agent(model="claude-sonnet-4-5-20250929", tools=tools)
agent.invoke({"messages": [("user", "Check if stripe.com is W2A enabled")]})

2. Generic discover + call tools

from langchain_w2a import W2ADiscoverTool, W2ASkillTool

tools = [W2ADiscoverTool(), W2ASkillTool()]
# Agent can now discover and call any W2A-enabled site at runtime

3. Direct invocation

from langchain_w2a import W2ADiscoverTool

discover = W2ADiscoverTool()
result = discover.invoke({"url": "w2a-protocol.org"})
print(result)  # JSON summary of site's declared skills

Standard tests

This package implements LangChain's standard test suite for tool integrations.

# Install test dependencies
pip install "langchain-w2a[test]"

# Run unit tests
pytest tests/unit_tests/

# Run integration tests (requires internet)
pytest tests/integration_tests/

Handling sites that haven't adopted W2A yet

result = discover.invoke({"url": "stripe.com"})
# "stripe.com has not adopted the W2A protocol yet —
#  no /.well-known/agents.json found.
#  Generate one at https://w2a-protocol.org/tools"

Tools fail gracefully on non-W2A sites so your agent can fall back to other strategies.


Requirements

  • Python 3.9+
  • langchain-core >= 0.2
  • w2a >= 0.1.0 (the W2A Python SDK)
  • pydantic >= 2.0

Documentation


License

Apache 2.0 — same as LangChain.

Metadata

Release files for langchain-w2a 0.2.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 langchain-w2a 0.2.0
File Size Uploaded Provenance
langchain_w2a-0.2.0.tar.gz 6.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / langchain_w2a-0.2.0.tar.gz

Download URL langchain_w2a-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7b6e63acd9aedd1d3bfebc4f41abce15eee1119293e2622da5716b097f6524f9
BLAKE2b-256 checksum
How to use checksums
0ba17fa2d3e1e94fb60e3b17db2beaba77423d562136154452415dea4ab6edf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / langchain_w2a-0.2.0-py3-none-any.whl

Download URL langchain_w2a-0.2.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fab01f7ca36c242f23d767744bdea24bcc8fbd6a4db851b1ec6b7c7d7802191
BLAKE2b-256 checksum
How to use checksums
4944a52097500e7f6f91677bbfa5269954280d26eca021779e8837ff8db214a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

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