Skip to main content

LangChain tools for Hotdata runtime

Project description

hotdata-langchain

Give your LangChain agents access to Hotdata — run SQL against your workspace connections and work with managed databases.

Install

pip install hotdata-langchain

Authentication

Set HOTDATA_API_KEY in your environment. Optionally set HOTDATA_WORKSPACE to pin a specific workspace (the first available workspace is used if unset).

Quickstart

from langchain.agents import AgentExecutor, create_tool_calling_agent
import hotdata_langchain as hl

client = hl.from_env()
tools = hl.make_hotdata_tools(client)

agent = create_tool_calling_agent(llm=your_llm, tools=tools, prompt=your_prompt)
executor = AgentExecutor(agent=agent, tools=tools)
result = executor.invoke({"input": "How many rows are in the orders table?"})

Tools

make_hotdata_tools(client) returns a list of LangChain StructuredTool objects ready to pass to any agent:

Tool What it does
hotdata_execute_sql Run a SQL query and return rows as JSON
hotdata_list_managed_databases List available managed databases
hotdata_create_managed_database Create a new managed database
hotdata_load_managed_table Load a parquet file into a managed table

Calling tools directly

You can also invoke tools outside of an agent loop:

tools = {t.name: t for t in hl.make_hotdata_tools(client)}

result = tools["hotdata_execute_sql"].invoke({"sql": "SELECT * FROM orders LIMIT 10"})
print(result)  # JSON rows

tools["hotdata_create_managed_database"].invoke({
    "name": "sales",
    "schema_name": "public",
    "tables": "orders,customers",
})

tools["hotdata_load_managed_table"].invoke({
    "database": "sales",
    "table": "orders",
    "file": "/path/to/orders.parquet",
})

Scoping queries to a managed database

Pass database= so all SQL the agent runs resolves against a specific managed database:

tools = hl.make_hotdata_tools(client, database="sales")

Controlling result size

Limit how many rows are returned to the LLM. Useful for keeping responses within context limits (default: 100):

tools = hl.make_hotdata_tools(client, max_rows=50)

Run the examples

uv run python examples/langchain_basic.py
uv run python examples/langchain_managed_db.py

Development

uv sync --locked
uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hotdata_langchain-0.2.1.tar.gz (138.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hotdata_langchain-0.2.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file hotdata_langchain-0.2.1.tar.gz.

File metadata

  • Download URL: hotdata_langchain-0.2.1.tar.gz
  • Upload date:
  • Size: 138.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hotdata_langchain-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a76603a4683a999852e761269d409e260fec7004f4aa480133394390355c2f6a
MD5 5af3c8d667f69be063ef52a35a9a0500
BLAKE2b-256 fa1e716e8157ee479a833d12c83992859a939bb828dd551d81c047dbf0fb5480

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langchain-0.2.1.tar.gz:

Publisher: publish.yml on hotdata-dev/hotdata-langchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hotdata_langchain-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hotdata_langchain-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f706bd7ce9690a258e82121175a46710f6c89edb47ba18d4afbf81463b38fe1e
MD5 ff2e60a23740bcc6637c8605524f2373
BLAKE2b-256 3c5d87272a8954ca171e63861d0ea247cb4f1e0ac663dbe580d5b60b588527b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langchain-0.2.1-py3-none-any.whl:

Publisher: publish.yml on hotdata-dev/hotdata-langchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page