AI Customer Agent for Apex Finance. Python 3.12+ / FastAPI / asyncio, deployed on Docker/EC2.
Three components: Python backend (src/), Next.js admin panel (admin-panel/), Next.js showcase (showcase-web/).
AI commits MUST include:
Co-Authored-By: Pi <noreply@pi.dev>
- Backend:
uv—uv sync,uv run pytest,uv run ruff check,uv run mypy --strict - Frontends:
npm—npm run dev,npm run build,npm run lint - Full check:
make check(lint + typecheck + test + module sizes)
| Task | Command |
|---|---|
| Test file | uv run pytest tests/path/to/test_file.py -v |
| Lint file | uv run ruff check src/path/to/file.py |
| Typecheck file | uv run python -m mypy src/path/to/file.py --strict |
| Frontend lint | cd admin-panel && npm run lint / cd showcase-web && npm run lint |
docs/ is reference documentation — read the relevant section, not the whole tree.
| Doc | Use for |
|---|---|
docs/architecture.md |
Component design, integration contracts, data flow |
docs/API.yaml |
HTTP request/response schemas, error codes |
docs/ai-customer-agent-srd.md |
Security requirements (SR-001–SR-045) |
docs/apexpay-app-integration.md |
ApexPay channel — menu contracts, event types |
- Full type hints; Pydantic v2 models (
model_validator, not ad-hoc validation) typing.Protocolfor interfaces — never ABCstructlog.get_logger()for all logging — neverprint()or stdliblogging- async/await for all I/O; bind
request_id,session_id,channelat request entry - Never log raw PII
ErrorResponseperdocs/API.yaml; never expose internals in error responses- Error codes:
VALIDATION_ERROR,AUTH_TOKEN_EXPIRED,AUTH_TOKEN_INVALID,SESSION_CONFLICT,SESSION_NOT_FOUND,RATE_LIMIT_EXCEEDED,SERVICE_UNAVAILABLE,INTERNAL_ERROR
- pytest-asyncio; markers:
unit,integration,e2e,security,load,audit - Test name pattern:
test_<ac_id>_<short_description>(e.g.test_ac_009_01_loan_balance_returns_correct_balance) - Mock external boundaries only (Redis → fakeredis, HTTP → respx, SMTP → aiosmtplib mock); do not mock internal components
- Tests assert behavior, not implementation details
- Never hardcode secrets — use env vars (
.envin dev, Secrets Manager in prod) - Do not modify
docs/unless explicitly asked — flag spec discrepancies, don't silently fix them - Run
make check(or file-scoped equivalents) before claiming a change is complete