Environment:AI4Finance Foundation FinGPT FastAPI
| Knowledge Sources | |
|---|---|
| Domains | Web_Framework, Fintech_Infrastructure |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
FastAPI web framework used by the Finogrid platform for all API services and MCP servers, providing async request handling, Pydantic validation, and automatic OpenAPI docs.
Description
This environment covers the FastAPI dependency used across all Finogrid service APIs (Agent Ledger API, Ingress API, Ops Console) and MCP servers (Bridge, Identity, KYA Validator, KYT/AML, Wallet Factory, Plaid). FastAPI provides the `FastAPI` application class, `APIRouter` for modular routing, and `Depends` for dependency injection. All Finogrid services use Pydantic schemas for request/response validation and Uvicorn as the ASGI server.
Usage
Use this environment for any Finogrid API service or MCP server implementation. Required by the Agent Ledger API, Ingress API, Ops Console, and all MCP server implementations.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Any | Cross-platform |
| Python | >= 3.8 | 3.10+ recommended for async features |
| Hardware | CPU sufficient | No GPU needed |
Dependencies
Python Packages
- `fastapi` >= 0.100.0
- `uvicorn` >= 0.23.0
- `pydantic` >= 2.0.0
- `python-multipart` (for form handling)
Credentials
No credentials required for the framework itself. Individual services define their own auth via middleware (e.g., x402 payment middleware).
Quick Install
pip install "fastapi>=0.100.0" "uvicorn>=0.23.0" "pydantic>=2.0.0"
Code Evidence
FastAPI app from `finogrid/services/agent_ledger_api/main.py`:
from fastapi import FastAPI
app = FastAPI(title="Agent Ledger API")
Router pattern from `finogrid/services/agent_ledger_api/routers/micropay.py`:
from fastapi import APIRouter, Depends
router = APIRouter(prefix="/micropay", tags=["micropay"])
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Dependency not resolvable` | Missing Depends parameter | Ensure dependency functions are properly typed |
| `Pydantic schema validation error` | Request body mismatch | Check schema field types and required fields |
Compatibility Notes
- Pydantic v2: Finogrid uses Pydantic v2 schemas with `model_config` instead of `Config` class.
- Async: All route handlers should be `async def` for non-blocking I/O.