Metadata-Version: 2.4
Name: life-haima
Version: 0.1.0
Summary: Multi-framework x402 payment SDK for AI agents — Python bindings for Life Agent OS Haima subsystem
Project-URL: Homepage, https://github.com/broomva/life
Project-URL: Repository, https://github.com/broomva/life
Project-URL: Documentation, https://docs.broomva.tech/haima
Project-URL: Issues, https://github.com/broomva/life/issues
Author-email: Carlos Escobar <carlos@broomva.tech>, Broomva <carlos@broomva.tech>
License-Expression: MIT
Keywords: agent-os,ai-agents,haima,life,payments,web3,x402
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: eth-account>=0.13
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Provides-Extra: all
Requires-Dist: crewai>=0.80; extra == 'all'
Requires-Dist: langchain-core>=0.3; extra == 'all'
Provides-Extra: crewai
Requires-Dist: crewai>=0.80; extra == 'crewai'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3; extra == 'langchain'
Description-Content-Type: text/markdown

# haima

Multi-framework x402 payment SDK for AI agents. Add payments to your LangChain, LangGraph, or CrewAI agent in 5 minutes.

## Install

```bash
pip install haima                    # Core SDK
pip install haima[langchain]         # + LangChain/LangGraph
pip install haima[crewai]            # + CrewAI
pip install haima[all]               # Everything
```

## Quick Start

```python
from haima import HaimaClient

async with HaimaClient(facilitator_url="https://haima.broomva.tech") as client:
    receipt = await client.pay(
        recipient="0x742d35Cc6634C0532925a3b844Bc9e7595916Da2",
        amount_micro_usd=100,
        task_id="translate-doc",
    )
    print(f"Settled: {receipt.receipt.tx_hash}")
```

## LangChain / LangGraph

```python
from haima.integrations.langchain import haima_pay_tool
from langgraph.prebuilt import create_react_agent

tool = haima_pay_tool(facilitator_url="https://haima.broomva.tech")
agent = create_react_agent(llm, [tool])
```

## CrewAI

```python
from haima.integrations.crewai import HaimaPayTool
from crewai import Agent

tool = HaimaPayTool(facilitator_url="https://haima.broomva.tech")
agent = Agent(role="Payment Processor", tools=[tool])
```

## x402 Middleware

Transparent payment handling for any HTTP request:

```python
from haima import HaimaWallet, X402Middleware

middleware = X402Middleware(wallet=HaimaWallet.generate())
response = await middleware.get("https://api.example.com/premium-data")
# 402 responses are auto-signed and retried
```

## Configuration

| Env Var | Description |
|---------|-------------|
| `HAIMA_PRIVATE_KEY` | Wallet private key (hex) |
| `HAIMA_FACILITATOR_URL` | Facilitator endpoint |

## How It Works

1. Agent makes a payment request via `client.pay()`
2. SDK signs the payment with the agent's secp256k1 wallet
3. Signed payment submitted to Haima facilitator
4. Facilitator settles on-chain via USDC (Base L2)
5. Receipt returned with transaction hash

All amounts in **micro-USD** (1 USD = 1,000,000 μc).
