For the complete documentation index, see llms.txt. This page is also available as Markdown.

Input

Build a new input plugin

Overview

This guide walks you through creating a new input plugin for OM1. Input plugins allow you to integrate various data sources and sensors into your agent.

Prerequisites

  • Understanding of Go interfaces and structs

  • Familiarity with concurrent programming in Go

  • Knowledge of the data source you're integrating

Implementation Steps

Step 1: Create a Provider (Optional)

If your plugin requires complex initialization or external service integration, create a provider.

Location: /internal/providers/your_provider.go

Step 2: Create a new Plugin File

To proceed with a new input plugin integration, create a Go file. Location: /plugins/inputs/your_plugin/your_plugin.go

Required imports:

package your_plugin

import (
    "context"
    "github.com/openmind/om1/internal/inputs"
)

Step 3: Implement the Sensor Interface

Your plugin must implement the Sensor interface defined in internal/inputs/sensor.go:

Step 4: Implement Your Plugin Struct

Step 5: Implement Required Methods

Plugin Registration

Plugins are registered using the inputs.Register function. Add an init() function to your plugin:

How it works:

  • The inputs.Register function maps your plugin type name to its factory function

  • The inputs.Load function creates instances based on configuration

  • Plugin type names in config files must match the registered name

Requirements:

  • Implement the Sensor interface from internal/inputs/sensor.go

  • Register your factory function with inputs.Register

  • File must be in /plugins/inputs/ directory

Last updated

Was this helpful?