Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haunt

hauntapi

Web extraction for AI agents. Turn any permitted public web page into clean JSON or Markdown with one call, as a plain client or a LangChain, LlamaIndex, or CrewAI tool.

PyPI Python License: MIT

Website · Docs · Get a free key · MCP server


Haunt reads a public page and hands your agent structured data back. When a page is blocked, login-walled, CAPTCHA-gated, or too thin to trust, it returns an honest machine-readable error instead of fabricated data, so your agent can retry, switch source, skip, or ask a human.

Free tier: 1,000 credits a month, no card.

Install

pip install hauntapi

Quick start

from hauntapi import Haunt

haunt = Haunt("your_api_key")          # or set HAUNT_API_KEY
result = haunt.extract("https://news.ycombinator.com/", "the top five story titles")

if result.success:
    print(result.data)                 # {"name": "...", "price": "..."}
else:
    print(result.error_code)           # access_denied, login_required, not_found, ...

Markdown for RAG, notes, or .md files:

result = haunt.extract("https://fastapi.tiangolo.com/tutorial/", "the page content",
                       response_format="markdown")

Map and crawl a bounded site on any paid plan:

site = haunt.map_site(
    "https://fastapi.tiangolo.com/",
    include_paths=["/tutorial/*"],
    limit=100,
)

crawl = haunt.crawl_site(
    "https://fastapi.tiangolo.com/tutorial/",
    "the page title and main summary",
    limit=10,
)

print(crawl.complete, crawl.partial, crawl.failed)
print(crawl.credits_used)

Mapping costs no credits. Complete crawl pages use the normal extraction price; partial and failed pages cost nothing. Discovery respects robots rules, stays on the requested site, and Haunt does not store fetched crawl content.

Use it as an agent tool

The same client, wired into the framework you already use. Lazy imports, so you only need the one you install.

LangChain

from hauntapi import langchain_tool
tools = [langchain_tool()]

LlamaIndex

from hauntapi import llamaindex_tool
tools = [llamaindex_tool()]

CrewAI

from crewai import Agent
from hauntapi import crewai_tool
researcher = Agent(role="Researcher", tools=[crewai_tool()])

Need the framework installed too? pip install "hauntapi[langchain]" (or llamaindex, crewai).

Why honest failure matters for agents

An agent that receives fabricated data from a blocked page acts on garbage and cannot tell. Haunt returns error codes like access_denied, login_required, captcha_required, and not_found, so your agent branches on reality instead of a hallucination.

Also in the box

  • haunt.extract_batch([...]) for many URLs in one call
  • haunt.map_site(...) for up to 500 same-site URLs at zero credits on a paid plan
  • haunt.crawl_site(...) for structured extraction across up to 20 mapped pages
  • haunt.extract_auth(...) for pages you are allowed to access with your own headers
  • haunt.usage() for remaining credits
  • Full REST and MCP docs: https://hauntapi.com/docs

MIT licensed.

About

Python SDK for Haunt API — extract clean data from any website with one API call.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages