Python client for the Hunch agent platform — keyless, no-cap x402 prediction-market betting on Base.
Project description
hunch-agent (Python)
Python client for the Hunch agent platform. Keyless, no-cap, auto-payout.
pip install hunch-agent # or, from a clone: pip install -e sdk/python
$0 simulation (no wallet)
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.
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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hunch_agent-0.2.0.tar.gz.
File metadata
- Download URL: hunch_agent-0.2.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0d3bf6fff707c57dc2aa9fd47ecd6180b5b19f782db98b92b56e3e8e4e1da62
|
|
| MD5 |
4699a3131fd9ff6a7a6ac4e51146d9f9
|
|
| BLAKE2b-256 |
511dd77c1851fc8ba4b0ac57686c770c74109a4ffcaf26b13a6ee3e38fde3e17
|
File details
Details for the file hunch_agent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hunch_agent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e97b80784be53a0348662e945cb95108b5765a17615d5286dccb7f602cde1e80
|
|
| MD5 |
74933f03ebe5a66f36141cb0ecac4432
|
|
| BLAKE2b-256 |
01ebc21b2bdea6474668a26241b0798bccf7c6978629a958b962008d9ea112f5
|