Skip to content

LangChain / LangGraph

Dinobase provides a LangChain toolkit that lets your agents query business data from 100+ SaaS APIs, databases, and files via SQL.

Terminal window
pip install langchain langchain-anthropic langgraph dinobase

Set up your data sources:

Terminal window
dinobase init
dinobase add stripe --api-key sk_test_...
dinobase add hubspot --api-key pat-...
dinobase sync

See Connecting Sources for the full list of 100+ supported sources, and Syncing & Scheduling for background sync options.

The DinobaseToolkit provides four tools:

ToolDescription
dinobase_queryExecute SQL queries (DuckDB dialect)
dinobase_describeGet table schema, types, and sample data
dinobase_list_sourcesList connected sources with freshness status
dinobase_refreshRe-sync a stale data source
from langchain_anthropic import ChatAnthropic
from langgraph.prebuilt import create_react_agent
from integrations.langchain.toolkit import DinobaseToolkit
model = ChatAnthropic(model="claude-sonnet-4-6")
toolkit = DinobaseToolkit()
agent = create_react_agent(
model=model,
tools=toolkit.get_tools(),
prompt="You are a data analyst with access to Dinobase.",
)
result = agent.invoke({
"messages": [{"role": "user", "content": "Which customers churned last quarter?"}]
})
print(result["messages"][-1].content)

You can also bind tools directly to a model without a full agent:

from langchain_anthropic import ChatAnthropic
from integrations.langchain.toolkit import DinobaseToolkit
model = ChatAnthropic(model="claude-sonnet-4-6")
toolkit = DinobaseToolkit()
model_with_tools = model.bind_tools(toolkit.get_tools())
response = model_with_tools.invoke("What data sources are available?")

The toolkit wraps Dinobase’s Python API (QueryEngine). When the agent calls dinobase_query, it executes SQL against your local DuckDB database containing synced data from all connected sources.

The typical agent workflow:

  1. dinobase_list_sources — discover available data
  2. dinobase_describe — understand table schemas
  3. dinobase_query — run cross-source SQL queries
  4. Present and analyze results

Cross-source JOINs work via shared columns (email, company name, IDs). Tables are referenced as schema.table (e.g., stripe.customers, hubspot.contacts).

See the example agent for a complete LangGraph ReAct agent:

Terminal window
export ANTHROPIC_API_KEY=sk-ant-...
python examples/react_agent.py "What is our monthly revenue trend?"