Some values belong to a run, not to the code: which region to load, a threshold, a date to reprocess. Declare them in a class that subclasses dg.Config, with type annotations and optional defaults, and add a parameter annotated with that class:
class OrdersConfig(dg.Config):
region: str = "north"
@dg.asset
def regional_orders(config: OrdersConfig): ...
At launch, run config is a nested dictionary keyed by the asset's op name: {"ops": {"regional_orders": {"config": {"region": "south"}}}}. Paste it in the Launchpad or pass it with dg launch ... --config-json '...'. In tests, dg.RunConfig(ops={"regional_orders": OrdersConfig(region="south")}) builds the same thing.
Dagster validates config before the run starts. A field without a default is required, so launching without it fails with Missing required config entry; a value of the wrong type fails with Invalid scalar. Nothing runs until the config is right.
Run config for the asset below, as typed in the Launchpad or passed with --config-json.