get_environment
Retrieves conda or pypi environment details for a Metaflow task or run. Filter by package type, name, or max packages to inspect installed dependencies.
Instructions
Get the conda/pypi environment details for a Metaflow task or run.
Returns the full list of packages installed, user-requested dependencies, and metadata (who resolved it, when, architecture, environment type).
Works with both Netflix (nflx-metaflow) and OSS Metaflow installations.
Args: pathspec: Run ("FlowName/RunID"), step ("FlowName/RunID/StepName"), or task ("FlowName/RunID/StepName/TaskID") pathspec. For run pathspecs, scans steps to find the first with an environment. package_type: Filter packages by type: "conda" or "pypi". If omitted, returns all. package_name: Filter packages by name (case-insensitive substring match). Use this to check if a specific package is installed and what version. E.g. "numpy" returns only packages with "numpy" in the name. max_packages: Max number of packages to return. If the environment has more, the list is truncated and packages_truncated=true is set. Useful for large environments (100+ packages).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pathspec | Yes | ||
| package_type | No | ||
| package_name | No | ||
| max_packages | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |