# cache_and_register_plugin

> **Function** in `deepagents_code`

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

Copy a plugin into the versioned cache and register the install.

## Signature

```python
cache_and_register_plugin(
    plugin_id: str,
    source_dir: Path,
    *,
    version: str | None,
    validate: Callable[[Path], None] | None = None,
) -> Path
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `plugin_id` | `str` | Yes | Plugin id in `{name}@{marketplace}` form. |
| `source_dir` | `Path` | Yes | Source plugin root to copy from. |
| `version` | `str \| None` | Yes | Version declared by the plugin manifest, if any. |
| `validate` | `Callable[[Path], None] \| None` | No | Optional validation to run before registering the cache. (default: `None`) |

## Returns

`Path`

Absolute path to the cached plugin root.

---

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