Choose the right framework
Tenchi focuses on backend changes that humans and agents can understand, implement, and verify. Its small application model combines typed contracts, plain use cases, and explicit ports with inspection, generation, and compatibility evidence.
At a glance
| Framework | Strongest fit | Main tradeoff |
|---|---|---|
| FastAPI | Typed HTTP APIs with interactive documentation | Built-in API ergonomics and dependency injection; application architecture remains a project choice |
| Starlette | Small ASGI toolkit and low-level control | The application supplies its contract and use-case conventions |
| Litestar | Typed ASGI applications with integrated capabilities | More built-in features and framework concepts |
| Django Ninja | Typed APIs inside the Django ecosystem | Uses Django's infrastructure and conventions |
| Tenchi | Contract-first backends with a shared development workflow for people and agents | Prescribed source structure and explicit wiring; infrastructure integrations remain application-owned |
Choose Tenchi when
- People and agents need predictable files, mutation previews, structured diagnostics, and reviewable evidence for backend changes.
- The server and a Python client should share one executable contract.
- API compatibility must be checked in CI against a historical baseline.
- Business behavior should be reusable from HTTP, workers, scripts, and direct tests, with input adapters where an entrypoint needs a different function signature.
- You want composition-time signature failures and explicit dependency wiring.
- You want a small application model while retaining inspection, generation, and verification as part of everyday development.
Choose another framework when
- You need WebSockets, HTML templates, an ORM, admin UI, or background runtime as first-class framework features.
- You want built-in dependency injection, authentication primitives, or a broader integration surface.
- You need to choose your own application layout instead of adopting Tenchi's feature and composition conventions.
- You need older Python versions; Tenchi requires Python 3.12 or newer.
Tenchi and Starlette
Tenchi exposes Starlette where that is useful. create_app() returns a
Starlette application, accepts Starlette middleware, and allows explicitly
declared passthrough responses for streaming, files, and redirects. Tenchi adds
contract ownership around those primitives rather than replacing the ASGI
ecosystem.
Tenchi and FastAPI
Both frameworks use Python annotations and Pydantic at the boundary. FastAPI optimizes for concise route declaration and ecosystem reach. Tenchi separates the contract from the use case so the same application function is not owned by HTTP, and it includes a contract-driven runtime client and conservative OpenAPI compatibility analysis.
The tradeoff is explicit source structure and application-owned wiring. Evaluate it by making a representative change: find the affected behavior, change its contract, implement and test it, then review the compatibility evidence. That shows whether the conventions help your team more clearly than the size of the first endpoint example.