diff --git a/website/docs/guides/build-a-hermes-plugin.md b/website/docs/guides/build-a-hermes-plugin.md index 7a63ac04a7..e0a7f662c2 100644 --- a/website/docs/guides/build-a-hermes-plugin.md +++ b/website/docs/guides/build-a-hermes-plugin.md @@ -44,8 +44,12 @@ This tells Hermes: "I'm a plugin called calculator, I provide tools and hooks." Optional fields you could add: ```yaml author: Your Name -requires_env: # gate loading on env vars - - SOME_API_KEY # plugin disabled if missing +requires_env: # gate loading on env vars; prompted during install + - SOME_API_KEY # simple format — plugin disabled if missing + - name: OTHER_KEY # rich format — shows description/url during install + description: "Key for the Other service" + url: "https://other.com/keys" + secret: true ``` ## Step 3: Write the tool schemas @@ -336,13 +340,35 @@ def register(ctx): If your plugin needs an API key: ```yaml -# plugin.yaml +# plugin.yaml — simple format (backwards-compatible) requires_env: - WEATHER_API_KEY ``` If `WEATHER_API_KEY` isn't set, the plugin is disabled with a clear message. No crash, no error in the agent — just "Plugin weather disabled (missing: WEATHER_API_KEY)". +When users run `hermes plugins install`, they're **prompted interactively** for any missing `requires_env` variables. Values are saved to `.env` automatically. + +For a better install experience, use the rich format with descriptions and signup URLs: + +```yaml +# plugin.yaml — rich format +requires_env: + - name: WEATHER_API_KEY + description: "API key for OpenWeather" + url: "https://openweathermap.org/api" + secret: true +``` + +| Field | Required | Description | +|-------|----------|-------------| +| `name` | Yes | Environment variable name | +| `description` | No | Shown to user during install prompt | +| `url` | No | Where to get the credential | +| `secret` | No | If `true`, input is hidden (like a password field) | + +Both formats can be mixed in the same list. Already-set variables are skipped silently. + ### Conditional tool availability For tools that depend on optional libraries: diff --git a/website/docs/user-guide/features/plugins.md b/website/docs/user-guide/features/plugins.md index 18191cb74f..a8f984fed4 100644 --- a/website/docs/user-guide/features/plugins.md +++ b/website/docs/user-guide/features/plugins.md @@ -87,7 +87,7 @@ Project-local plugins under `./.hermes/plugins/` are disabled by default. Enable | Inject messages | `ctx.inject_message(content, role="user")` — see [Injecting Messages](#injecting-messages) | | Ship data files | `Path(__file__).parent / "data" / "file.yaml"` | | Bundle skills | Copy `skill.md` to `~/.hermes/skills/` at load time | -| Gate on env vars | `requires_env: [API_KEY]` in plugin.yaml | +| Gate on env vars | `requires_env: [API_KEY]` in plugin.yaml — prompted during `hermes plugins install` | | Distribute via pip | `[project.entry-points."hermes_agent.plugins"]` | ## Plugin discovery