fix(examples): parse the canonical EEP gate response in the langgraph agent#65
Open
ucekmez wants to merge 1 commit into
Open
fix(examples): parse the canonical EEP gate response in the langgraph agent#65ucekmez wants to merge 1 commit into
ucekmez wants to merge 1 commit into
Conversation
… agent
handle_gate_challenge() read a flat {gate_type, amount, currency} body and
split credential/agreement onto 403 by an `error` string. The canonical 402
(gate.402-response.json) and 403 (gate.403-response.json) instead carry
{error, resource, current_tier, required_tier, unmet_requirements[]}, where
every gate type arrives as an unmet requirement with a machine-readable
resolution_hint. The example — the one place an agent-builder copies from —
therefore never matched a real publisher's response.
Rewrite the parser to iterate unmet_requirements and build one proof per
entry, routed on each requirement's type (payment/credential/agreement/
identity/trust/connection), using the canonical proof shapes from
@eep-dev/gates. Add test_agent.py covering payment, multi-requirement,
403 access_forbidden, non-gate errors, and unsatisfiable custom types.
Also make the README and requirements honest: the example inlines the wire
contracts for readability and points to eep-gates/signer/validator for
production, rather than claiming to import packages it never used.
Signed-off-by: Ugur Cekmez <ucekmez@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit finding (agent-ergonomics vertical): the flagship LangGraph example —
the one place an agent-builder copies from — did not parse the canonical
EEP gate response it advertises.
handle_gate_challenge()read a flat{gate_type, amount, currency}body and split credential/agreement handlingonto
403by anerrorstring. None of those fields exist in the realresponse, so the example would never match a conformant publisher.
Canonical shape
Both
402 access_restrictedand403 access_forbidden(
schemas/v0.1/gate.402-response.json/gate.403-response.json) carry:{ "error": "access_restricted", "resource": "...", "current_tier": "...", "required_tier": "...", "unmet_requirements": [ { "type": "payment", "resolution_hint": "Pay $0.10 …", ... } ] }Every gate type (payment, credential, agreement, identity, …) is an entry in
unmet_requirements, each with a machine-readableresolution_hint.Change
unmet_requirementsand build one proof perrequirement, routed on each requirement's
type, using the canonical proofshapes from
@eep-dev/gates(PaymentProof.token,CredentialProof.format,agreement signature over
document_hash, …). Theresolution_hintis whatlets the agent decide without an LLM — the whole point of the vertical.
test_agent.py(5 tests, all passing): payment, multi-requirement,403 access_forbidden, non-gate error, and unsatisfiable customx-*.readability and points to
eep-gates/eep-signer/eep-validatorforproduction, instead of claiming to import packages it never used.
Part of the EEP vertical-audit follow-up (Wave 1). No wire/schema change.
🤖 Generated with Claude Code