Creating a plugin
Agento scaffolds plugin projects using the agento plugin init command. This creates a TypeScript project equipped with example tools, human approval gates, boot-time pre-flight checks, and coding assistant rules (AGENTS.md).
1. Scaffold the plugin
Section titled “1. Scaffold the plugin”Run agento plugin init to generate a new plugin workspace:
# Standard starter with custom tools, subsystems, and approval gatesagento plugin init @my-org/agento-plugin-database ./agento-plugin-database
# Minimal single-file pluginagento plugin init my-tools --flavor minimal
# Effect-native pluginagento plugin init worker --flavor effect
# MCP server bridgeagento plugin init postgres-mcp --flavor mcp-bridgeAvailable template flavors
Section titled “Available template flavors”| Flavor | Best for | Description |
|---|---|---|
standard |
Full plugins (default) | Includes custom tools, subsystems, boot tasks, and approval gates. |
minimal |
Fast tool distribution | Single-file TypeScript entrypoint with zero boilerplate. |
effect |
Functional runtimes | Effect-first architecture with Effect.gen and typed Schemas. |
mcp-bridge |
External integrations | Bridges Model Context Protocol (MCP) tool servers to Agento. |
The generated project structure (for standard flavor):
agento-plugin-database/├── package.json # Scripts (build, typecheck) and peer dependencies├── tsconfig.json # Strict TypeScript configuration├── README.md # Human developer guide├── AGENTS.md # Coding assistant rules└── src/ ├── index.ts # Entrypoint exporting definePlugin() ├── tools/ │ └── example.ts # Deterministic tool with Zod schema └── subsystems/ └── example.ts # Subsystem with SetupTask and approval gate2. Install dependencies
Section titled “2. Install dependencies”Install dependencies using your preferred package manager:
# npmnpm install
# pnpmpnpm install
# bunbun install3. Working with AGENTS.md
Section titled “3. Working with AGENTS.md”The scaffolded AGENTS.md file defines the working rules and @agento/sdk conventions for AI coding assistants.
When you open your plugin project in an AI-assisted environment, the assistant reads AGENTS.md to understand:
- How to define type-safe tools with
defineTool()andz. - How to implement the
Subsysteminterface viadefineSubsystem(). - How to attach
"user-approval"gates to sensitive actions. - Verification commands (
npm run typecheck,npm run build).
4. Customize tools and subsystems
Section titled “4. Customize tools and subsystems”Defining a custom tool (src/tools/query.ts)
Section titled “Defining a custom tool (src/tools/query.ts)”import { defineTool, z } from "@agento/sdk";
export const dbQueryTool = defineTool({ description: "Execute a read query against the database", parameters: z.object({ query: z.string().describe("SQL SELECT query to execute"), }), execute: async ({ query }) => { return { result: "Query executed successfully", timestamp: new Date().toISOString(), }; },});Implementing the subsystem (src/subsystems/database.ts)
Section titled “Implementing the subsystem (src/subsystems/database.ts)”import { defineSubsystem, defineSetupTask } from "@agento/sdk";
export const databaseSubsystem = defineSubsystem({ id: "com.myorg.database.subsystem", name: "Database Subsystem", setupTasks: [ defineSetupTask({ id: "db:preflight", name: "Database Connection Pre-Flight", description: "Verifies database connectivity at boot", run: async (ctx) => { ctx.emitProgress("Testing connection..."); ctx.emitProgress("Connected."); }, }), ], approvals: { run_migration: "user-approval", }, instructions: { plan: "DATABASE: You are in Plan Mode. Inspect schema before planning migrations.", act: "DATABASE: You are in Act Mode. Execute approved migrations.", },});5. Local testing with Agento
Section titled “5. Local testing with Agento”-
Build the plugin:
Terminal window npm run build # or pnpm build / bun run build -
Link the package locally:
Terminal window npm link # or bun link / pnpm link --global -
In your target repository, link and register the plugin in
.agento/config.json:Terminal window npm link @my-org/agento-plugin-databaseIn
.agento/config.json:{"plugins": ["@my-org/agento-plugin-database"]} -
Launch
agentoand verify that your plugin tools and startup tasks appear in the interactive session.