Two ways to see the package in action. Both expect DIFFBOT_API_TOKEN and (for the agent code) ANTHROPIC_API_KEY in the environment — copy .env.example to .env and fill in the values, or export them in your shell.
From inside this repo (the common case — [tool.uv.sources] already points diffbot-python at its GitHub source):
uv sync --extra examplesFrom outside the repo (e.g. after langchain-diffbot is published to PyPI) you'd install both explicitly since diffbot-python isn't on PyPI yet:
pip install \
"diffbot-python @ git+https://github.com/diffbot/diffbot-python" \
"langchain-diffbot[examples]"quickstart.ipynb is a full tour of the package:
- Knowledge Graph retriever + output shaping
- Native async
- Web Search retriever
- Extract tool + extract loader
- Entities tool
- ChatDiffbot (Diffbot's own LLM with native streaming)
- Bring-your-own SDK client
- A multi-tool research agent that uses KG search + web search + URL extract
# uv-managed (recommended — handles PATH automatically):
uv run --with jupyter jupyter lab examples/quickstart.ipynb
# Or plain pip (use `python -m jupyter`, not `jupyter`, to avoid PATH issues):
pip install jupyter
python -m jupyter lab examples/quickstart.ipynbThe notebook is regenerated from _build_notebook.py — edit that file (cell sources are inline) and re-run uv run python examples/_build_notebook.py rather than editing the .ipynb directly.
company_research/ is the same multi-tool agent packaged as a one-shot CLI. Useful for shell scripting or quick spot checks.
cd examples
python -m company_research "What companies in Austin work on robotics?"
python -m company_research --quiet "Who are the executives at Diffbot?"
python -m company_research "What did Diffbot announce most recently?"The agent has three tools:
search_kg(dql_query)— Knowledge Graph searchweb_search(query)— natural-language web searchextract_url(url)— fetch and read a single page
It picks its own approach, may iterate, and cites the entity IDs / URLs it used. Drop --quiet to see the tool calls and intermediate responses.
Defaults to anthropic:claude-haiku-4-5 because a multi-step agent loop on a fresh Anthropic account can blow past Sonnet's 30k input-tokens-per-minute Tier 1 limit. Override with:
COMPANY_RESEARCH_MODEL=anthropic:claude-sonnet-4-6 python -m company_research "..."dql_explorer/ is a browser UI for the DQL-authoring loop:
type a question in plain English, and an agent inspects the ontology, probes
query variants, writes the DQL, and the results come back as a table. It's a
FastAPI backend serving a React + TypeScript (Vite) frontend, with optional
LangSmith tracing. See dql_explorer/README.md for
setup — in short:
cd dql_explorer/web && pnpm install && pnpm build && cd ..
uv run --extra examples python -m dql_explorer # then open http://127.0.0.1:8000