Skip to main content

Tool implementations for Haive agents — search, calculators, APIs, and integrations

Project description

haive-tools

PyPI version Python Versions License: MIT CI Docs PyPI Downloads

Tool implementations for Haive agents — search, calculators, APIs, code execution, and integrations.

A curated collection of LangChain-compatible tools, ready to drop into any Haive agent. Each tool is wrapped, tested, and exposed via a consistent interface. Use them with ReactAgent, MultiAgent, MemoryAgent, or any agent that takes tools.


Why haive-tools?

LangChain has hundreds of tools but they're scattered across packages, have inconsistent interfaces, and many require fiddly setup. haive-tools curates the most useful ones, fixes their quirks, and packages them as a coherent toolkit.

Tool categories

Category Tools What they do
🔍 Search Tavily, Google Search, DuckDuckGo, SerpAPI, Brave Search Web search with structured results
🧮 Calculators Python REPL, math expressions, Wolfram Alpha Calculation and symbolic math
🌐 Web Fetch URL, scrape HTML, parse JSON HTTP requests and web scraping
🐍 Code Python REPL (sandboxed), shell commands Code execution
📊 Data CSV/JSON parsers, structured extractors Data processing
🎮 Fun APIs Pokémon (PokéBase), Pokémon TCG API wrappers for testing
📖 Documents PDF reader, docx parser, web fetcher Document loading
🗄️ Databases SQL execution, schema inspection Database tools

Installation

pip install haive-tools

# For Tavily search:
pip install haive-tools[tavily]

# For all extras:
pip install haive-tools[all]

Quick Start

Web Search with Tavily

from haive.tools.search import tavily_search_tool
from haive.agents.react.agent import ReactAgent
from haive.core.engine.aug_llm import AugLLMConfig
import os

# Set TAVILY_API_KEY in env
os.environ["TAVILY_API_KEY"] = "tvly-..."

agent = ReactAgent(
    name="researcher",
    engine=AugLLMConfig(
        tools=[tavily_search_tool],
        system_message="Use the search tool to find information.",
    ),
    max_iterations=5,
)

result = agent.run("What are the latest advances in quantum computing in 2025?")

Calculator + Web Search Combo

from haive.tools.search import tavily_search_tool
from haive.tools.calculators import python_calculator
from haive.agents.react.agent import ReactAgent
from haive.core.engine.aug_llm import AugLLMConfig

agent = ReactAgent(
    name="research_assistant",
    engine=AugLLMConfig(
        tools=[tavily_search_tool, python_calculator],
        system_message="Use search for facts and calculator for math.",
    ),
)

result = agent.run("What is the population of Tokyo divided by the area of Japan?")
# Agent: searches for both values, then calculates ratio

Custom Tool Composition

from langchain_core.tools import tool
from haive.tools.search import tavily_search_tool
from haive.tools.web import fetch_url

@tool
def get_weather(city: str) -> str:
    """Get current weather for a city."""
    # ... your custom logic ...
    return f"Sunny, 72°F in {city}"

agent = ReactAgent(
    name="multi_tool",
    engine=AugLLMConfig(tools=[
        tavily_search_tool,
        fetch_url,
        get_weather,
    ]),
)

Tool Routing

All tools work with Haive's automatic tool routing system. You can mix:

  • LangChain BaseTool (from @tool decorator) → routed to langchain_tool
  • Pydantic models with __call__ → routed to pydantic_tool (stateful tools)
  • Plain callables → routed to function
from pydantic import BaseModel

class StatefulSearchTool(BaseModel):
    """Search tool with configurable settings."""
    api_key: str
    max_results: int = 5
    region: str = "us"

    def __call__(self, query: str) -> str:
        # Each instance has its own state
        return f"Searching {self.region}: {query}"

# Two instances with different config
us_search = StatefulSearchTool(api_key="...", region="us")
eu_search = StatefulSearchTool(api_key="...", region="eu")

agent = ReactAgent(engine=AugLLMConfig(tools=[us_search, eu_search]))

Tool Reference

Search

  • tavily_search_tool — Tavily web search (5 results, news + general)
  • google_search_tool — Google Custom Search API
  • duckduckgo_search_tool — Free DuckDuckGo search
  • brave_search_tool — Brave Search API
  • serpapi_search_tool — SerpAPI for Google/Bing/etc.

Calculators

  • python_calculator — Sandboxed Python REPL for math expressions
  • wolfram_alpha_tool — Symbolic math via Wolfram Alpha API

Web

  • fetch_url — HTTP GET with auto-decoding
  • scrape_url — Scrape HTML with BeautifulSoup
  • parse_json — Parse JSON responses

Code

  • python_repl — Sandboxed Python execution
  • shell_command — Execute shell commands (with safety checks)

Documents

  • read_pdf — Extract text from PDF files
  • read_docx — Parse Word documents
  • web_loader — Load and parse web pages

Documentation

📖 Full documentation: https://pr1m8.github.io/haive-tools/


Related Packages

Package Description
haive-core Foundation: engines, graphs
haive-agents Production agents
haive-mcp Dynamic MCP server tools (1,960+)

License

MIT © pr1m8

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

haive_tools-1.0.1.tar.gz (101.9 kB view details)

Uploaded Source

Built Distribution

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

haive_tools-1.0.1-py3-none-any.whl (162.2 kB view details)

Uploaded Python 3

File details

Details for the file haive_tools-1.0.1.tar.gz.

File metadata

  • Download URL: haive_tools-1.0.1.tar.gz
  • Upload date:
  • Size: 101.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for haive_tools-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2bb7fb45a2177789df4d33a6a740b48d64f2891f00439221ec3a2ddbbfd27aa7
MD5 f6acde608f5b116b43835ab0f8570172
BLAKE2b-256 0a7d41a876a4b4ad64c771cb114fb59830a735e2729d334d29ec8526e79263b9

See more details on using hashes here.

File details

Details for the file haive_tools-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: haive_tools-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 162.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for haive_tools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33631bc5e3066b862bcdfee89b535cdeacf7ca4a1ad58723289272b7123bee30
MD5 55829249c70d8f0e05c321829e6e8187
BLAKE2b-256 bea23712fbc8258fcfc9c285fb4e9378b8966bd0a87b7ce20e65b8c7e46925c8

See more details on using hashes here.

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