Skip to content

Commit 9ee0abb

Browse files
committed
Simplify README for faster understanding
1 parent 8952e6e commit 9ee0abb

1 file changed

Lines changed: 117 additions & 134 deletions

File tree

README.md

Lines changed: 117 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -8,101 +8,129 @@
88

99
![agentproof overview](assets/agentproof-hero.svg)
1010

11-
`agentproof` is an open-source Python library for agent-oriented verification challenges.
12-
It gives Python services a clean way to issue deterministic, machine-checkable challenges that
13-
are easier for programmatic agents to solve than for humans to complete manually.
11+
`agentproof` is a Python library for agent-oriented verification challenges.
12+
It lets a service issue a structured challenge, lets an agent solve it, and verifies the result
13+
deterministically on the server.
1414

15-
The library does not claim cryptographic proof of model provenance. It focuses on a narrower,
16-
defensible goal: structured challenge-response verification.
17-
18-
## Why this exists
19-
20-
Traditional CAPTCHA systems try to separate humans from bots. `agentproof` flips that framing:
21-
it helps you design challenge-response checks that favor capable software agents and remain
22-
verifiable on the server.
23-
24-
This is useful when you want to:
25-
26-
- gate access to agent-focused endpoints
27-
- experiment with reverse-CAPTCHA style flows
28-
- add a deterministic challenge layer to evaluation or abuse-control pipelines
29-
- prototype agent-friendly verification without inventing your own format from scratch
30-
31-
## Design goals
32-
33-
- Keep verification deterministic and easy to reason about
34-
- Make payloads JSON-friendly for APIs and job systems
35-
- Keep the public API narrow and typed
36-
- Document the threat model instead of overselling the guarantees
37-
- Stay lightweight enough for experiments and production prototypes
38-
39-
## Features
40-
41-
- Typed Python API with a small public surface
42-
- Deterministic challenge generation, solving, and verification
43-
- Pluggable challenge families behind a shared protocol
44-
- JSON-serializable payloads for APIs, queues, and services
45-
- Reference CLI for demos and integration tests
46-
- Built-in documentation, examples, CI, and release automation
47-
48-
## Challenge families
49-
50-
| Challenge type | Purpose | Verification style |
51-
| --- | --- | --- |
52-
| `proof_of_work` | Add deterministic compute cost | Leading-zero SHA256 check |
53-
| `semantic_math_lock` | Favor structured text generation | Exact word constraints and ASCII initial sum |
54-
55-
## Installation
15+
Install:
5616

5717
```bash
5818
pip install agentproof-ai
5919
```
6020

61-
The published distribution name is `agentproof-ai`, while the import remains `agentproof`:
21+
Import:
6222

6323
```python
6424
import agentproof
6525
```
6626

67-
For local development:
27+
## What problem it solves
6828

69-
```bash
70-
uv sync --extra dev --extra docs --extra demo
71-
```
29+
Traditional CAPTCHA asks "are you human?".
7230

73-
## Public API
31+
`agentproof` asks a different question:
7432

75-
```python
76-
from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
77-
```
33+
"Can this client complete an agent-friendly, machine-checkable challenge?"
34+
35+
That is useful when you want to:
36+
37+
- gate agent-focused endpoints
38+
- prototype reverse-CAPTCHA style flows
39+
- add a structured verification step before allowing API access
40+
- experiment with challenge-response systems for LLM agents
7841

79-
## Quickstart
42+
## How it works
43+
44+
1. Your server generates a challenge JSON payload.
45+
2. The agent reads it and produces a structured response.
46+
3. Your server verifies the response.
47+
4. Verification returns `ok: true` or a deterministic failure reason.
48+
49+
## Smallest example
8050

8151
```python
8252
from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
8353

84-
spec = ChallengeSpec(challenge_type="proof_of_work", difficulty=18, ttl_seconds=120)
85-
challenge = generate_challenge(spec)
54+
challenge = generate_challenge(
55+
ChallengeSpec(challenge_type="proof_of_work", difficulty=8, ttl_seconds=60)
56+
)
8657
response = solve_challenge(challenge)
8758
result = verify_response(challenge, response)
8859

8960
assert result.ok
9061
```
9162

92-
### Example output
63+
## What a real challenge looks like
64+
65+
Example `proof_of_work` challenge:
66+
67+
```json
68+
{
69+
"challenge_id": "6f2c8e4a91d3b5c1",
70+
"challenge_type": "proof_of_work",
71+
"prompt": "Find a nonce such that sha256_hex(payload + ':' + nonce) starts with 8 leading zero bits.",
72+
"issued_at": "2026-03-07T01:10:00+00:00",
73+
"expires_at": "2026-03-07T01:11:00+00:00",
74+
"version": "1",
75+
"data": {
76+
"algorithm": "sha256",
77+
"difficulty": 8,
78+
"salt": "a14d22b8f91c77e2",
79+
"payload": "6f2c8e4a91d3b5c1:a14d22b8f91c77e2"
80+
}
81+
}
82+
```
83+
84+
Example agent response:
85+
86+
```json
87+
{
88+
"challenge_id": "6f2c8e4a91d3b5c1",
89+
"challenge_type": "proof_of_work",
90+
"payload": {
91+
"nonce": "223",
92+
"hash": "00bf9b61a372cbd81bef570069b655fd02ef299cc29e9e59d5739e86f5fb6974"
93+
}
94+
}
95+
```
96+
97+
Example verification result:
9398

9499
```json
95100
{
96101
"ok": true,
97102
"reason": "ok",
98103
"details": {
99-
"hash": "0007f5...",
100-
"nonce": "18423"
104+
"hash": "00bf9b61a372cbd81bef570069b655fd02ef299cc29e9e59d5739e86f5fb6974",
105+
"nonce": "223"
101106
}
102107
}
103108
```
104109

105-
### Semantic challenge example
110+
## Why this fits agents
111+
112+
These challenges are good for agents because they are:
113+
114+
- machine-readable
115+
- automatable
116+
- exact
117+
- easy to verify on the server
118+
119+
Agents are typically better than humans at:
120+
121+
- reading structured JSON
122+
- following exact constraints
123+
- iterating until a condition is satisfied
124+
- returning properly formatted machine output
125+
126+
## Built-in challenge types
127+
128+
| Challenge type | What the agent does | How it is verified |
129+
| --- | --- | --- |
130+
| `proof_of_work` | Search for a nonce | Recompute hash and check difficulty |
131+
| `semantic_math_lock` | Produce constrained text | Check required words, exact word count, and initial-letter sum |
132+
133+
## Semantic example
106134

107135
```python
108136
from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
@@ -117,122 +145,77 @@ challenge = generate_challenge(
117145
response = solve_challenge(challenge)
118146
result = verify_response(challenge, response)
119147

120-
assert result.ok
121148
print(response.payload["text"])
149+
print(result.to_dict())
122150
```
123151

124-
### Service integration example
152+
Typical response text:
125153

126-
```python
127-
from agentproof import AgentResponse, Challenge, ChallengeSpec, generate_challenge, verify_response
128-
129-
challenge = generate_challenge(
130-
ChallengeSpec(challenge_type="semantic_math_lock", options={"topic": "security", "word_count": 7})
131-
)
154+
```text
155+
security demands careful metrics metrics metrics metrics
156+
```
132157

133-
# ... send challenge.to_dict() to a client ...
158+
## API shape
134159

135-
response = AgentResponse(
136-
challenge_id=challenge.challenge_id,
137-
challenge_type=challenge.challenge_type,
138-
payload={"text": "security demands careful metrics metrics metrics metrics"},
139-
)
140-
141-
result = verify_response(challenge, response)
160+
```python
161+
from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
162+
from agentproof import Challenge, AgentResponse, VerificationResult
142163
```
143164

144-
### CLI roundtrip
165+
## CLI
166+
167+
Generate, solve, and verify from the command line:
145168

146169
```bash
147170
agentproof generate proof_of_work --difficulty 16 --output challenge.json
148171
agentproof solve challenge.json --output response.json
149172
agentproof verify challenge.json response.json
150173
```
151174

152-
## Verification model
153-
154-
```mermaid
155-
sequenceDiagram
156-
participant S as Service
157-
participant A as Agent client
158-
S->>A: Issue challenge JSON
159-
A->>A: Solve challenge
160-
A->>S: Submit structured response
161-
S->>S: Verify deterministically
162-
S-->>A: Accept or reject
163-
```
164-
165-
## CLI
166-
167-
Generate a challenge:
175+
## Demo
168176

169-
```bash
170-
agentproof generate proof_of_work --difficulty 18
171-
```
177+
A runnable local demo lives in [`demo/`](/home/borislav/VSCode/agentproof/demo).
172178

173-
Solve a challenge from a file:
179+
Run it with:
174180

175181
```bash
176-
agentproof solve challenge.json
182+
uv run python demo/app.py
177183
```
178184

179-
Verify a response:
185+
Then open:
180186

181-
```bash
182-
agentproof verify challenge.json response.json
187+
```text
188+
http://127.0.0.1:8765
183189
```
184190

185-
## Demo project
191+
## What this does not prove
186192

187-
A runnable local demo lives in [`demo/`](/home/borislav/VSCode/agentproof/demo). It is intended
188-
for opening in VSCode and trying the package end-to-end with a small UI and example service flow.
189-
190-
## Threat model
191-
192-
`agentproof` helps with agent-oriented challenge-response flows. It does **not** prove:
193+
`agentproof` does not prove:
193194

194195
- model provenance
195196
- provider identity
196197
- hardware-backed execution
197-
- immunity against determined scripted attackers
198-
199-
Use it as one verification signal, not as a complete trust system.
200-
201-
## Security and scope
202-
203-
`agentproof` is not an identity or attestation system. It does not prove that a request came
204-
from a specific model provider or hardware-backed agent. The current scope is challenge-response
205-
verification with explicit tradeoffs documented in the threat model.
198+
- protection against determined custom automation
206199

207-
## Modern repo defaults
208-
209-
- GitHub Actions CI across Python 3.10 to 3.13
210-
- Typed package with `py.typed`
211-
- Coverage gate at 90%+
212-
- MkDocs documentation site
213-
- Dependabot config and issue templates
214-
- PyPI release workflow prepared for trusted publishing
200+
It is a challenge-response library, not an identity system.
215201

216202
## Development
217203

218204
```bash
205+
uv sync --extra dev --extra docs --extra demo
219206
uv run ruff check .
220207
uv run mypy .
221208
uv run pytest
222209
uv run python -m build
223210
uv run mkdocs build --strict
224211
```
225212

226-
## Release model
227-
228-
- `main` runs lint, type checks, tests, package builds, and docs builds in GitHub Actions
229-
- version tags trigger package publishing through the release workflow
230-
- PyPI publishing is configured for trusted publishing, so the repository should be linked to the
231-
target PyPI project before pushing a release tag
232-
233-
## Contributing
213+
## Links
234214

235-
See [CONTRIBUTING.md](CONTRIBUTING.md) for local setup and quality checks.
215+
- PyPI: https://pypi.org/project/agentproof-ai/
216+
- Docs: https://bnovik0v.github.io/agentproof/
217+
- Demo: [demo/README.md](/home/borislav/VSCode/agentproof/demo/README.md)
218+
- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
236219

237220
## License
238221

0 commit comments

Comments
 (0)