How prefecthq/prefect works
Prefect is a Python workflow-orchestration framework. A user decorates Python functions as flows and tasks, runs the flow, and can deploy it for scheduled or event-triggered execution; run activity is observable through a self-hosted server or Prefect Cloud. The graph includes execution, orchestration access, deployment, and major supporting capabilities. Several relationships come from the README or SOURCE INDEX references rather than inspected implementations, so uncertain UI and external-service links are marked dashed.
Main entry points: flow_engine.py Flow runtime · task_engine.py Task runtime · flows.py Flow definitions · __init__.py Orchestration client
Components 22
Workflow authoring
- Flow definitions
src/prefect/flows.py - Task definitions
src/prefect/tasks.py
Run execution
- Flow runtime
src/prefect/flow_engine.py - Task runtime
src/prefect/task_engine.py - Run context
src/prefect/context.py - Run states
src/prefect/states.py - Model utilities
src/prefect/utilities/pydantic.py
Orchestration services
- Orchestration client
src/prefect/client/orchestration/__init__.py - Prefect server
src/prefect/server/api/server.py - Server database
src/prefect/server/database - Deployment tools
src/prefect/cli/deploy
Workflow capabilities
- Blocks and storage
src/prefect/blocks/core.py - File storage
src/prefect/filesystems.py - Results and caching
src/prefect/results.py - Concurrency limits
src/prefect/concurrency/asyncio.py - Event automations
src/prefect/automations.py - Event processing
src/prefect/server/events/pipeline.py - Run logging
src/prefect/logging/loggers.py - External integrations
src/integrations
User interfaces
- CLI commands
src/prefect/cli - Web UI
ui-v2/src
Other components
- Workflow author
Connections 23
- Workflow author → Flow definitions: defines flow
README.md - Workflow author → Task definitions: defines tasks
README.md - Flow definitions → Flow runtime: runs flow
src/prefect/flow_engine.py - Flow runtime → Task runtime: runs tasks
- Flow runtime → Run context: uses context
src/prefect/flow_engine.py - Task runtime → Run context: uses context
src/prefect/task_engine.py - Flow runtime → Orchestration client: calls API
src/prefect/flow_engine.py - Task runtime → Orchestration client: calls API
src/prefect/task_engine.py - Orchestration client → Prefect server: sends requests
src/prefect/client/orchestration/__init__.py - Prefect server → Server database: persists data
- Workflow author → Deployment tools: configures deployment
README.md - Deployment tools → Flow definitions: deploys flow
- Workflow author → CLI commands: runs commands
- Workflow author → Web UI: monitors runs
README.md - Web UI → Prefect server: requests data
- Flow runtime → Run states: updates state
src/prefect/flow_engine.py - Task runtime → Concurrency limits: acquires slots
src/prefect/task_engine.py - Flow runtime → Results and caching: stores results
src/prefect/flow_engine.py - Blocks and storage → File storage: provides storage
src/prefect/filesystems.py - Flow runtime → Run logging: emits run logs
src/prefect/flow_engine.py - Event automations → Event processing: reacts to events
- External integrations → Flow definitions: extends workflows
README.md - Model utilities → Blocks and storage: supports models