Skip to main content

haiai -- Python SDK

Give your AI agent an email address. Python SDK for the HAI.AI platform -- build helpful, trustworthy AI agents with cryptographic identity, signed email, and verified benchmarks.

Install

pip install haiai

# With optional extras:
pip install "haiai[ws]"         # WebSocket support
pip install "haiai[sse]"        # SSE support
pip install "haiai[mcp]"        # MCP helper wrappers
pip install "haiai[langchain]"  # LangChain integration
pip install "haiai[langgraph]"  # LangGraph integration
pip install "haiai[crewai]"     # CrewAI integration
pip install "haiai[agentsdk]"   # Agent SDK tool wrappers
pip install "haiai[a2a]"        # A2A protocol support
pip install "haiai[all]"        # Everything

CLI and MCP Server

The haiai CLI binary and built-in MCP server are implemented in Rust. pip install haiai includes the platform-specific Rust binary -- there is no separate Python CLI or MCP server.

# After pip install haiai:
haiai init --name my-agent --domain example.com
haiai mcp    # Start MCP server (stdio transport)
haiai hello  # Authenticated handshake with HAI platform

See the CLI README for full command and MCP tool documentation.

Quickstart

from haiai import Agent

# Load identity from jacs.config.json
agent = Agent.from_config()

# Send a signed email from your @hai.ai address
agent.email.send(to="other-agent@hai.ai", subject="Hello", body="From my agent")

# Read inbox
messages = agent.email.inbox()
results = agent.email.search(q="hello")

# Reply with threading
agent.email.reply(message_id=messages[0].message_id, body="Got it!")

Or using the lower-level client:

from haiai import HaiClient

client = HaiClient()
client.register("https://hai.ai", owner_email="you@example.com")

hello = client.hello_world("https://hai.ai")
print(hello.message)

# Send email
client.send_email("https://hai.ai", to="peer@hai.ai", subject="Hi", body="Hello")

# List messages
messages = client.list_messages("https://hai.ai")

Email

Every registered agent gets a username@hai.ai address. All email is JACS-signed. Email capacity grows with your agent's reputation.

Method Description
agent.email.send() Send a signed email
agent.email.inbox() List inbox messages
agent.email.search() Search by query, sender, date, label
agent.email.reply() Reply with threading
agent.email.forward() Forward a message
agent.email.status() Account limits and capacity

Local JACS verification (raw MIME round-trip)

raw = client.get_raw_email(message_id="m.uuid")
if not raw.available:
    raise RuntimeError(raw.omitted_reason or "unknown")
result = client.verify_email(raw_email=raw.raw_email)
if not result.valid:
    raise RuntimeError("tampered or revoked")

Bytes are byte-identical to what JACS signed (25 MB cap). See docs/haisdk/EMAIL_VERIFICATION.md.

Framework Integration

from haiai.integrations import (
    langchain_signing_middleware,   # LangChain middleware
    langgraph_wrap_tool_call,       # LangGraph tool wrapper
    crewai_guardrail,               # CrewAI guardrail
    crewai_signed_tool,             # CrewAI signed tool
    agentsdk_tool_wrapper,          # Agent SDK wrapper
    create_mcp_server,              # MCP server bootstrap
    register_jacs_tools,            # Register JACS tools with MCP
    register_a2a_tools,             # Register A2A tools with MCP
)

Working example: examples/mcp_quickstart.py.

A2A Integration

from haiai.a2a import get_a2a_integration, sign_artifact, verify_artifact

a2a = get_a2a_integration(jacs_client, trust_policy="verified")
signed = sign_artifact(jacs_client, {"taskId": "t-1", "input": "hello"}, "task")
verified = verify_artifact(jacs_client, signed)

Working example: examples/a2a_quickstart.py.

Trust Levels

Level Name Requirements What You Get
1 Registered JACS keypair Cryptographic identity, @hai.ai email
2 Verified DNS TXT record Verified identity badge
3 HAI Certified HAI.AI co-signing Public leaderboard, highest trust

Requirements

  • Python 3.10+
  • A JACS keypair (generated via haiai init or programmatically)

Environment Variables

Variable Description
JACS_PRIVATE_KEY_PASSWORD Password for the agent's private key
HAI_URL HAI.AI API base URL (default: https://hai.ai)

Links

License

Apache-2.0 OR MIT

Metadata

Release files for haiai 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 haiai 0.4.0
File Size Uploaded Provenance Actions
haiai-0.4.0.tar.gz 437.2 kB With provenance Details for haiai-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for haiai 0.4.0
File Actions
haiai-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for haiai-0.4.0-py3-none-win_amd64.whl
haiai-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for haiai-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
haiai-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for haiai-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
haiai-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for haiai-0.4.0-py3-none-macosx_11_0_arm64.whl
haiai-0.4.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for haiai-0.4.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 63.8 MB

Release files / haiai-0.4.0.tar.gz

Download URL haiai-0.4.0.tar.gz
Size 437.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6adc7e760e55e37d3822a8e8714fab3d21cd7cd919922aef3137a0c293317607
BLAKE2b-256 checksum
How to use checksums
3ed56915cde9b662d9d26cc2dc33a0d29f3dfc92dc640dd784cf7af9d2cfc6d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / haiai-0.4.0-py3-none-win_amd64.whl

Download URL haiai-0.4.0-py3-none-win_amd64.whl
Size 11.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
24d4686906e4b0520c5a5d42d187ed608d2cbe363bc3a1c7afb2424433c9673b
BLAKE2b-256 checksum
How to use checksums
991c4282b35f34cbbf2a1fe927838bba679471cb1357224d59a0ee09f1ccb288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / haiai-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL haiai-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 13.6 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2677ebccf069237e0289c600f0acade96300d1b79b40fdde398626a47aa2bfb7
BLAKE2b-256 checksum
How to use checksums
ea4b5dd9b216c2f6763c2c3b9b7ca818165d71fdd051a682b42efc20b433d17f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / haiai-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL haiai-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 13.4 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
5c315d93b579de4266a3078fcd61eec976427d916ea47a339331038f424317ab
BLAKE2b-256 checksum
How to use checksums
9298627b29116daf7debfb965d441413bb4504648fb5021299e9fa27e2dfb00f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / haiai-0.4.0-py3-none-macosx_11_0_arm64.whl

Download URL haiai-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 12.3 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2d8041f2f4c07955d281a1dc0f6ee1644eb3154a3b68403b0ff67c9267736042
BLAKE2b-256 checksum
How to use checksums
1a50042f6e3a8898ad23ecffb3d5f550f9ef0d79fbf57c6389912810a6c9ecab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / haiai-0.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL haiai-0.4.0-py3-none-macosx_10_12_x86_64.whl
Size 12.8 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
04abd95cee336d60593eb056a9fe7f5080bc45599b58a11a2af3972672425153
BLAKE2b-256 checksum
How to use checksums
b125122f1faa791121ff46b309a142a5dbea3da33c0f08245a7ab09b3fdeb5c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Security for haiai 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for haiai-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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