Subclass ConfigurableResource and declare fields as class attributes with Pydantic types (e.g., api_url: str, api_key: str = EnvVar('MY_API_KEY'))
Implement a create_client method or property that instantiates the API client using self.api_url and self.api_key, enabling lazy initialization
Reference the resource in assets or ops using the ResourceParam[MyResource] type annotation in the function signature; Dagster injects the resource automatically
Define environment-specific configurations in Definitions by passing different MyResource instances to the resources dict keyed by resource name
Use IAttachDifferentObjectToOpContext if the resource wraps a client that cannot be serialized; override get_object_to_set_on_execution_context to return a lightweight wrapper
Known gotchas
EnvVar fields are resolved at launch time, not at definition parse time; if the environment variable is missing when a run starts, the resource initialization raises a DagsterInvalidConfigError at that point rather than at import
ConfigurableResource instances are re-created for each run; resources that establish expensive connections (e.g., database pools) should implement a context manager and use @contextmanager setup_for_execution to pool connections per run
Passing a resource to both an asset and a sensor requires the resource to be listed in both the asset's Definitions and the sensor's required_resource_keys; omitting it from the sensor causes an AttributeError at sensor evaluation time
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp