AI EngineeringInterview preparation
Intermediate·Concept·2 min read

FastAPI

Practice this question

Beginner — What is FastAPI's role?

  • It provides a Python HTTP service boundary with declared routes and data schemas.
  • Pydantic validates input/output, while application dependencies and services enforce identity, permissions, and business rules.

Intermediate — When should a route be async?

  • When it awaits compatible nonblocking I/O.
  • Async does not make CPU work fast or turn a synchronous SDK into an async one.
  • I choose client and execution boundaries deliberately.

Senior — Where should long extraction run?

  • In bounded workers with durable jobs, retries, status, and resource isolation.
  • FastAPI can start/check tasks or expose fast specialized operations; it should not keep arbitrary multi-minute processing alive solely through an open request.

Scenario — Node can call the LLM already. Why add FastAPI?

  • Only for a concrete Python library, local model, numerical workload, or scaling boundary.
  • Otherwise another service adds authentication, deployments, networking, contracts, and failures without meaningful benefit.
Adapted from 13_AI.MD · “29.19 FastAPI”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.