A LangGraph agent that subscribes to EEP entity streams, handles gates (auth/payment/agreement), and processes events using Claude.
- Discovery: Agent resolves an entity via Layer 1 REST, reads
Linkheaders and/.well-known/eep.json. - Subscription: Agent subscribes to entity events via
POST /eep/subscribe(Layer 2 webhook delivery). - Gate handling: When the agent hits a 402 (payment) or 403 (credential/agreement), it uses
eep-gates-pythonto construct and submit gate proofs. - Event processing: Incoming webhook events are validated with
eep-validator-python, signature-checked witheep-signer-python, and routed to a LangGraph processing graph. - Claude reasoning: Each event is summarized and acted on by Claude (via
langchain-anthropic).
EEP Publisher
│
├─ Layer 1 (GET /u/acme-corp) → discovery + gate requirements
├─ Layer 2 (POST /eep/subscribe) → webhook subscription
│
└─ Webhook delivery ──────┐
▼
┌─────────────────┐
│ LangGraph Agent │
│ ┌─────────────┐ │
│ │ validate │ │ ← eep-validator-python
│ │ verify sig │ │ ← eep-signer-python
│ │ gate check │ │ ← eep-gates-python
│ │ Claude LLM │ │ ← langchain-anthropic
│ │ act/respond │ │
│ └─────────────┘ │
└─────────────────┘
- Python 3.11+
- An
ANTHROPIC_API_KEYenvironment variable - A running EEP publisher (use the reference implementation or the realworld simulation)
cd EEP/examples/langgraph-eep-agent
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# Point at a running EEP publisher
export EEP_TARGET=http://localhost:3100
export ANTHROPIC_API_KEY=sk-ant-...
python agent.py| File | Purpose |
|---|---|
agent.py |
LangGraph graph definition, EEP subscription, webhook server, Claude processing |
requirements.txt |
Python dependencies |
When the agent encounters a gated resource:
- 402 Payment Required: The agent reads the
gate_typeand payment requirements from the response body, constructs a payment proof (x402 or on-chain hash), and retries withgate_proofsin the request. - 403 Forbidden (credential): The agent presents a Verifiable Presentation from its credential store.
- 403 Forbidden (agreement): The agent fetches the agreement document, computes its hash, signs it with the agent DID private key, and retries.
These flows use eep_gates.proof_validator and eep_gates.access_resolver from the eep-gates-python package.