Build a Dagster resource that wraps an external API client with per-environment configuration using ConfigurableResource

domain: dagster.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Subclass ConfigurableResource and declare fields as class attributes with Pydantic types (e.g., api_url: str, api_key: str = EnvVar('MY_API_KEY'))
  2. Implement a create_client method or property that instantiates the API client using self.api_url and self.api_key, enabling lazy initialization
  3. Reference the resource in assets or ops using the ResourceParam[MyResource] type annotation in the function signature; Dagster injects the resource automatically
  4. Define environment-specific configurations in Definitions by passing different MyResource instances to the resources dict keyed by resource name
  5. 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

Related routes

Emit external asset materializations to Dagster via the REST API from an outside pipeline
docs.dagster.io · 5 steps · unrated
Build a custom Dagster IO manager to persist asset outputs to a specific storage backend (e.g., Parquet on S3)
docs.dagster.io · 6 steps · unrated
Configure Dagster ops and jobs with a RunConfig schema to pass structured runtime parameters without hardcoding values in the op body
dagster.io · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans