LangChain

Give a LangChain agent Bowmark's two tools with the langchain-bowmark package.

Install

pip install langchain-bowmark
export BOWMARK_API_KEY="bmk_..."

Create the key on the keys page. Source: bowmark-ai/langchain-bowmark.

The tools

BowmarkToolkit().get_tools() returns both tools. Each supports invoke and ainvoke.

ToolWhat it does
bowmark_get_libraryFinds the functions for a task or a site. Free. Same as GET /v1/library.
bowmark_runRuns a script against those functions and returns { ok, status, result, logs, error }. Same as POST /v1/run.

Example

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)

Without an agent, call the tools directly:

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;'}))

A failed run returns the envelope with ok: false and an error, not an exception, so the model can fix its script. Using langchain-mcp-adapters? Point it at https://api.bowmark.ai/mcp instead (Install).