Function Signature
Description
Creates a new plugin instance with the specified options. This is the main entry point for building Atomemo plugins. The function handles authentication, plugin registration, and returns an instance object with methods to add credentials, tools, models, and run the plugin.Parameters
The plugin configuration object containing metadata and settings.
Returns
An object containing methods to configure and run the plugin
Example
Behavior
Debug Mode
WhenHUB_MODE environment variable is set to "debug":
- Fetches user information from OneAuth session
- Registers the plugin with the Hub using
register_pluginmessage - Writes the plugin definition to
definition.json - Uses debug topic:
debug_plugin:{plugin.name}
Release Mode
WhenHUB_MODE is not "debug":
- Reads user information from
definition.jsonfile - Uses release topic:
release_plugin:{plugin.name}__{HUB_MODE}__{version}
Signal Handling
The plugin automatically sets up handlers forSIGINT and SIGTERM signals to gracefully shut down the connection when the process is terminated.
Error Handling
- Throws error if user session cannot be fetched in debug mode
- Throws error if
definition.jsoncannot be parsed in release mode - Exits process with code 1 on authentication or definition errors