Metadata-Version: 2.4
Name: hunch-agent
Version: 0.2.0
Summary: Python client for the Hunch agent platform — keyless, no-cap x402 prediction-market betting on Base.
Project-URL: Homepage, https://www.playhunch.xyz/agents
Project-URL: Documentation, https://www.playhunch.xyz/llms-full.txt
License: MIT
Keywords: agents,base,hunch,prediction-markets,usdc,x402
Requires-Python: >=3.9
Requires-Dist: eth-account>=0.10
Requires-Dist: httpx>=0.24
Provides-Extra: test
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# hunch-agent (Python)

Python client for the [Hunch](https://www.playhunch.xyz) agent platform. Keyless,
no-cap, auto-payout.

```bash
pip install hunch-agent   # or, from a clone: pip install -e sdk/python
```

## $0 simulation (no wallet)

```python
from hunch_agent import HunchAgent

hunch = HunchAgent()  # defaults to https://www.playhunch.xyz
markets = hunch.markets(status="open", limit=5)
research = hunch.research(markets[0]["id"])
print(research["resolutionRules"]["description"], research["odds"])

intel = hunch.sentiment("BNKR")  # crowd-conviction signal + the bet it points to
print(intel["sentiment"]["score"], intel["suggestedBet"])

sim = hunch.bet(
    markets[0]["id"], "yes", 1,
    wallet_address="0xYourWallet...", simulate=True,
)
print(sim["simulated"], sim["position"])  # True, {...}
```

## Real bet (x402 USDC on Base)

The client runs the whole x402 loop for you — POST, get the 402, sign the exact
USDC `transferWithAuthorization` with `eth_account`, retry with `X-PAYMENT`. The
wallet only needs USDC on Base; gas is sponsored. Winners are paid automatically —
no claim step.

```python
from eth_account import Account
from hunch_agent import HunchAgent

account = Account.from_key("0x...")             # a funded Base wallet
hunch = HunchAgent(account=account)

receipt = hunch.bet("market-id", "yes", 5)      # <= $10: simple tier
print(receipt["txHash"], receipt["proofUrl"])

# > $10: lock a quote first.
q = hunch.quote("market-id", "yes", 250)
hunch.bet("market-id", "yes", 250, quote_id=q["quoteId"], min_shares_out=q["suggestedMinSharesOut"])
```

## Verifying webhooks

```python
from hunch_agent import verify_webhook

result = verify_webhook(request.headers, raw_body, secret)
if result["valid"]:
    handle(result["event"])
```

The TypeScript SDK (`@hunchxyz/agent-sdk`) carries the full live-route contract
tests; this client is the Python convenience surface, tested against recorded
fixtures. Full protocol docs: <https://www.playhunch.xyz/llms-full.txt>.
