AGNT Plugin Builder
End-to-end procedure for creating, building, installing, and hot-reloading AGNT plugins entirely from chat — no IDE, no manual zipping, no app restart.
Why this skill exists
AGNT plugins are self-contained tool bundles (.agnt files = gzipped tar archives) that extend AGNT with custom workflow nodes. The official process is well-documented but involves a few coordinated steps across the filesystem and HTTP API. This skill encodes the exact sequence so any request like "build me a plugin that does X" can be completed in one flow.
Where a plugin lives
Every account has its own workspace, so no path here is fixed. Resolve <workspace> each time.
| Purpose | Where |
|---|---|
| Plugin source (the user's) | <workspace>/plugins/<plugin-name>/ |
| <workspace> | The path in your system prompt's Workspace section ("The user's workspace directory is: ..."). If that section is missing, read it: GET /api/filesystem/settings returns workspaceRoot. |
| Build and install | POST /api/plugins/build-generated (works in every install; no AGNT source checkout needed) |
| Installed copy | AGNT's user-data plugins/installed/<plugin-name>/. AGNT manages it: never edit it in place |
| Share with others | Publish to the marketplace (Step 4) |
| AGNT API base | http://localhost:3333/api |
Never create a user's plugin in the AGNT repository's backend/plugins/dev/. That folder is AGNT's own
source tree: the staging area for the few plugins bundled with the app (see Contributors below). Most users
run the packaged app and have no such folder, and a plugin put there belongs to AGNT's source, not to the user.
Plugin anatomy (the minimum viable plugin)
<plugin-name>/
├── manifest.json ← metadata + tool schemas (required)
├── package.json ← deps; MUST include "type": "module"
└── <tool-name>.js ← ES module, default-exports an instance
After npm install a node_modules/ folder joins them and gets bundled into the .agnt.
`manifest.json` essentials
{
"name": "my-plugin",
"version": "1.0.0",
"description": "What it does",
"author": "AGNT User",
"icon": "sparkles",
"permissions": {
"capabilities": ["network"],
"domains": ["api.example.com"]
},
"tools": [
{
"type": "my-tool",
"entryPoint": "./my-tool.js",
"schema": {
"title": "My Tool",
"category": "action",
"type": "my-tool",
"icon": "sparkles",
"description": "Human-facing description shown in the node picker",
"parameters": { /* see references/manifest-schema.md */ },
"outputs": { /* key → {type, description} */ }
}
}
]
}
Rules that matter:
nameand tooltypeare kebab-case, and each tooltypemust be unique across the whole AGNT instance.categoryis one ofaction | trigger | utility | widget | control | custom. 90% of plugins areaction.- The top-level
typein the tool object and thetypeinsideschemamust match. entryPointis relative to the manifest (use./file.js).permissionsis required.cli/build-plugin.jsrefuses to build without
permissions.capabilities and permissions.domains as arrays. Both must be
present even when empty — see below.
For the full schema (parameter input types, conditional visibility, auth modes, output shapes), read references/manifest-schema.md.
`permissions` — what the plugin is allowed to do
The build refuses to package a manifest without a structured permissions
block, so this is not optional:
❌ Official plugin disclosure gate: manifest.json must contain structured
permissions.capabilities and permissions.domains arrays
"permissions": {
"capabilities": ["network", "filesystem", "env-access"],
"domains": ["api.example.com", "cdn.example.com"]
}
capabilities is drawn from a fixed vocabulary — anything else is ignored:
| Capability | Declare it when the plugin… |
|---|---|
| network | makes outbound HTTP/WebSocket calls (fetch, axios, ws, https.request) |
| filesystem | reads or writes files (fs, node:fs, fs/promises, fs-extra) |
| spawn-process | shells out (child_process, node:child_process, execFile, spawn) |
| env-access | reads process.env |
| dynamic-eval | uses eval or new Function |
| dynamic-import | imports a module path built at runtime |
domains lists the hostnames the plugin contacts. Leave it [] when the
plugin makes no outbound calls of its own — a plugin that shells out to a CLI
which then talks to the network declares spawn-process, not network, because
the plugin's own code opens no socket.
The build runs a source scan and prints what it found next to what you declared:
🔍 Scanning capabilities (first-party source only)...
Detected: filesystem, env-access
Declared: env-access, filesystem, spawn-process
The two lists do not have to match. Effective permissions are the union, so
an undeclared capability is still granted — and disclosed to the user at install
time as an undeclared one, which costs the plugin trust tier. Declaring more
than the scan detects is harmless and is the right call whenever you know the
plugin does something the regex-based scan cannot see.
`package.json` essentials
{
"name": "my-plugin",
"version": "1.0.0",
"type": "module",
"main": "my-tool.js",
"dependencies": { "axios": "^1.7.0" }
}
"type": "module" is non-negotiable — AGNT loads plugins as ES modules. The build script auto-patches this if missing, but include it explicitly to avoid surprise.
Tool code essentials
Every action tool follows this shape:
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const APP_PATH = process.env.APP_PATH || path.join(__dirname, '../../..');
class MyTool {
constructor() { this.name = 'my-tool'; } // must equal manifest tool.type
async execute(params, inputData, workflowEngine) {
try {
// ...your logic...
return { /* keys matching schema.outputs */ };
} catch (error) {
console.error(`[${this.name}] Error:`, error);
return { error: error.message };
}
}
}
export default new MyTool(); // ← instance, not the class
Ironclad rules:
- ES modules only (
import/export). Norequire. - Default-export an instance, not the class. AGNT calls
.execute()on it directly. this.namein the constructor must equal the tool'stypein the manifest.- For triggers (category
trigger), extendEventEmitterand implementsetup,validate,process,teardown— seereferences/tool-templates.md. - Return errors as
{ error: "..." }rather than throwing, so downstream nodes see the failure gracefully.
For auth-enabled tools and trigger skeletons, read references/tool-templates.md.
The build pipeline
Each step is small and independently verifiable, so stop and debug at any step that fails rather than pushing through.
Step 1 — Scaffold the plugin in the workspace
Resolve <workspace> (see Where a plugin lives), then write the files with file_operations / write_file:
<workspace>/plugins/<plugin-name>/manifest.json
<workspace>/plugins/<plugin-name>/package.json
<workspace>/plugins/<plugin-name>/<tool-name>.js
Always write JSON with JSON.stringify(obj, null, 2) to guarantee valid syntax (no trailing commas, proper quoting).
Keep only plugin files in this folder: everything in it is packaged. Notes, scripts and test fixtures go elsewhere.
Files must be text (code, JSON, markdown); give the plugin an icon name rather than an image file.
Step 2 — Build and install
POST /api/plugins/build-generated takes the plugin's files, runs npm install --production when
package.json lists dependencies, packages the .agnt, installs it and reloads every plugin process.
Run it from execute_javascript_code:
const fs = require('fs');
const path = require('path');
const API = 'http://localhost:3333/api';
const H = { Authorization: 'Bearer ' + process.env.AGNT_AUTH_TOKEN, 'Content-Type': 'application/json' };
const { workspaceRoot } = await (await fetch(API + '/filesystem/settings', { headers: H })).json();
const dir = path.join(workspaceRoot, 'plugins', '<plugin-name>');
// Every file except manifest.json, package.json and node_modules, keyed by its path inside the folder.
const SKIP = new Set(['node_modules', 'manifest.json', 'package.json', 'package-lock.json']);
const toolCode = {};
(function walk(rel) {
for (const entry of fs.readdirSync(path.join(dir, rel), { withFileTypes: true })) {
const file = rel ? rel + '/' + entry.name : entry.name;
if (SKIP.has(file)) continue;
if (entry.isDirectory()) walk(file);
else toolCode[file] = fs.readFileSync(path.join(dir, file), 'utf8');
}
})('');
const res = await fetch(API + '/plugins/build-generated', {
method: 'POST',
headers: H,
body: JSON.stringify({
manifest: JSON.parse(fs.readFileSync(path.join(dir, 'manifest.json'), 'utf8')),
packageJson: JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')),
toolCode,
installAfterBuild: true,
}),
});
console.log(await res.json()); // { success, installed, installResult, reloadStatus }
The new tools are available to workflows, agents and the node picker straight away. No app restart.
Step 3 — Verify
const { plugins } = await (await fetch(API + '/plugins/installed', { headers: H })).json();
// Confirm <plugin-name> appears with enabled: true and tools listed
If the plugin shows up but the tool doesn't fire when used, inspect the AGNT backend console — it logs [PluginManager] errors at load time that usually reveal the issue (bad export, missing dep, path error).
Step 4 — Share it: publish to the marketplace
Only when the plugin should be available to other people. This is what Plugins → Publish does:
- Check the sign-ins. Get the installed package, then ask whether it can be published:
```javascript
const pkg = await (await fetch(API + '/plugins/installed/<plugin-name>/package', { headers: H })).json();
const check = await (await fetch(API + '/plugins/install-file/check-auth', { method: 'POST', headers: H, body: JSON.stringify({ fileData: pkg.data }) })).json();
// check.publishable must not be false; fix every sign-in it lists first (see Sign-ins below).
```
- First publish of this plugin:
POST https://api.agnt.gg/marketplace/publishwith
{ asset_type: 'plugin', asset_id: '<plugin-name>', asset_data: { manifest, packageData: pkg.data, size: pkg.size }, title, description, category, tags, price }.
- A new version of a listing that exists: bump
versionin manifest.json and package.json, rebuild
(Step 2), then POST https://api.agnt.gg/marketplace/items/<listingId>/version with
{ packageData, changelog }. /marketplace/publish only creates, and answers 409 for an existing id.
Contributors: plugins bundled with AGNT
Only when working on AGNT's own source. The few plugins that ship inside the app live in the AGNT
repository's backend/plugins/dev/ and are built with the CLI (it also accepts a path to any plugin folder):
node backend/plugins/cli/build-plugin.js <plugin-name> # -> backend/plugins/plugin-builds/<plugin-name>.agnt
The CLI validates the manifest, auto-fixes a missing "type": "module", runs npm install if needed, and
scans the source for capabilities. It refuses to build a manifest without a structured permissions block;
if the run stops on that error, add the block described above rather than working around it. To draft one from
the source automatically (no arguments: it scans every plugin in dev/ and writes one ready-to-paste block per
plugin to permissions-drafts/<plugin-name>.json):
node backend/plugins/cli/draft-permissions.js
Sign-ins: the plugin must work for everyone who installs it
When you build a plugin that talks to a service needing a key or a login, you
set up that sign-in, and it has to work for every user, not only for the account
you built it on. The marketplace refuses a plugin otherwise.
Step 1. Is it a shared AGNT sign-in? Read the live list. Ask it with no
Authorization header: anonymously it answers with exactly the shared sign-ins
(signed in, it would also list your private ones, which nobody else can use).
const list = await (await fetch('https://api.agnt.gg/auth/providers')).json();
const shared = new Set((Array.isArray(list) ? list : list.providers).map((p) => p.id));
shared.has('notion'); // true -> use authProvider: "notion" and declare nothing
Step 2. If not, bundle it in the plugin with a top-level auth array in
manifest.json. It ships inside the package and shows up under Connections with
a real Connect button for whoever installs it:
| Service signs in with | auth entry | What each user does |
|---|---|---|
| An API key | { "id", "name", "type": "apikey", "keyLabel", "instructions", "helpUrl" } | Pastes their own key |
| OAuth | { "id", "name", "type": "oauth2", "authorizationUrl", "tokenUrl", "scopes", "clientId"? } | Signs in themselves (authorization code + PKCE). clientId only if it is a public client; omit it and each user supplies their own |
Then every tool that needs it sets "authRequired": "apiKey" (or "oauth") and
"authProvider": "<id>" in its schema. Full field rules: references/manifest-schema.md.
Step 3. Read the credential from params.__auth.token. AGNT resolves the
connected key or token and passes it in for chat, workflows and triggers alike.
Import nothing from AGNT; when it is missing, return
{ success: false, code: 'CONNECTION_REQUIRED', error: 'Connect <Service> in Settings → Connections, then run this again.' }.
Templates: references/tool-templates.md (B and C).
Never:
- put a key, token, password or client secret anywhere in the plugin (the build refuses an
authentry that carries one); - ask for a key as a tool parameter;
- create a sign-in on the AGNT server for a plugin (
create_provider,POST /auth/providers). A server sign-in is private to the account that made it, so the plugin works for you and for nobody else. That is exactly how Calendly broke; - declare an
authid that is already a shared sign-in (the marketplace refuses it: use the shared one).
The build tells you. cli/build-plugin.js prints each sign-in as plugin
(bundled), shared, or unresolved, and warns "Can't be published" for an
unresolved one. In the Plugin Forge, install_plugin reports the same. Fix every
unresolved sign-in before calling the plugin done.
Alternative: AI-generated plugins (faster for boilerplate)
When the user wants a simple REST-wrapper plugin and doesn't care about fine details, the built-in generator can be faster.
Important: POST /api/plugins/generate is a Server-Sent Events (SSE) endpoint with Content-Type: text/event-stream, not a normal JSON endpoint. It emits these events:
progressmanifestcodepackagecompleteerror
That means the client must:
- Open the generate request and consume the SSE stream
- Collect the generated
manifest,code, andpackagepayloads - Wait for
complete - Send the collected artifacts to
POST /api/plugins/build-generated - Call
POST /api/plugins/reload
Pseudo-flow:
// 1. Open SSE stream to /plugins/generate
// Collect events: manifest, code, package
// Wait for complete
// 2. Build + install in one shot using the collected artifacts
await fetch(API + '/plugins/build-generated', {
method: 'POST',
headers: { Authorization: 'Bearer ' + process.env.AGNT_AUTH_TOKEN, 'Content-Type': 'application/json' },
body: JSON.stringify({
manifest,
toolCode,
packageJson,
installAfterBuild: true
})
});
// 3. Reload
await fetch(API + '/plugins/reload', {
method: 'POST',
headers: { Authorization: 'Bearer ' + process.env.AGNT_AUTH_TOKEN }
});
If you include code here, label it as SSE-aware or pseudo-code so future readers do not mistake /plugins/generate for a plain fetch(...).json() endpoint.
Use the manual 6-step pipeline for anything non-trivial — you get full control over the code and can iterate quickly when something breaks.
Editing an existing plugin
To modify a plugin, start from its source in <workspace>/plugins/<plugin-name>/:
- If that folder does not exist (the plugin came from the marketplace, or was built elsewhere), fetch the installed source with
GET /api/plugins/installed/<name>/sourceand write it into that folder first. - Edit in place.
- Re-run Step 2 (build and install: it overwrites the installed copy cleanly) and Step 3 (verify). To ship the change to others, bump the version and publish it (Step 4).
To remove a plugin: DELETE /api/plugins/:name, then POST /api/plugins/reload.
Common pitfalls (and the fixes)
| Pitfall | Fix |
|---|---|
| Using require | Use import; declare "type": "module" in package.json |
| Exporting the class | export default new ClassName() — an instance |
| Importing AuthManager into a tool | Don't: read params.__auth.token, which AGNT fills in for every tool with authRequired + authProvider |
| A tool that writes, summarises or classifies calls OpenAI/Anthropic itself, or names an AI model (claude-code, openai-codex, openai...) as its authProvider | Give it no sign-in and call await workflowEngine.ai.generate({ prompt, system, maxTokens }), which runs on the user's selected AI. AI models are not sign-ins: a subscription has no token for a tool |
| Sign-in shows unresolved / "Can't be published" | Declare it in manifest.auth, or use the shared sign-in's id. Never create a server sign-in for it |
| Plugin created in the AGNT repo's backend/plugins/dev/ | That is AGNT's source tree, not the user's. Create it in <workspace>/plugins/<plugin-name>/ and build it with Step 2 |
| Bloated .agnt | Use npm install --production |
| Tool type mismatch (manifest vs. this.name) | Keep them identical, kebab-case |
| Invalid JSON in manifest | Always write via JSON.stringify(obj, null, 2) |
| Build stops on must contain structured permissions | Add permissions: { capabilities: [], domains: [] } — both keys, both arrays, even when empty |
| UI doesn't show new tool | Hit POST /api/plugins/reload — forgetting this is the #1 "it didn't work" cause |
| Windows backslashes in file:// URLs | filePath.replace(/\\/g, '/') before prefixing with file:// |
Smoke-test plugin: `echo-plugin`
When verifying the pipeline itself (e.g., after an AGNT update, or when debugging a broken build), scaffold this trivial no-deps plugin as a canary. It takes under a minute end-to-end and proves that scaffold → build → install → reload all work.
echo-plugin/
├── manifest.json (one action tool, no auth, one string input "text")
├── package.json ("type": "module", no dependencies)
└── echo.js (returns { reversed: params.text.split('').reverse().join('') })
If this succeeds, the pipeline is healthy. If it fails, the problem is environmental, not a plugin-code issue.
Reference files
Load these only as needed — the main SKILL.md above is sufficient for ~80% of plugins.
references/manifest-schema.md— Full manifest/schema reference: every tool category, every input type (text,textarea,select,checkbox,codearea,password,agent-select, etc.), conditional parameter visibility, output shapes, icon names, built-in auth providers. Read when the user's plugin has complex UI (multi-action select with conditional fields, dynamic parameter visibility, typed outputs).references/tool-templates.md— Copy-paste ES-module templates: basic action tool, action tool with OAuth, action tool with API key, trigger tool (EventEmitter pattern with setup/validate/process/teardown), utility tool. Read at scaffold time and adapt.
Verification checklist
Before declaring a plugin done, confirm:
- ✅
GET /api/plugins/installedshows the plugin withenabled: true. - ✅ All declared tools appear in the response with their schemas intact.
- ✅ A minimal test workflow or agent that uses the tool executes successfully end-to-end.
- ✅ Error paths return
{ error: "..." }— no uncaught throws. - ✅ If auth is required, a disconnected state produces a clear, actionable error message ("Reconnect in Settings").
- ✅ Every sign-in the build lists is
pluginorshared, neverunresolved.