# Node packages (plugins)

Build your own nodes with the agenticmind-node CLI, package them as wheels, and install them into AgenticMind where they run in isolated workers with approved permissions.

Source: https://glamorous-boar.cloudvent.net/node-packages/

---

You can extend AgenticMind with your own node types. Third-party nodes are packaged as Python wheels, installed into their own folder, and run in **isolated worker processes**, never inside the platform process, only after an admin approves exactly the permissions they request.

## 1. Create a package

<CodeBlock language="bash" filename="terminal" showCopy={true}>

```
uv run agenticmind-node new acme-text-nodes --namespace acme   # scaffold: package, example node, tests, README
uv run agenticmind-node validate acme-text-nodes                # namespace, semver, descriptions, permissions, tests
uv run agenticmind-node test acme-text-nodes                    # pytest with the SDK's test helpers
uv run agenticmind-node pack acme-text-nodes                    # validate + build dist/*.whl
```

</CodeBlock>

The scaffold passes ruff and its tests out of the box. A working example lives in `examples/plugins/acme-text-nodes`.

## 2. Write a node

<CodeBlock language="python" filename="acme_text_nodes/nodes.py" showCopy={true}>

```
from typing import Literal
from pydantic import Field
from agenticmind_node_sdk import (
    InputPort, NodeConfig, NodeContext, NodeResult, OutputPort, PortType, define_node, ui,
)

class ReverseConfig(NodeConfig):
    mode: Literal["chars", "words"] = "chars"
    keep_case: bool = Field(default=True, json_schema_extra=ui(advanced=True))

@define_node(
    type="acme.text.reverse",          # <publisher>.<family>.<name>; agenticmind.* is reserved
    version="1.0.0",
    display_name="Reverse",
    category="transform",
    package="acme-text-nodes",
    description="Reverses text.",
    inputs=[InputPort(name="text", type=PortType.STRING)],
    outputs=[OutputPort(name="text", type=PortType.STRING)],
    config=ReverseConfig,
)
async def reverse(ctx: NodeContext, inputs, config: ReverseConfig) -> NodeResult:
    text = inputs["text"]
    out = " ".join(reversed(text.split())) if config.mode == "words" else text[::-1]
    return NodeResult(outputs={"text": out})

def register(registrar):
    registrar(reverse)
```

</CodeBlock>

Declare the entry point in `pyproject.toml`:

<CodeBlock language="toml" filename="pyproject.toml" showCopy={true}>

```
[project.entry-points."agenticmind.nodes"]
acme = "acme_text_nodes:register"
```

</CodeBlock>

The full SDK (ports, branches, permissions, secrets, errors, events, testing) is in [Node SDK](/architecture/node-sdk/).

## 3. Install and approve

1. Node library → **Node packages…** → **Install from .whl…** (admins). Choose the trust level: `community` (default) or `private`.
2. The wheel is inspected **without importing it** (name, version, dependencies, entry points, unsafe paths). Reserved names and namespaces, and node types that clash with existing ones, are refused.
3. The package is **pending**. Its nodes appear in the library marked *not approved*; graphs using them load but report `NODE_NOT_PERMITTED`.
4. **Review & approve**: approval must grant **exactly** the requested permissions and confirm the reviewed wheel hash.
5. Use the nodes like any other.

Every install, including an upgrade, needs a new approval. Packages can be disabled, enabled, removed, and their wheel downloaded (to move it to another server).

## The isolated worker

Each invocation runs in a fresh process (`python -I -m agenticmind_plugins.worker`) with:

- a **scrubbed environment** (no host variables, so no host secrets);
- its own temporary working directory; the plugin folder appended (never prepended) to `sys.path`;
- inputs, config and run input as JSON on stdin; outputs back as JSON (prints cannot corrupt the protocol);
- **only the secrets referenced in that node's own config**, and only with `credentials`;
- a storage folder only with `filesystem`; a network guard without `network`;
- the node's timeout (plus CPU and memory rlimits on POSIX).

Crashes, exits, non-JSON outputs and timeouts become node errors (`PLUGIN_*`), and output types are still checked by the host.

### Permissions available to packages

`network`, `credentials`, `filesystem` (a storage folder per package), `subprocess`, `database`. Not yet: `artifacts` (project files) and `memory`.

## Limits

About 0.3–0.6 s per invocation (a process each time), fine for graph steps but not tight loops. On Windows only the timeout bounds a worker and network/filesystem are not OS-enforced. Packages cannot provide agent tools, use project files or memory, or be exported in standalone apps yet. No package signing (`verified` is reserved).
