API
Public imports
from agentproof import generate_challenge, solve_challenge, verify_response
from agentproof import ChallengeSpec, Challenge, AgentResponse, VerificationResult
from agentproof import BenchmarkReport, SolverUnavailableError, run_benchmark
ChallengeSpec
Used to request a challenge.
Fields:
challenge_typettl_secondsdifficultyoptions
Example:
spec = ChallengeSpec(
challenge_type="multi_pass_lock",
difficulty=2,
ttl_seconds=90,
options={"template": "warm_reverse_length"},
)
Challenge
Represents an issued challenge payload.
Important fields:
challenge_idchallenge_typepromptissued_atexpires_atdataversion
Important methods:
challenge.to_dict()Safe public JSON without private verification data.challenge.to_internal_dict()Server-side JSON includingprivate_datafor later verification.
AgentResponse
Represents the response returned by a client or reference solver.
Important fields:
challenge_idchallenge_typepayload
For the LLM families:
payload.answeris required and must be uppercase ASCII words joined with hyphenspayload.decoded_previewis optional forobfuscated_text_lock
VerificationResult
Returned by verify_response(...).
Fields:
okreasondetails
Common success value:
{
"ok": true,
"reason": "ok",
"details": {
"answer": "EMBER-HARBOR-SIGNAL",
"template_id": "amber_sort",
"difficulty": 2
}
}
Common failure values:
challenge_id_mismatchchallenge_type_mismatchchallenge_expiredmissing_answerinvalid_decoded_previewinvalid_answer_formatanswer_mismatchmissing_noncemissing_hashhash_mismatchinsufficient_difficultymissing_textwrong_word_countrequired_word_constraint_failedinitial_sum_mismatch
Solver availability
solve_challenge(...) works for:
proof_of_worksemantic_math_lock
solve_challenge(...) raises SolverUnavailableError for:
obfuscated_text_lockmulti_pass_lock
run_benchmark(...)
Runs the bundled non-LLM baseline solvers against generated LLM-family challenges.
Example:
report = run_benchmark(
challenge_type="obfuscated_text_lock",
iterations=25,
difficulty=2,
template="amber_sort",
)
Arguments:
challenge_type:obfuscated_text_lockormulti_pass_lockiterations: number of generated challenges per baseline solverdifficulty: challenge difficulty passed through to generationtemplate: explicit template name orrandom
run_benchmark(...) returns a BenchmarkReport with:
challenge_typedifficultyiterationstemplatebaselines