<@ULVA73B9P> if I understand correctly Prefect ser...
# ask-marvin
k
@Marvin if I understand correctly Prefect server is a FastAPI app under the hood. And what Prefect worker is based on?
m
thought for 87.4 seconds
You’ve got it: in Prefect 3.x, Prefect Server is a FastAPI application under the hood. - Server: The API app is created by
create_api_app()
and returns a FastAPI instance. It sits in front of a SQL database (Postgres or SQLite via SQLAlchemy). - Docs: Server concept - API ref: prefect.server.api.server As for the Prefect Worker, it’s a Python async service built on: - anyio for structured concurrency (task groups, cancellation) - httpx (via Prefect’s
PrefectHttpxAsyncClient
) to talk to the Prefect API - A common
BaseWorker
class that polls work pools and submits/monitors “infrastructure jobs” to run flow code Worker types (what they launch flows on): - Process Worker: local subprocesses on the same machine - Docker Worker: containers via Docker Engine - Kubernetes Worker: Kubernetes Jobs - ECS Worker: AWS ECS tasks - Cloud Run v2 Worker: Google Cloud Run - Vertex AI Worker: Google Vertex AI - Azure Container Instance Worker: Azure ACI - Coiled Worker: Coiled clusters Key links: - Concepts: Workers overview - Base classes/API: prefect.workers.base - Health checks: Worker healthchecks - Custom workers: Developing a custom worker If you meant “what does the default Process Worker use specifically,” it launches flows with Python’s subprocess module and manages them asynchronously with anyio while communicating back to the API with httpx.