Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI4Finance Foundation FinGPT Finogrid Core Services

From Leeroopedia
Knowledge Sources
Domains Fintech_Infrastructure, Payments, Routing, Compliance
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tools for the Finogrid platform's core deterministic services: routing engine, compliance gate, partner execution, reconciliation, and bridge client.

Description

The Finogrid core services handle the transaction hot path:

  • RoutingEngine — deterministically resolves asset (USDT/USDC), delivery mode (wallet/fiat), and selects primary/fallback partners based on corridor routing/compliance profiles. No LLM calls.
  • ComplianceGate — orchestrates KYT wallet screening + sanctions checks against corridor-specific risk thresholds. Produces PASS/HOLD/FAIL outcomes. No LLM calls.
  • ExecutionService — submits compliance-cleared tasks to Bridge API via BridgeClient with exponential backoff retries. Captures partner_tx_id and publishes status events.
  • ReconciliationService — polls Bridge for task status, transitions states, updates batch counters, triggers webhooks, generates reconciliation reports (CSV/JSON).
  • BridgeClient — HTTP client for Bridge API (create, get, cancel transfers).

Usage

Import these services when building or extending the Finogrid payout pipeline. All operate deterministically on the hot path.

Code Reference

Source Location

Signature

class RoutingEngine:
    def __init__(self, routing_profile, compliance_profile): ...
    async def route(self, task) -> RoutingDecision: ...

class ComplianceGate:
    def __init__(self, kyt_client, compliance_profile): ...
    async def screen(self, task_id, corridor_code, amount_usd, resolved_mode,
                     recipient_wallet=None, recipient_name=None,
                     beneficiary_data=None) -> ComplianceResult: ...

class ExecutionService:
    def __init__(self, bridge_client: BridgeClient, max_retries: int = 3): ...
    async def execute_task(self, task, db) -> bool: ...

class BridgeClient:
    async def create_transfer(self, task_id, amount_usd, asset, corridor_code, ...) -> dict: ...
    async def get_transfer(self, transfer_id) -> dict: ...
    async def cancel_transfer(self, transfer_id) -> dict: ...

class ReconciliationService:
    def __init__(self, bridge_client, publisher, pubsub_project, db_session_factory): ...
    async def reconcile_batch(self, batch_id: str) -> dict: ...

class RoutingWorker:
    def __init__(self, ...): ...
    async def process_task(self, task) -> None: ...

Import

from finogrid.services.routing_engine.engine import RoutingEngine, RoutingDecision
from finogrid.services.compliance_gate.gate import ComplianceGate, ComplianceResult
from finogrid.services.partner_execution.executor import ExecutionService
from finogrid.services.partner_execution.bridge_client import BridgeClient
from finogrid.services.reconciliation.reconciler import ReconciliationService
from finogrid.services.routing_engine.worker import RoutingWorker

I/O Contract

Inputs

Name Type Required Description
task PayoutTask Yes Task to route/screen/execute
routing_profile RoutingProfile Yes Corridor routing config
compliance_profile ComplianceProfile Yes Corridor compliance thresholds
kyt_client MCP client Yes (gate) KYT screening provider

Outputs

Name Type Description
RoutingDecision dataclass asset, mode, partners, SLA
ComplianceResult dataclass outcome (pass/hold/fail), risk_score, sanctions_hit
execution result bool True on success, False on failure
reconciliation report dict Per-batch completion summary

Usage Examples

Route and Screen a Payout Task

from finogrid.services.routing_engine.engine import RoutingEngine
from finogrid.services.compliance_gate.gate import ComplianceGate

# 1. Route the task deterministically
router = RoutingEngine(routing_profile=rp, compliance_profile=cp)
decision = await router.route(task)
print(f"Asset: {decision.resolved_asset}, Mode: {decision.resolved_mode}")

# 2. Screen for compliance
gate = ComplianceGate(kyt_client=kyt_mcp, compliance_profile=cp)
result = await gate.screen(
    task_id=str(task.id),
    corridor_code="BR",
    amount_usd=5000,
    resolved_mode="wallet",
    recipient_wallet="0x1234...",
)
print(f"Outcome: {result.outcome}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment