11# agentproof
22
3+ ![ Distribution] ( https://img.shields.io/badge/distribution-agentproof--ai-0f766e )
4+ ![ Python] ( https://img.shields.io/badge/python-3.10%20to%203.13-1f6feb )
5+ ![ CI] ( https://github.com/bnovik0v/agentproof/actions/workflows/ci.yml/badge.svg )
6+ ![ Docs] ( https://github.com/bnovik0v/agentproof/actions/workflows/docs.yml/badge.svg )
7+ [ ![ License] ( https://img.shields.io/github/license/bnovik0v/agentproof )] ( LICENSE )
8+
9+ ![ agentproof overview] ( assets/agentproof-hero.svg )
10+
311` agentproof ` is an open-source Python library for agent-oriented verification challenges.
4- It helps applications issue deterministic, machine-checkable challenges that are easier for
5- programmatic agents to solve than for humans to complete manually.
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.
614
715The library does not claim cryptographic proof of model provenance. It focuses on a narrower,
816defensible goal: structured challenge-response verification.
917
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+
1039## Features
1140
12- - Typed Python API
13- - Deterministic challenge generation and verification
14- - Pluggable challenge families
15- - Reference CLI for local demos and integration tests
16- - Testable JSON payloads for web APIs and backend services
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
1747
18- ## Included challenge families
48+ ## Challenge families
1949
20- - ` proof_of_work ` : a hashcash-style puzzle
21- - ` semantic_math_lock ` : a human-readable text challenge with exact measurable constraints
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 |
2254
2355## Installation
2456
2557``` bash
26- pip install agentproof
58+ pip install agentproof-ai
59+ ```
60+
61+ The published distribution name is ` agentproof-ai ` , while the import remains ` agentproof ` :
62+
63+ ``` python
64+ import agentproof
2765```
2866
2967For local development:
3068
3169``` bash
32- python -m venv .venv
33- source .venv/bin/activate
34- pip install -e " .[dev,docs]"
70+ uv sync --extra dev --extra docs --extra demo
71+ ```
72+
73+ ## Public API
74+
75+ ``` python
76+ from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
3577```
3678
3779## Quickstart
3880
3981``` python
40- from agentproof import AgentResponse, ChallengeSpec, generate_challenge, solve_challenge, verify_response
82+ from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
4183
4284spec = ChallengeSpec(challenge_type = " proof_of_work" , difficulty = 18 , ttl_seconds = 120 )
4385challenge = generate_challenge(spec)
@@ -47,6 +89,79 @@ result = verify_response(challenge, response)
4789assert result.ok
4890```
4991
92+ ### Example output
93+
94+ ``` json
95+ {
96+ "ok" : true ,
97+ "reason" : " ok" ,
98+ "details" : {
99+ "hash" : " 0007f5..." ,
100+ "nonce" : " 18423"
101+ }
102+ }
103+ ```
104+
105+ ### Semantic challenge example
106+
107+ ``` python
108+ from agentproof import ChallengeSpec, generate_challenge, solve_challenge, verify_response
109+
110+ challenge = generate_challenge(
111+ ChallengeSpec(
112+ challenge_type = " semantic_math_lock" ,
113+ ttl_seconds = 90 ,
114+ options = {" topic" : " security" , " word_count" : 7 },
115+ )
116+ )
117+ response = solve_challenge(challenge)
118+ result = verify_response(challenge, response)
119+
120+ assert result.ok
121+ print (response.payload[" text" ])
122+ ```
123+
124+ ### Service integration example
125+
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+ )
132+
133+ # ... send challenge.to_dict() to a client ...
134+
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)
142+ ```
143+
144+ ### CLI roundtrip
145+
146+ ``` bash
147+ agentproof generate proof_of_work --difficulty 16 --output challenge.json
148+ agentproof solve challenge.json --output response.json
149+ agentproof verify challenge.json response.json
150+ ```
151+
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+
50165## CLI
51166
52167Generate a challenge:
@@ -67,23 +182,58 @@ Verify a response:
67182agentproof verify challenge.json response.json
68183```
69184
185+ ## Demo project
186+
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+
194+ - model provenance
195+ - provider identity
196+ - hardware-backed execution
197+ - immunity against determined scripted attackers
198+
199+ Use it as one verification signal, not as a complete trust system.
200+
70201## Security and scope
71202
72203` agentproof ` is not an identity or attestation system. It does not prove that a request came
73204from a specific model provider or hardware-backed agent. The current scope is challenge-response
74205verification with explicit tradeoffs documented in the threat model.
75206
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
215+
76216## Development
77217
78218``` bash
79- ruff check .
80- ruff format --check .
81- mypy .
82- pytest
83- python -m build
219+ uv run ruff check .
220+ uv run mypy .
221+ uv run pytest
222+ uv run python -m build
223+ uv run mkdocs build --strict
84224```
85225
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
234+
235+ See [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for local setup and quality checks.
236+
86237## License
87238
88239MIT
89-
0 commit comments