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.2.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.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hotdata_langchain-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 d8bf8b94454047bf17f553962aec70cc03d1b549c4a7b176062b4e87ce66c8a8
MD5 504f928400521879cc431496c036a99d
BLAKE2b-256 f709d0b7c9de06b7025de2d6d87d8f3c63a8bb6474baeb017eed3c7675be6b0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langchain-0.2.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for hotdata_langchain-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c37e12c629ba94c087ad167685d1841b829252e4b904d57dafcbf2e5883b63cc
MD5 c87cbdd8911686eb6f05f3cae484ca6d
BLAKE2b-256 c7ba96bed3b27def257672143b0fcd5e42cfd14081c27c261af225978194f46a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langchain-0.2.2-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