# plugin_environment

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/plugins/substitution/plugin_environment)

Build environment variables exposed to plugin subprocesses.

## Signature

```python
plugin_environment(
    *,
    plugin_root: Path,
    plugin_data: Path,
    project_dir: Path | None = None,
) -> dict[str, str]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `plugin_root` | `Path` | Yes | Plugin root directory. |
| `plugin_data` | `Path` | Yes | Plugin data directory. |
| `project_dir` | `Path \| None` | No | Optional project directory. (default: `None`) |

## Returns

`dict[str, str]`

Environment variables for plugin subprocesses.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/caaa7e7c12d214afa5cf0a1afed8eb6232aa6f7b/libs/code/deepagents_code/plugins/substitution.py#L13)