Overview
A plugin is the fundamental building block of the Atomemo Plugin SDK. It represents a complete automation unit that packages together credentials, tools, models, and metadata to provide functionality to the Atomemo platform.Creating a Plugin
Use thecreatePlugin function to initialize a new plugin instance:
Plugin Metadata
Each plugin requires the following metadata:Unique identifier for your plugin. Used for registration and routing.
Localized display names for your plugin. Keys are locale codes (e.g.,
en_US).Localized descriptions of what your plugin does.
URL to your plugin’s icon image.
Plugin version following semantic versioning. Defaults to
npm_package_version if not specified.Configuration for the WebSocket transporter. See Transporter for details.
Author Information
The SDK automatically handles author information based on the runtime mode:Debug Mode
In debug mode, the SDK fetches user information from your OneAuth session:Release Mode
In release mode, author information is read fromdefinition.json:
Plugin Lifecycle
1. Initialization
When you create a plugin, the SDK:- Validates and loads environment variables
- Fetches author information (debug or release mode)
- Creates an internal registry for features
- Initializes the transporter for Hub Server communication
2. Registration Phase
Add features to your plugin using the registration methods:All features are validated using Zod schemas before being registered. Invalid definitions will throw an error at registration time.
3. Runtime Phase
Start your plugin with therun() method:
- Connects to the Hub Server via WebSocket
- Joins the appropriate channel (
debug_pluginorrelease_plugin) - Registers all features with the Hub Server (debug mode only)
- Listens for incoming requests:
credential_auth_spec- Credential authentication requestsinvoke_tool- Tool invocation requests
- Handles graceful shutdown on SIGINT/SIGTERM signals
Channel Naming
The SDK automatically determines the correct channel name based on runtime mode:Event Handling
Tool Invocation
When the Hub Server requests a tool invocation:Credential Authentication
When the Hub Server needs to authenticate credentials:Definition Export
In debug mode, the SDK automatically exports your plugin definition:definition.json file containing all plugin metadata and registered features, which is used for release deployments.
Error Handling
The plugin system includes comprehensive error handling:- Validation errors: Thrown during feature registration if definitions are invalid
- Connection errors: Caught and logged with helpful messages about API keys
- Runtime errors: Caught during tool invocation and sent back to the Hub Server
Best Practices
- Use descriptive names: Plugin and feature names should be clear and descriptive
- Provide localization: Always include at least
en_USfor display names and descriptions - Version properly: Follow semantic versioning for your plugin versions
- Handle errors gracefully: Implement proper error handling in all tool implementations
- Test in debug mode: Always test your plugin in debug mode before releasing
Next Steps
Credentials
Learn how to define and authenticate credentials
Tools
Create executable tools for your plugin
Registry
Understand how features are registered and resolved
Transporter
Configure WebSocket communication