Skip to content

Commit 5dac78d

Browse files
authored
Merge pull request agent0ai#1254 from 3clyp50/plugins8
plugins: dedicated skill/router flow, agent security scans, plugin validator builtin plugin, docs, and UX
2 parents 30a9ed2 + e3ba3d8 commit 5dac78d

66 files changed

Lines changed: 3582 additions & 1681 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ When running in Docker, Agent Zero uses two distinct Python runtimes to isolate
8888
├── plugins/ # Core system plugins
8989
├── agents/ # Agent profiles (prompts and config)
9090
├── prompts/ # System and message prompt templates
91+
├── knowledge/
92+
│ └── main/about/ # Agent self-knowledge (indexed into vector DB for runtime recall)
93+
│ ├── identity.md # Philosophy, principles, project context
94+
│ ├── architecture.md # Agent loop, memory pipeline, multi-agent, extensions
95+
│ ├── capabilities.md # Detailed capabilities and limitations
96+
│ ├── configuration.md # LLM roles, providers, profiles, plugins, settings
97+
│ └── setup-and-deployment.md # Docker deployment, updates, troubleshooting
9198
└── tests/ # Pytest suite
9299
```
93100

@@ -96,6 +103,7 @@ Key Files:
96103
- python/helpers/plugins.py: Plugin discovery and configuration logic.
97104
- webui/js/AlpineStore.js: Store factory for reactive frontend state.
98105
- python/helpers/api.py: Base class for all API endpoints.
106+
- knowledge/main/about/: Agent self-knowledge files, indexed into the vector DB for runtime recall. Not user-facing docs - written for the agent's internal reference.
99107
- docs/agents/AGENTS.components.md: Deep dive into the frontend component architecture.
100108
- docs/agents/AGENTS.modals.md: Guide to the stacked modal system.
101109
- docs/agents/AGENTS.plugins.md: Comprehensive guide to the full-stack plugin system.
@@ -128,11 +136,13 @@ Key Files:
128136
- Location: Always develop new plugins in usr/plugins/.
129137
- Manifest: Every plugin requires a plugin.yaml with name, description, version, and optionally settings_sections, per_project_config, per_agent_config, and always_enabled.
130138
- Discovery: Conventions based on folder names (api/, tools/, webui/, extensions/).
139+
- Plugin-local Python imports: Prefer `usr.plugins.<plugin_name>...` for code that lives under `usr/plugins/`. Avoid `sys.path` hacks and avoid symlink-dependent `plugins.<plugin_name>...` imports for community plugins.
131140
- Runtime hooks: Plugins may also expose hooks in hooks.py, callable by the framework through helpers.plugins.call_plugin_hook(...).
132141
- Hook runtime: hooks.py executes inside the Agent Zero framework Python environment, so sys.executable -m pip installs dependencies into that same framework runtime.
133142
- Environment targeting: If a plugin needs packages or binaries for the separate agent execution runtime or system environment, it must explicitly switch environments in a subprocess by targeting the correct interpreter, virtualenv, or package manager.
134143
- Settings: Use get_plugin_config(plugin_name, agent=agent) to retrieve settings. Plugins can expose a UI for settings via webui/config.html. Plugin settings modals instantiate a local context from $store.pluginSettingsPrototype; bind plugin fields to config.* and use context.* for modal-level state and actions. For plugins wrapping core settings, set context.saveMode = 'core' in x-init.
135144
- Activation: Global and scoped activation rules are stored as .toggle-1 (ON) and .toggle-0 (OFF). Scoped rules are handled via the plugin "Switch" modal.
145+
- Cleanup rule: Plugins should not permanently modify the system in ways that outlive the plugin. Deleting a plugin should not leave behind symlinks, unmanaged services, or stray files outside plugin-owned paths unless the user explicitly requested that behavior.
136146

137147
### Lifecycle Synchronization
138148
| Action | Backend Extension | Frontend Lifecycle |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Or see DeepWiki generated documentation:
5151

5252
Click to open a video to learn how to install Agent Zero:
5353

54-
[![Easy Installation guide](/docs/res/easy_ins_vid.png)](https://www.youtube.com/watch?v=w5v5Kjx51hs)
54+
[![Easy Installation guide](/docs/res/install_guide.png)](https://www.youtube.com/watch?v=2-qFNUvqrXA)
5555

5656
A detailed setup guide for Windows, macOS, and Linux with a video can be found in the Agent Zero Documentation at [this page](./docs/setup/installation.md).
5757

api/plugins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ def _run_init_script(self, input: dict) -> dict | Response:
284284
if not plugin_dir:
285285
return Response(status=404, response="Plugin not found")
286286

287-
init_script = files.get_abs_path(plugin_dir, "initialize.py")
287+
init_script = files.get_abs_path(plugin_dir, "execute.py")
288288
if not files.exists(init_script):
289-
return Response(status=404, response="initialize.py not found")
289+
return Response(status=404, response="execute.py not found")
290290

291291
executed_at = datetime.now(timezone.utc).isoformat()
292292
try:

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Welcome to the Agent Zero documentation hub. Whether you're getting started or d
7070
- [User Guides](#user-guides)
7171
- [Usage Guide](guides/usage.md)
7272
- [Basic Operations](guides/usage.md#basic-operations)
73+
- [Plugins and Marketplace](guides/usage.md#plugins-and-marketplace)
7374
- [Tool Usage](guides/usage.md#tool-usage)
7475
- [Projects](guides/usage.md#projects)
7576
- [What Projects Provide](guides/usage.md#what-projects-provide)

docs/agents/AGENTS.plugins.md

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Each plugin lives in usr/plugins/<plugin_name>/.
2424
```text
2525
usr/plugins/<plugin_name>/
2626
├── plugin.yaml # Required: Title, version, settings + activation metadata
27-
├── initialize.py # Optional: one-time setup script (dependencies, models, etc.)
27+
├── execute.py # Optional: user-triggered plugin script
2828
├── hooks.py # Optional: runtime hook functions callable by the framework
2929
├── default_config.yaml # Optional: fallback settings defaults
3030
├── README.md # Optional: shown in Plugin List UI
@@ -44,11 +44,42 @@ usr/plugins/<plugin_name>/
4444
└── ... # Full plugin pages/components
4545
```
4646

47+
### Python import rule for user plugins
48+
49+
For plugin-local Python code in `usr/plugins/<plugin_name>/`, import through the
50+
fully qualified `usr.plugins.<plugin_name>...` package path.
51+
52+
Good (DO):
53+
54+
```python
55+
from usr.plugins.my_plugin.helpers.runtime import do_work
56+
import usr.plugins.my_plugin.helpers.state as state
57+
```
58+
59+
Avoid (DON'T):
60+
61+
```python
62+
# sys.path hacks
63+
sys.path.insert(0, ...)
64+
from helpers.runtime import do_work
65+
66+
# persistent symlink-based imports
67+
from plugins.my_plugin.helpers.runtime import do_work
68+
```
69+
70+
Why:
71+
72+
- `usr.plugins...` works without renaming `helpers/`
73+
- it avoids `sys.path` mutation for plugin-local imports
74+
- it avoids installation-time symlinks into `/a0/plugins/`
75+
- it keeps plugin removal reversible, with no import wiring left behind
76+
4777
### plugin.yaml (runtime manifest)
4878

49-
This is the manifest file that lives inside your plugin directory and drives runtime behavior. It is distinct from the index manifest used when publishing to the Plugin Index (see Section 7).
79+
This is the manifest file that lives inside your plugin directory and drives runtime behavior. It is distinct from the index manifest (`index.yaml`) used when publishing to the Plugin Index (see Section 7).
5080

5181
```yaml
82+
name: my_plugin # required for community plugins (^[a-z0-9_]+$, must match dir name)
5283
title: My Plugin
5384
description: What this plugin does.
5485
version: 1.0.0
@@ -61,6 +92,7 @@ always_enabled: false
6192
```
6293
6394
Field reference:
95+
- `name`: Plugin identifier. Required by CI when submitting to the Plugin Index. Must be `^[a-z0-9_]+$` and match the index folder name exactly.
6496
- `title`: UI display name
6597
- `description`: Short plugin summary
6698
- `version`: Plugin version string
@@ -69,6 +101,16 @@ Field reference:
69101
- `per_agent_config`: Enables agent-profile-scoped settings and toggle rules
70102
- `always_enabled`: Forces ON and disables toggle controls in the UI (reserved for framework use)
71103

104+
### execute.py (plugin script)
105+
106+
Plugins can include an optional `execute.py` file at the plugin root for user-triggered work such as setup, post-install steps, maintenance, migrations, repair flows, or resource refreshes. It is started manually from the Plugins UI, never automatically, and should print progress while returning `0` on success.
107+
108+
Design guidance:
109+
- use `execute.py` for manual operations the user may need to run again later
110+
- prefer making it rerunnable or state-aware
111+
- avoid placing framework-internal automatic behavior here; that belongs in `hooks.py` or lifecycle extensions
112+
- do not make permanent system modifications that remain after plugin deletion unless the user explicitly asked for them and the plugin also provides a clear cleanup path
113+
72114
### hooks.py (framework runtime hooks)
73115

74116
Plugins can include an optional `hooks.py` file at the plugin root. Agent Zero loads this module on demand and calls exported functions by name through `helpers.plugins.call_plugin_hook(...)`.
@@ -77,6 +119,7 @@ Plugins can include an optional `hooks.py` file at the plugin root. Agent Zero l
77119
- Use it for framework-internal operations such as install-time setup, plugin registration work, filesystem preparation, cache updates, or other tasks that need access to Agent Zero internals.
78120
- Hook functions may be synchronous or async. Async hooks are awaited by the framework.
79121
- Hook modules are cached until plugin caches are cleared, so changes may require a plugin refresh/reload cycle.
122+
- Plugin hooks should be cleanup-safe. A plugin should not leave behind permanent system modifications, symlinks, files outside its owned paths, or background services that survive plugin removal unless that behavior is explicitly part of the user-facing contract.
80123

81124
Current example: the plugin installer calls `install()` from `hooks.py` after a plugin is copied into place.
82125

@@ -191,12 +234,13 @@ embedding:
191234

192235
The **Plugin Index** is a community-maintained repository at https://github.com/agent0ai/a0-plugins that lists plugins available to the Agent Zero community. Plugins listed there can be discovered and installed by other users.
193236

194-
### Two Distinct plugin.yaml Files
237+
### Two Distinct Manifest Files
195238

196-
There are two completely different `plugin.yaml` schemas used at different stages. They must not be confused:
239+
There are two completely different manifest files used at different stages. They must not be confused:
197240

198-
**Runtime manifest** (inside your plugin repo/directory, drives Agent Zero behavior):
241+
**Runtime manifest** (`plugin.yaml`, inside your plugin repo/directory drives Agent Zero behavior):
199242
```yaml
243+
name: my_plugin # REQUIRED for index submission; must match index folder name
200244
title: My Plugin
201245
description: What this plugin does.
202246
version: 1.0.0
@@ -207,17 +251,19 @@ per_agent_config: false
207251
always_enabled: false
208252
```
209253

210-
**Index manifest** (submitted to the `a0-plugins` repo under `plugins/<your-plugin-name>/`, drives discoverability only):
254+
**Index manifest** (`index.yaml`, submitted to the `a0-plugins` repo under `plugins/<your_plugin_name>/` drives discoverability only):
211255
```yaml
212256
title: My Plugin
213257
description: What this plugin does.
214258
github: https://github.com/yourname/your-plugin-repo
215259
tags:
216260
- tools
217261
- example
262+
screenshots: # optional, up to 5 full image URLs
263+
- https://raw.githubusercontent.com/yourname/your-plugin-repo/main/docs/screen.png
218264
```
219265

220-
The index manifest contains only four fields (`title`, `description`, `github`, `tags`) and must not include runtime fields. The `github` field must point to the root of a GitHub repository that itself contains a runtime `plugin.yaml` at the repository root.
266+
The index manifest is named `index.yaml` (not `plugin.yaml`). Required fields: `title`, `description`, `github`. Optional: `tags` (up to 5), `screenshots` (up to 5 URLs). The `github` field must point to the root of a GitHub repository that contains a runtime `plugin.yaml` at the repository root, and that `plugin.yaml` must include a `name` field matching the index folder name exactly.
221267

222268
### Repository Structure for Community Plugins
223269

@@ -239,23 +285,31 @@ Users install it locally by cloning (or downloading) the repo contents into `/a0
239285

240286
### Submitting to the Plugin Index
241287

242-
1. Create a GitHub repository for your plugin with the runtime `plugin.yaml` at the repo root.
288+
1. Create a GitHub repository for your plugin with the runtime `plugin.yaml` (including the `name` field) at the repo root.
243289
2. Fork `https://github.com/agent0ai/a0-plugins`.
244-
3. Create a folder `plugins/<your-plugin-name>/` containing only an index `plugin.yaml` (and optionally a square thumbnail image ≤ 20 KB).
290+
3. Create a folder `plugins/<your_plugin_name>/` containing only an `index.yaml` (and optionally a square thumbnail image ≤ 20 KB).
245291
4. Open a Pull Request with exactly one new plugin folder.
246292
5. CI validates the submission automatically. A maintainer reviews and merges.
247293

248294
Index submission rules:
249295
- One plugin per PR
250-
- Folder name must be unique, stable, lowercase, kebab-case
296+
- Folder name: unique, stable, `^[a-z0-9_]+$` (lowercase, numbers, underscores — no hyphens)
297+
- Folder name must exactly match the `name` field in your remote `plugin.yaml`
251298
- Folders starting with `_` are reserved for internal use
252-
- `github` must point to a public repo that contains `plugin.yaml` at its root
299+
- `github` must point to a public repo that contains `plugin.yaml` at its root with a matching `name` field
253300
- `title` max 50 characters, `description` max 500 characters
301+
- `index.yaml` total max 2000 characters
254302
- `tags`: optional, up to 5, use recommended tags from https://github.com/agent0ai/a0-plugins/blob/main/TAGS.md
303+
- `screenshots`: optional, up to 5 full image URLs (png/jpg/webp, each ≤ 2 MB)
304+
305+
### Plugin Marketplace
306+
307+
The marketplace is provided by the always-enabled `_plugin_installer` plugin. Users can reach it from the **Plugins** dialog in two ways:
255308

256-
### Plugin Marketplace (Coming Soon)
309+
- the **Browse** tab in `webui/components/plugins/list/plugin-list.html`
310+
- the **Install** toolbar action injected by `plugins/_plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.html`, which opens `plugins/_plugin_installer/webui/main.html` on its own **Browse** tab
257311

258-
A built-in **Plugin Marketplace** plugin (always active) will allow users to browse the Plugin Index and install or update community plugins directly from the Agent Zero UI. This section will be updated once the marketplace plugin is released.
312+
Both routes surface Plugin Index entries inside Agent Zero. The marketplace supports search, filtering, sorting, and a detail view with README content and installation actions.
259313

260314
---
261315

docs/developer/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ This architecture ensures:
6565
| `usr/secrets.env` | Secrets store (managed via Settings -> Secrets) |
6666
| `conf/model_providers.yaml` | Model provider defaults and settings |
6767
| `agent.py` | Core agent implementation |
68-
| `initialize.py` | Framework initialization |
68+
| `execute.py` | Framework initialization |
6969
| `models.py` | Model providers and configs |
7070
| `preload.py` | Pre-initialization routines |
7171
| `prepare.py` | Environment preparation |

0 commit comments

Comments
 (0)