fastapi/fastapi
Dimensions
Interface surface 3 solid [service] A contract covers its transport: an HTTP contract covers at least 80% of declared routes (generated contracts do), or the application layer over a standard protocol (commands, topics, payloads) is specified in a protocol document or AsyncAPI.
Can another program use it through a documented, machine-readable surface?
- next: [service] L4 A second surface: another transport (HTTP and a protocol, two protocols), an MCP server, a CLI with JSON output, or an SDK. (only one programmatic surface)
- next: [cli] L3 Machine-readable output (--json/--format) and documented exit statuses. (no --json/--format option)
- next: [library] L2 The public API is delimited (__all__, an exports map, exported identifiers). (no __all__/exports defining the public API)
cli ladder · level 2
- ✓ L1 Invocable non-interactively: no prompts, or prompts guarded by a TTY check or a --yes/--no-input option. no interactive prompts
- ✓ L2 --help documents every option (at least 90% of options have help text). scripts/docs.py 1 match
- ✗ L3 Machine-readable output (--json/--format) and documented exit statuses. no --json/--format option
- ✓ L4 The output format is specified by a JSON Schema. fastapi/openapi/models.py 1 match
library ladder · level 1
- ✓ L1 An importable, packaged API exists. pyproject.toml Python package fastapi
- ✗ L2 The public API is delimited (__all__, an exports map, exported identifiers). no __all__/exports defining the public API
- ✓ L3 The public API is statically typed (py.typed, type declarations, a typed language). fastapi/py.typed py.typed
- ✓ L4 An API reference is generated from the code (autodoc, mkdocstrings, typedoc, …). docs/en/mkdocs.yml 1 matchpyproject.toml 1 match
service ladder · level 3
- ✓ L1 A network surface exists: HTTP routes, an MCP server, or a standard protocol listener. docs_src/stream_data/tutorial001_py310.py fastapi/flask: 440 route declarations
- ✓ L2 A contract exists: a checked-in OpenAPI/GraphQL/protobuf/AsyncAPI spec, a framework-generated spec, MCP tool schemas, or a standard application protocol that off-the-shelf clients speak (RESP, MQTT, gRPC, PostgreSQL wire, …). docs_src/sub_applications/tutorial001_py310.py FastAPI (auto OpenAPI)pyproject.toml graphql server
- ✓ L3 A contract covers its transport: an HTTP contract covers at least 80% of declared routes (generated contracts do), or the application layer over a standard protocol (commands, topics, payloads) is specified in a protocol document or AsyncAPI. docs_src/sub_applications/tutorial001_py310.py generated from code: FastAPI (auto OpenAPI)pyproject.toml generated from code: graphql server
- ✗ L4 A second surface: another transport (HTTP and a protocol, two protocols), an MCP server, a CLI with JSON output, or an SDK. only one programmatic surface
Contract stability 1 ad hoc Releases are versioned (semver tags or versioned changelog sections).
Can integrators rely on it not changing under them?
- next: L2 A changelog exists and marks breaking changes. (no changelog)
all ladder · level 1
- ✓ L1 Releases are versioned (semver tags or versioned changelog sections). 311 semver tags, latest 0.143.0
- ✗ L2 A changelog exists and marks breaking changes. no changelog
- ✓ L3 A deprecation mechanism is used in code (warnings, @deprecated, Deprecation/Sunset headers) or the API is versioned. fastapi/params.py 9 matchesfastapi/responses.py 5 matches
- ✓ L4 Across tagged releases, no OpenAPI operation, CLI option or __all__ symbol was removed without first being deprecated. 20 tagged releases compared
Events 2 partial Webhooks sent by this system, or a streaming endpoint (SSE, WebSocket).
Can others react to state changes without polling?
- next: L3 Signed webhooks registrable through the API, or two mechanisms (webhooks, streams, a broker). (one delivery mechanism, or webhooks that are unsigned or not registrable through the API)
service ladder · level 2
- ✓ L1 Internal events exist (signals, queues, an outbox, emitters). docs_src/websockets_/tutorial003_py310.py 1 matchfastapi/telemetry/_api.py 1 match
- ✓ L2 Webhooks sent by this system, or a streaming endpoint (SSE, WebSocket). fastapi/routing.py 43 matchesdocs_src/websockets_/tutorial003_py310.py 22 matches
- ✗ L3 Signed webhooks registrable through the API, or two mechanisms (webhooks, streams, a broker). one delivery mechanism, or webhooks that are unsigned or not registrable through the API
- ✗ L4 Events are described by AsyncAPI or CloudEvents. no AsyncAPI or CloudEvents contract
Identity 3 solid Credentials carry scopes or permissions.
Can a machine act with its own revocable, least-privilege identity?
- next: L4 Standard provisioning or federation (OIDC client credentials, SCIM). (no OIDC client credentials or SCIM)
service ladder · level 3
- ✓ L1 Programmatic authentication (bearer tokens, API keys). pyproject.toml 1 matchfastapi/security/__init__.py 4 matches
- ✓ L2 Per-client, revocable credentials (managed API keys, service accounts) or OAuth2. fastapi/openapi/models.py 1 match
- ✓ L3 Credentials carry scopes or permissions. fastapi/routing.py 68 matchesfastapi/telemetry/_asgi.py 17 matches
- ✗ L4 Standard provisioning or federation (OIDC client credentials, SCIM). no OIDC client credentials or SCIM
Data portability n/a Not applicable: owns no persistent data.
Can its data get in and out, in bulk, in open formats, with an explicit schema?
Agent ergonomics 2 partial [service] Field-level validation errors, and paginated lists.
Can an automated caller use it without guessing, and recover from failure?
- next: [service] L3 Typed errors (RFC 9457 over HTTP, or a standard protocol's typed error codes), idempotent writes (Idempotency-Key), and rate-limit signals. (no typed errors)
- next: [cli] L3 Documented exit statuses distinguish error classes, errors are JSON in JSON mode, and color is off when not a TTY. (exit statuses aren't documented)
- next: [library] L1 Errors are specific exception types, and library code never calls sys.exit. (library code exits the process: scripts/add_latest_release_date.py, scripts/notify_translations.py)
cli ladder · level 2
- ✓ L1 Never blocks on a prompt when stdin is not a TTY. no interactive prompts
- ✓ L2 Data on stdout, diagnostics on stderr, non-zero exit on failure. scripts/notify_translations.py 29 matchesscripts/sponsors.py 19 matches
- ✗ L3 Documented exit statuses distinguish error classes, errors are JSON in JSON mode, and color is off when not a TTY. exit statuses aren't documented
- ✗ L4 --dry-run, limits for long or costly operations (timeouts, budgets), and agent docs. no --dry-run
library ladder · level 0
- ✗ L1 Errors are specific exception types, and library code never calls sys.exit. library code exits the process: scripts/add_latest_release_date.py, scripts/notify_translations.py
- ✓ L2 Inputs are validated with messages naming the bad argument. fastapi/routing.py 8 matchesscripts/doc_parsing_utils.py 8 matches
- ✓ L3 Timeouts and retries are configurable. scripts/notify_translations.py 1 matchscripts/sponsors.py 1 match
- ✗ L4 Agent docs, and examples that run as tests (doctests). no agent docs
service ladder · level 2
- ✓ L1 Errors are machine-readable: consistent JSON over HTTP, or a standard protocol's native error replies (RESP errors, MQTT reason codes, gRPC status, SQLSTATE). fastapi/applications.py 23 matchesdocs_src/handling_errors/tutorial006_py310.py 15 matches
- ✓ L2 Field-level validation errors, and paginated lists. fastapi/_compat/v2.py 10 matchesfastapi/_compat/shared.py 4 matches
- ✗ L3 Typed errors (RFC 9457 over HTTP, or a standard protocol's typed error codes), idempotent writes (Idempotency-Key), and rate-limit signals. no typed errors
- ✗ L4 Dry-run or validate-only, conditional requests, and agent docs. no ETags
Embeddability 4 exemplary [library] Optional features behind extras/features.
Can another system run and compose it without a human?
- next: [service] L2 Configured through environment variables, documented: a .env example, a config schema, or docs naming at least half of the variables the code reads. (the environment variables aren't documented)
- next: [cli] L3 Published to a public registry and run non-interactively in CI. (the command isn't run in CI)
cli ladder · level 2
- ✓ L1 Runnable from source (a declared entry point). pyproject.toml console script
- ✓ L2 Installable as a package that provides the command. pyproject.toml console script
- ✗ L3 Published to a public registry and run non-interactively in CI. the command isn't run in CI
- ✗ L4 Also shipped as a container image or a single binary. no container image or binary
library ladder · level 4
- ✓ L1 Importable from source. pyproject.toml Python package fastapi
- ✓ L2 Installable as a package (a package manifest). pyproject.toml package manifest
- ✓ L3 Published to a public registry, with at most 10 runtime dependencies. .github/workflows/publish.yml 1 match 6 runtime dependencies
- ✓ L4 Optional features behind extras/features. pyproject.toml 1 match
service ladder · level 1
- ✓ L1 Runnable from source with documented steps (a README with commands). README.md
- ✗ L2 Configured through environment variables, documented: a .env example, a config schema, or docs naming at least half of the variables the code reads. the environment variables aren't documented
- ✗ L3 A container image. no Dockerfile
- ✗ L4 Composition artifacts (compose, Helm, IaC). no compose/Helm/IaC
Extensibility 0 absent Not yet: Internal seams: a registry, registration function or plugin manager.
Can behaviour be added without modifying the code?
- next: L1 Internal seams: a registry, registration function or plugin manager. (no registry or registration function)
all ladder · level 0
- ✗ L1 Internal seams: a registry, registration function or plugin manager. no registry or registration function
- ✗ L2 The docs show how to add behaviour through those seams (even in-tree). no registration functions to document
- ✗ L3 Out-of-tree extensions are discovered (entry points, a plugin directory, configuration) without editing the package. extensions must be added inside the package
- ✗ L4 The extension API is versioned, has lifecycle hooks, and has example extensions. no lifecycle hooks
Observability 1 ad hoc [cli] Meaningful exit statuses, and errors on stderr.
Can an operator, or an orchestrating agent, tell whether it works and why not?
- next: [service] L1 A health or readiness endpoint, or a container healthcheck. (no health endpoint or healthcheck)
- next: [cli] L2 Verbosity control for diagnostics (--quiet, --log-level, --debug). (no --quiet or log-level control)
- next: [library] L1 Logs through a standard logger namespace and never prints from library code. (library code prints: scripts/doc_parsing_utils.py, scripts/translation_git.py, docs_src/custom_request_and_route/tutorial003_py310.py)
cli ladder · level 1
- ✓ L1 Meaningful exit statuses, and errors on stderr. scripts/notify_translations.py 29 matchesscripts/sponsors.py 19 matches
- ✗ L2 Verbosity control for diagnostics (--quiet, --log-level, --debug). no --quiet or log-level control
- ✗ L3 Structured logs (e.g. --log-format json) or a machine-readable run summary. no structured diagnostics
- ✓ L4 Tracing hooks (OpenTelemetry). fastapi/telemetry/_runtime.py 10 matchesfastapi/telemetry/_api.py 8 matches
library ladder · level 0
- ✗ L1 Logs through a standard logger namespace and never prints from library code. library code prints: scripts/doc_parsing_utils.py, scripts/translation_git.py, docs_src/custom_request_and_route/tutorial003_py310.py
- ✓ L2 Log levels are used meaningfully (at least two levels). levels: debug, error, exception, info, warning
- ✓ L3 Optional metrics or tracing hooks. fastapi/telemetry/_runtime.py 10 matchesfastapi/telemetry/_api.py 8 matches
- ✓ L4 OpenTelemetry instrumentation available. pyproject.toml 13 matches
service ladder · level 0
- ✗ L1 A health or readiness endpoint, or a container healthcheck. no health endpoint or healthcheck
- ✗ L2 Structured logs. no structured logging
- ✗ L3 Metrics. no metrics
- ✓ L4 Distributed tracing (OpenTelemetry). fastapi/telemetry/_runtime.py 10 matchesfastapi/telemetry/_api.py 8 matches
Change legibility 2 partial CI runs the tests; applications pin dependencies (libraries and zero-dependency projects are exempt).
Can an agent change it safely with limited context?
- next: L3 At least 90% of modules fit 32k tokens and no file exceeds 12k; test/source token ratio at least 0.3; at least 70% of the code is typed. (99% of modules fit 32k tokens; 3 files over 12k)
all ladder · level 2
- ✓ L1 A README and some tests. README.mddocs_src/app_testing/app_a_py310/test_main.py 633 test files
- ✓ L2 CI runs the tests; applications pin dependencies (libraries and zero-dependency projects are exempt). .github/workflows/add-to-project.yml.github/workflows/build-docs.yml
- ✗ L3 At least 90% of modules fit 32k tokens and no file exceeds 12k; test/source token ratio at least 0.3; at least 70% of the code is typed. 99% of modules fit 32k tokens; 3 files over 12k
- ✗ L4 No import cycles, and agent docs (AGENTS.md, CLAUDE.md, llms.txt). 2 import cycles (largest: fastapi/__init__.py, fastapi/applications.py, fastapi/dependencies/utils.py)
Make or buy
Make with agents
3,131,468 output + 78,286,700 input tokens
on anthropic:claude-opus-5-5 ≈ $123.
34.8 agent-hours · 86.4 human days (23.4 steering + 63.0 rediscovering history).
$67,320 over 3 years
Buy (adopt as is)
1 min to running (via library) + 10 min to first use (via service).
240 min/year of upgrades; price $0/year.
$816 over 3 years
Buying wins below $22,168 per year. How this is estimated.
Classic COCOMO vs neosloc value
Classic COCOMO (sloccount)
28.23 KSLOC → 80.1 person-months over 13.2 months.
$901k
The effort to write it by hand, as COCOMO priced it in 1981.
neosloc value (neoCOCOMO)
Reproduce with agents: 10.2 PM (×0.13 of classic; 94% of behaviour captured by tests, contract and docs).
Rediscover uncaptured history: 3.0 PM (553 fixes in 7780 commits by 919 authors).
× leverage 1 (integrability) × obsolescence 0.95.
$141k (12.5 PM)
What survives
16% of the classic figure
23% of the replacement cost lives only in code and history.
History
| Evaluated | Commit | neosloc | Index | Make or buy |
|---|---|---|---|---|
| 2026-10-12 | f5c6e9b4f9ca | 0.8.0 | 2.00 | buy |
| 2026-10-07 | 94918c1d40af | 0.8.0 | 2.00 | buy |
| 2026-10-07 | 94918c1d40af | 0.7.4 | 2.00 | buy |
| 2026-10-07 | 94918c1d40af | 0.7.3 | 2.00 | buy |
| 2026-10-07 | 94918c1d40af | 0.7.2 | 2.00 | buy |