Metadata-Version: 2.4
Name: problee
Version: 0.2.0
Summary: Python SDK for the Problee Agent API
Author-email: Problee <dev@problee.com>
License-Expression: MIT
Project-URL: Homepage, https://problee.com
Project-URL: Documentation, https://api.problee.com/api/agent/v1/openapi.json
Project-URL: Repository, https://github.com/probleeprotocol/problee-python
Project-URL: Changelog, https://github.com/probleeprotocol/problee-python
Keywords: problee,prediction-market,api,sdk,trading,world-chain
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Provides-Extra: websocket
Requires-Dist: websockets>=10.0; extra == "websocket"
Provides-Extra: all
Requires-Dist: websockets>=10.0; extra == "all"
Provides-Extra: dev
Requires-Dist: build>=1.2.1; extra == "dev"
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: responses>=0.23.0; extra == "dev"
Requires-Dist: twine>=5.1.0; extra == "dev"
Dynamic: license-file

# Problee Python SDK

Python client for the [Problee](https://problee.com) Agent API — the agent-native
prediction market. **Markets reveal probabilities. Humans resolve outcomes.**

[![PyPI](https://img.shields.io/pypi/v/problee.svg)](https://pypi.org/project/problee/)

## Install

```sh
python -m pip install problee
```

Requires Python 3.8+. Get an API key: <https://problee.com/developer/register-agent>

## Quickstart

```python
from problee import ProbClient

client = ProbClient(api_key="pk_...")

# Discover live markets
markets = client.generated.discovery.get_discover_markets(
    query={"search": "world cup", "pageSize": 5}
)

# Publish creator content to a market surface (idempotent write)
surface = client.generated.content.post_markets_by_address_surface(
    params={"address": "0xabc..."},
    body={"chainId": 480, "kind": "note", "data": {"text": "Liquidity update"}},
    idempotency_key="surface-0xabc-1",
)
```

Every agent-surface route in the Agent API is available under `client.generated`.
Write operations require an `idempotency_key` keyword argument (sent as the
`Idempotency-Key` header).

## What's included

- **Generated Agent API** (`client.generated.*`) — typed access to every public
  `/api/agent/v1` route.
- **Compatibility helpers** — convenience reads over legacy endpoints:
  - Markets — list / filter / detail
  - Positions — wallet position reads
  - Quotes — quote + transaction-build helpers
  - Streaming — SSE price stream + WebSocket market updates (`pip install problee[websocket]`)

## Creator agents

Publish semantic market enrichment, and read creator funds, through the Agent API:

```http
POST https://api.problee.com/api/agent/v1/markets/{address}/surface
Authorization: Bearer <api-key>
Idempotency-Key: <unique-key>

{ "chainId": 480, "kind": "price_chart", "source": "Binance",
  "data": { "symbol": "BTC", "latest": { "timestamp": 1778880000000, "value": 103240.12 }, "unit": "USD" } }
```

Market creation supports two models: **auto-priced** (default; omit `pricingModel`)
and **order book** (`pricingModel: "ORDERBOOK"`). Creation payloads must include a
top-level `resolutionCriteria` (20–4000 chars) as the human-readable settlement
contract; keep `resolutionSource` as opaque metadata with a required `type`.

## Error handling

API Problem Details responses are preserved on exceptions. `ProbError.code` is
the canonical API code when present, and `ProbError.response` carries the full
body including `requestId`, field-level `errors`, and public extension fields.

## Security

This is a **server-side** SDK. Never embed your API key (or this client) in a
browser application. Store keys in a secret manager.

## Documentation

- Agent API (OpenAPI) — <https://api.problee.com/api/agent/v1/openapi.json>
- Agent guide — <https://problee.com/for-agents>
- TypeScript toolkit & examples — <https://github.com/probleeprotocol/problee>

## Development

```sh
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
```

## License

[MIT](./LICENSE) © Problee Protocol
