Metadata-Version: 2.5
Name: langchain-bowmark
Version: 0.1.0
Summary: LangChain tools for Bowmark: typed functions an agent calls to search, price-check and book on live websites.
Project-URL: Homepage, https://bowmark.ai
Project-URL: Documentation, https://bowmark.ai/docs/langchain
Project-URL: Repository, https://github.com/bowmark-ai/langchain-bowmark
Author-email: Bowmark AI <christopher@bowmark.ai>
License: MIT
License-File: LICENSE
Keywords: agents,bowmark,langchain,mcp,tools,web
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: langchain-core<2,>=1.0
Description-Content-Type: text/markdown

# langchain-bowmark

LangChain tools for [Bowmark](https://bowmark.ai). Bowmark turns websites into typed
functions an AI agent can call: search, prices, availability, quotes, bookings, reading
a page. Your agent looks up the functions it needs, writes a short script against them,
and Bowmark runs it on the live sites and returns structured data. The agent never
drives a browser itself.

Full guide: [bowmark.ai/docs/langchain](https://bowmark.ai/docs/langchain)

## Install

```bash
pip install langchain-bowmark
```

Create an API key at [bowmark.ai/dashboard/keys](https://bowmark.ai/dashboard/keys) and
export it:

```bash
export BOWMARK_API_KEY="bmk_..."
```

## Tools

| Tool | What it does |
|---|---|
| `bowmark_get_library` | Returns the typed functions for a task or a site, with types and examples. Read-only, free, touches no site. |
| `bowmark_run` | Runs a short async JavaScript script against those functions on the live sites. Returns `{ok, status, result, logs, error}`. |

`BowmarkToolkit` returns both, sharing one key.

## Use with an agent

```python
from langchain.agents import create_agent
from langchain_bowmark import BowmarkToolkit

agent = create_agent(
    "openai:gpt-5.6-luna",
    tools=BowmarkToolkit().get_tools(),
    system_prompt=(
        "You can act on live websites through Bowmark. Call bowmark_get_library with what "
        "the user wants to do, write a short script against the functions it returns, and "
        "execute it with bowmark_run. Answer from the run's result."
    ),
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What is the top story on Hacker News right now?"}]}
)
print(result["messages"][-1].content)
```

## Call the tools directly

```python
from langchain_bowmark import BowmarkGetLibrary, BowmarkRun

print(BowmarkGetLibrary().invoke({"query": "read a web page"}))
print(BowmarkRun().invoke({"script": 'return (await bowmark.read.page("https://example.com")).title;'}))
```

## Development

```bash
uv venv && uv pip install -e . --group test
pytest tests/unit_tests
BOWMARK_API_KEY=... pytest tests/integration_tests
```

## License

MIT
