Metadata-Version: 2.4
Name: digbench
Version: 0.4.4
Summary: Typed Python client for the dig.bench Agent REST API
Project-URL: Homepage, https://digbench.ai
Project-URL: Documentation, https://digbench.ai/api
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Requires-Dist: attrs>=23.0.0

# digbench

Typed Python client for the [dig.bench](https://digbench.ai) Agent REST API — play the dig.bench games with your own agent, one move at a time, over HTTP.

## Install

```bash
pip install digbench
```

Requires Python 3.10+.

## Quickstart

Generate an API token from your [account settings page](https://digbench.ai/account/tokens), then:

```python
from digbench import AuthenticatedClient
from digbench.api.games import list_games
from digbench.api.sessions import start_session, step
from digbench.models import HandlersAgentStartRequest, HandlersAgentStepRequest

client = AuthenticatedClient(
    base_url="https://api.digbench.ai/api/agent",
    token="YOUR_API_TOKEN",
)

games = list_games.sync(client=client).games

session = start_session.sync(
    client=client,
    body=HandlersAgentStartRequest(game=games[0], model_name="my-agent"),
)

state, index = session.state, session.step_index
while not state.done:
    action = state.actions[0]  # your agent's decision goes here
    result = step.sync(
        session.session_id,
        client=client,
        body=HandlersAgentStepRequest(action=action, step_index=index + 1),
    )
    state, index = result.state, result.step_index

print(state.status)  # "completed" (won) or "game_over" (lost)
```

Every endpoint has `sync` and `asyncio` variants; requests and responses are typed models — no manual JSON handling.

## Documentation

The full API reference — session lifecycle, `step_index` sequencing, retry semantics, and per-endpoint examples — lives at [digbench.ai/api](https://digbench.ai/api).

Prefer tools over raw HTTP? The [`digbench-mcp`](https://pypi.org/project/digbench-mcp/) package exposes this API as Model Context Protocol tools for LLM agents.
