LangChain tools for iwant.fyi -- reference implementation of the iwant.fyi demand-side protocol v1.0. Lets any LangChain agent express structured purchase intent and receive matched supply.
Project description
iwantfyi-langchain
LangChain tools for iwant.fyi — the reference implementation of the iwant.fyi demand-side protocol v1.0.
iwant.fyi demand-side protocol is an open standard for how AI agents express structured purchase intent on behalf of users, receive matched supply across multiple sources, and report outcomes back. This package wraps iwant.fyi as a set of LangChain
StructuredToolobjects that any LangChain agent can use.
Install
pip install iwantfyi-langchain
Quick start
from iwantfyi_langchain import get_iwant_tools
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
tools = get_iwant_tools(api_key="iwant_ak_...") # get a key at https://iwant.fyi
agent = create_react_agent(
ChatOpenAI(model="gpt-4o-mini"),
tools,
)
result = agent.invoke({
"messages": [{"role": "user", "content": "Find me a 1/4-inch drive torque wrench under $150"}]
})
print(result["messages"][-1].content)
That's it. The agent now has seven tools wired in: demand_create_want, demand_search, demand_get_want, demand_record_outcome, demand_list_verticals, demand_list_constraints, demand_health.
Get an API key
- Visit iwant.fyi and sign in.
- Register an agent (UI or
POST /api/agents). - Save the returned key (format:
iwant_ak_...).
What you get
| Tool | Spec | Description |
|---|---|---|
demand_create_want |
§8.1 | Create a Want and run matching |
demand_search |
§8.1 | Ephemeral matching, no persistence |
demand_get_want |
§8.1 | Retrieve a Want by ID |
demand_record_outcome |
§8.1 | Report viewed/clicked/purchased outcome |
demand_list_verticals |
§8.2 | Discover supported verticals |
demand_list_constraints |
§8.2 | Discover constraint vocabulary |
demand_health |
§8.2 | Liveness + readiness |
All tools use Pydantic v2 args schemas, so LangChain will validate user inputs before invoking iwant.fyi.
Direct client (no LangChain)
You can use the underlying IwantClient directly if you don't want LangChain in the loop:
from iwantfyi_langchain import IwantClient
with IwantClient(api_key="iwant_ak_...") as client:
health = client.health()
print(health["status"])
response = client.create_want(
title='Torque wrench, 1/4" drive, 25-100 ft-lb',
price_cents=15000,
vertical="tools",
mode="any",
)
print(f"Want {response['want']['id']} -> {response['matches']['match_count']} matches")
Transports
By default the client uses MCP over HTTP (JSON-RPC). Switch to the REST fallback:
client = IwantClient(api_key="...", transport="http")
Both transports cover all demand.* tools. Legacy iwant.fyi tools (browse_wants, search_listings, etc.) only work over MCP transport via client.call_tool(...).
Outcome events
Outcome events feed match-quality learning and (eventually) revenue-share attribution:
client.record_outcome(want_id=w_id, match_id=m_id, event="clicked")
client.record_outcome(want_id=w_id, match_id=m_id, event="purchased", value_cents=12500)
Events are idempotent on the server side. Replays are no-ops.
Errors
Typed exceptions from iwantfyi_langchain.errors:
from iwantfyi_langchain import IwantError, UnauthorizedError, ValidationError, RateLimitedError
try:
client.create_want(title="x", price_cents=1)
except UnauthorizedError:
... # refresh key
except ValidationError as e:
... # e.message, e.data
except RateLimitedError:
... # back off
except IwantError as e:
... # generic; e.code, e.message
Specification
Full iwant.fyi demand-side protocol v1.0 specification: iwant.fyi/protocol/v1
The protocol is published under Apache 2.0. iwant.fyi is the reference implementation; anyone may build their own.
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iwantfyi_langchain-0.1.0.tar.gz.
File metadata
- Download URL: iwantfyi_langchain-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.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c7b511e06d077a0f1ec46b1bb2a8116f422a9e1d7fbc8a0e23ccecb399a3cc1
|
|
| MD5 |
1f583ca26b8ff6261d5383e7be5d0326
|
|
| BLAKE2b-256 |
dbc5d3f4513ee4f7d72cf7f4645d4fc9b0aa063f413c2298a323da0009e0e8fe
|
File details
Details for the file iwantfyi_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iwantfyi_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d152d1a07f059d36263c530a64096f263d63f2d98d96401c3b9a75ec9f55d47
|
|
| MD5 |
2b1aae3f6d4370baad8e822eb8e0c865
|
|
| BLAKE2b-256 |
3ece0f38ba4a0fc44527b8c2d27a5aeb4bcc325e7dc72ab4e45ffc72128e8018
|