How pavansaikavuri/failed-subscription-recovery-agent works
This is a subscription-payment recovery agent with batch and Razorpay-webhook entry points. Both feed validated failure records into a guarded rules/LLM decision engine; campaign mode revisits unresolved records across dunning cycles. Decisions are evaluated by an independent deterministic outcome simulator, then recorded for audit and benchmark reporting. The graph reflects README-described capabilities where excerpts were incomplete; uncertain implementation wiring is omitted.
Main entry points: pipeline.py Recovery pipeline · app.py Webhook receiver · strategies.py Decision strategies · benchmark.py Benchmark runner
Components 17
Intake and validation
- Sample batch
data/sample_batch.py - Webhook receiver
app.py - Error normalizer
error_normalizer.py - Payment models
models.py
Recovery decisions
- Recovery pipeline
pipeline.py - Notes sanitizer
security.py - Decision strategies
strategies.py - LLM decision cache
llm_decision_cache.json
Simulation and benchmarks
- Outcome simulator
outcome_model.py - Benchmark runner
benchmark.py
Persistence and reporting
- Audit ledger
audit_log.jsonl - Escalation records
escalations.json - Webhook event ledger
app.py - Report generator
report_generator.py
Other components
- Merchant / batch operator
- Razorpay webhooks
- Gemini Flash
Connections 19
- Merchant / batch operator → Sample batch: provides records
- Sample batch → Recovery pipeline: processes batch
- Razorpay webhooks → Webhook receiver: sends events
- Webhook receiver → Error normalizer: normalizes errors
- Webhook receiver → Webhook event ledger: records events
- Webhook receiver → Recovery pipeline: dispatches failure
- Recovery pipeline → Payment models: validates records
- Recovery pipeline → Decision strategies: requests decision
- Decision strategies → Notes sanitizer: sanitizes notes
- Decision strategies → Gemini Flash: requests inference
- Decision strategies → LLM decision cache: reads and writes
- Decision strategies → Payment models: returns decision
- Recovery pipeline → Outcome simulator: simulates action
- Recovery pipeline → Audit ledger: appends audit
- Recovery pipeline → Escalation records: records escalations
- Recovery pipeline → Benchmark runner: runs evaluations
- Benchmark runner → Outcome simulator: scores outcomes
- Benchmark runner → Report generator: generates report
- Webhook receiver → Webhook event ledger: serves history