Skip to main content

HatiData Agent SDK

PyPI version Python versions License

RAM for Agents — Python SDK for AI agents to query HatiData's in-VPC data warehouse with sub-10ms latency via Postgres wire protocol.

Installation

pip install hatidata-agent

# With async support
pip install hatidata-agent[async]

# With LangChain support
pip install hatidata-agent[langchain]

# With MCP server
pip install hatidata-agent[mcp]

# Everything
pip install hatidata-agent[all]

Quick Start

from hatidata_agent import HatiDataAgent

agent = HatiDataAgent(
    host="proxy.internal",
    port=5439,
    agent_id="my-agent",
    framework="langchain",
)

# Simple query
rows = agent.query("SELECT * FROM customers WHERE status = 'active' LIMIT 10")
print(rows)  # [{"id": 1, "name": "Acme Corp", ...}, ...]

Features

  • Sub-10ms query latency -- In-VPC execution, no data leaves your network
  • Postgres wire protocol -- Works with any Postgres client library
  • Reasoning chain tracking -- Multi-step audit trails for agent workflows
  • RAG context retrieval -- Full-text and vector similarity search
  • LangChain integration -- Drop-in SQLDatabase replacement for LangChain agents
  • MCP server -- Expose HatiData as tools for Claude and other MCP-compatible agents
  • Agent identification -- Per-agent billing, priority scheduling, and audit via Postgres startup parameters
  • Snowflake SQL compatible -- Bring existing queries without rewrites

Reasoning Chain Tracking

Track multi-step reasoning chains for audit and debugging:

with agent.reasoning_chain("req-001") as chain:
    # Step 0: Discover tables
    tables = chain.query("SELECT table_name FROM information_schema.tables")

    # Step 1: Get relevant data
    customers = chain.query("SELECT * FROM customers WHERE tier = 'enterprise'", step=1)

    # Step 2: Aggregate
    revenue = chain.query("SELECT SUM(revenue) FROM orders WHERE customer_id IN (...)", step=2)

RAG Context Retrieval

# Full-text search
context = agent.get_context("customers", "enterprise accounts in US", top_k=5)

# Vector similarity search
context = agent.get_rag_context("docs", "embedding", query_vector, top_k=10)

LangChain Integration

from hatidata_agent.langchain import HatiDataSQLDatabase
from langchain.agents import create_sql_agent

db = HatiDataSQLDatabase(
    host="proxy.internal",
    port=5439,
    agent_id="sql-agent-1",
)

agent = create_sql_agent(llm=llm, db=db, verbose=True)
result = agent.run("How many enterprise customers do we have?")

MCP Server

Run as an MCP server for Claude and other MCP-compatible agents:

# Start the MCP server
hatidata-mcp-server --host proxy.internal --port 5439

# Or add to Claude Code's MCP config:
# ~/.claude/mcp.json
{
  "mcpServers": {
    "hatidata": {
      "command": "hatidata-mcp-server",
      "args": ["--host", "proxy.internal", "--port", "5439"]
    }
  }
}

MCP Tools

Tool Description
query Execute SQL and return JSON results
list_tables List available tables
describe_table Get table schema
get_context RAG context retrieval via full-text search

Agent Identification

The SDK automatically identifies agents via Postgres startup parameters:

Parameter Purpose
hatidata_agent_id Unique agent identifier
hatidata_framework AI framework (langchain, crewai, autogen, etc.)
hatidata_priority Scheduling priority (low, normal, high, critical)
hatidata_request_id Request/reasoning chain ID
hatidata_reasoning_step Step number within a chain

These enable per-agent billing, priority scheduling, audit trails, and the Agent Tax Report showing savings vs legacy cloud warehouses.

Documentation

Full documentation is available at docs.hatiosai.com/hatidata.

License

Apache License 2.0. Copyright (c) Marviy Pte Ltd. See LICENSE for details.

Metadata

Release files for hatidata-agent 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hatidata-agent 0.4.0
File Size Uploaded
hatidata_agent-0.4.0.tar.gz 31.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatidata-agent 0.4.0
File Interpreter ABI Platform
hatidata_agent-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 64.5 kB

Release files / hatidata_agent-0.4.0.tar.gz

Download URL hatidata_agent-0.4.0.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6585cd731b20a448a2ed94bf2ff03be0de6049995abd13d2a0d0e65d493932d4
BLAKE2b-256 checksum
How to use checksums
f7258b75d975973056bd78a373544b2669123a08a39b940c1e0c24f5b7bfcd3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / hatidata_agent-0.4.0-py3-none-any.whl

Download URL hatidata_agent-0.4.0-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb6c99ea9b102a49c7831775a9f234b671eb1aa186e976cc53adfbb03f48021e
BLAKE2b-256 checksum
How to use checksums
38747066ffbb85f783e81542dcdb366eb1cde07ef26c641acb78e1ce9e4ed29f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page