mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-11-29 00:38:33 +00:00
Some checks failed
CI and Release / Docker / Build and test / amd64 (push) Has been cancelled
CI and Release / Docker / Build and test / arm64 (push) Has been cancelled
Security / CodeQL / Analyze python (push) Has been cancelled
CI / Python quality / Pre-commit (push) Has been cancelled
CI / Python tests / Unit Tests - py3.12 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.13 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.14 (push) Has been cancelled
CI / Python packages / Build and verify distributions (push) Has been cancelled
CI / Python quality / GitHub Actions (push) Has been cancelled
CI / Python tests / Hermes embedded - ubuntu-latest (push) Has been cancelled
CI / Python tests / Hermes embedded - windows-latest (push) Has been cancelled
CI / Python tests / Unit Tests - py3.11 (push) Has been cancelled
CI / ReMe Studio / Studio checks (push) Has been cancelled
Deploy / Documentation / Build documentation (push) Has been cancelled
CI / Windows / CLI smoke - py3.11 (push) Has been cancelled
Security / CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI and Release / Docker / Publish multi-platform tags (push) Has been cancelled
Deploy / Documentation / deploy (push) Has been cancelled
* refactor(core): reorganize the ReMe runtime and shared helpers * test(status): import the base component from its canonical module * test: remove redundant unit checks * refactor(core): use canonical runtime imports and shared CLI discovery Restore evolve behavior to the base branch and update its imports. Use Application as the runtime entry point and encode SSE in the HTTP service. * fix(cli): honor caller config when service replay is incomplete Use partial startup overrides for port probes and resolve named configs before requesting the service process working directory.
114 lines
3.1 KiB
Markdown
114 lines
3.1 KiB
Markdown
---
|
|
title: Plugin Development
|
|
description: Create, register, configure, test, and publish a ReMe plugin.
|
|
---
|
|
|
|
# Plugin Development
|
|
|
|
A ReMe plugin is a regular Python distribution exposed through the `reme.plugins` entry-point group. Its package-level `plugin.yaml` can register Step and Component backends and provide default Application configuration.
|
|
|
|
## Minimal structure
|
|
|
|
```text
|
|
my-plugin/
|
|
├── pyproject.toml
|
|
└── src/my_plugin/
|
|
├── __init__.py
|
|
├── plugin.yaml
|
|
└── steps.py
|
|
```
|
|
|
|
`pyproject.toml`:
|
|
|
|
```toml
|
|
[project.entry-points."reme.plugins"]
|
|
my-plugin = "my_plugin"
|
|
```
|
|
|
|
`plugin.yaml`:
|
|
|
|
```yaml
|
|
name: my-plugin
|
|
backends:
|
|
my_step: my_plugin.steps:MyStep
|
|
application_defaults:
|
|
jobs:
|
|
my_action:
|
|
backend: base
|
|
description: Run my plugin action
|
|
parameters:
|
|
type: object
|
|
properties:
|
|
text: { type: string }
|
|
required: [text]
|
|
steps:
|
|
- backend: my_step
|
|
```
|
|
|
|
## Implement a Step
|
|
|
|
```python
|
|
from reme.core.registry import R
|
|
from reme.steps.base_step import BaseStep
|
|
|
|
|
|
@R.register("my_step")
|
|
class MyStep(BaseStep):
|
|
async def execute(self):
|
|
self.context.response.answer = self.context.data["text"]
|
|
```
|
|
|
|
Step instances belong to one Job invocation. Put shared in-memory state under a narrow `app_context.metadata` key. Promote state that needs lifecycle, locking, or persistence to a Component or workspace file.
|
|
|
|
## Configuration merge
|
|
|
|
`application_defaults` is a partial `ApplicationConfig`:
|
|
|
|
```text
|
|
plugin defaults < selected/default config < CLI overrides
|
|
```
|
|
|
|
Only effective plugin defaults require their environment variables to be set or to have a fallback. Set `plugins` to a list of strings, such as `plugins: [my_plugin]`.
|
|
|
|
Plugins must not rewrite user configuration. Their backends enter an Application-local registry only when the plugin appears in that Application's `plugins` list.
|
|
|
|
## Local validation
|
|
|
|
```bash
|
|
reme plugins validate ./path/to/my-plugin
|
|
reme plugins install ./path/to/my-plugin --editable
|
|
reme plugins list
|
|
reme plugins show my-plugin
|
|
```
|
|
|
|
Start the enabled plugin's service in one terminal and leave it running:
|
|
|
|
```bash
|
|
reme start plugins='["my-plugin"]'
|
|
```
|
|
|
|
From another terminal, call its Job:
|
|
|
|
```bash
|
|
reme my_action text=hello
|
|
```
|
|
|
|
Validation imports plugin code, so run it only for trusted sources.
|
|
|
|
## Test boundaries
|
|
|
|
- create workspaces with `tmp_path`;
|
|
- mock network, model, and subprocess boundaries;
|
|
- verify disabled plugins do not mutate the built-in registry;
|
|
- verify plugin defaults and explicit configuration precedence;
|
|
- keep tasks, clients, and executors under Component lifecycle;
|
|
- never delete or rewrite user source files to repair derived state.
|
|
|
|
The repository's Daily Paper, Auto Fin, LME, and BEAM plugins are complete examples.
|
|
|
|
## Entry-point contract
|
|
|
|
Plugins must use a package-only `reme.plugins` entry point and declare contributions in `plugin.yaml`.
|
|
The separate `reme.configs` entry point provides named configuration presets. Enablement belongs to an Application.
|
|
|
|
See [Plugin Management](./plugin_management.md) for installation, upgrades, and removal.
|