Indian lending lifecycle¶
The full Underwrite underwriting journey, end-to-end, against an in-memory runtime. Twelve stages from onboarding to origination — each one a nano-service, each transition a typed event, each event carrying the runtime guarantees into the next stage.
This page is the primary mental model for the platform. The same flow runs in production against Sqlite + OTLP + Vault; here it runs in a single Python process with no broker, no cluster, no external dependencies.
The flow¶
What the runtime adds at every transition¶
| Concern | Where it attaches | What it adds |
|---|---|---|
| Signing | Core.emit |
Ed25519 over canonical bytes; deterministic across processes |
| Verification | Core.dispatch |
Signature checked before handler runs |
| Idempotency | Core.dispatch |
Duplicates dropped silently; cache bounded |
| Tracing | Core.handle_event |
Span lifecycle, parent / child propagation |
| Metrics | Core.handle_event |
Counters, timers, gauges per service and event type |
| Authz | Core.dispatch + Core.emit |
Default-deny policy evaluation |
| DLQ | LocalBus.dispatch |
Failed events captured with original error |
| Circuit breaking | LocalBus.dispatch |
Per-subscriber breaker; OPEN after threshold |
| Saga coordination | Orchestrator |
Multi-step workflows with compensating rollback |
These guarantees are not optional. Every Core-derived service
inherits them through the dispatch pipeline; there is no way for
a service to opt out, and no way for a service to write the
dispatch logic itself.
Compliance responsibility by stage¶
| Stage | Responsibility |
|---|---|
| Onboarding | KYC for the sponsor; sponsor authorization |
| Identity | Identity verification; re-attestation on key rotation |
| Consent | DPDPA consent validity; purpose binding; withdrawal |
| KYC | PAN format, Aadhaar Verhoeff, AML risk score |
| AML | Sanctions screening; PEP screening; transaction patterns |
| Credit bureau | Bureau response normalization; consent re-check |
| Underwriting | Business rules; model versioning; explainability |
| Pricing | RBI rate caps; all-in-cost APR disclosure |
| Compliance | Cooling-off; KFS issuance before disbursement |
| KFS | Complete disclosure; version pinning |
| Mandate | e-NACH / UPI Autopay consent; revocation handling |
| Origination | Audit ledger; NPA classifier activation |
Visualizing the flow¶
sequenceDiagram
participant B as Borrower
participant M as mechanism
participant ID as identity
participant CO as consent
participant KY as compliance
participant CR as credit_bureau
participant U as underwriter
participant PR as pricing
participant K as kfs
participant AU as audit
B->>M: add_user
M->>AU: user.added
B->>CO: record_consent
CO->>AU: consent.recorded
B->>KY: kyc_check
KY->>AU: kyc.verified
B->>CR: credit_check
CR->>AU: credit_bureau.checked
B->>U: evaluate
U->>AU: underwriter.approved
B->>PR: compute
PR->>AU: pricing.computed
B->>K: generate
K->>AU: kfs.generated
B->>M: originate
M->>AU: loan.originated
Every event flows through audit — the persistent, PII-redacted
record of the run.
See also¶
- Architecture — how the layers fit together.
- Compliance — the runtime defaults that encode each regulatory control.
- Indian lending example — the script this page describes.