OpenAgent
Features

Plugins

Extend OpenAgent with custom channels, model providers, and tools.

Plugins

OpenAgent's plugin system lets you extend the platform without modifying core code. Plugins can add new model providers, messaging channels, document parsers, embedding models, and agent tools.

Plugin Types

TypeWhat it adds
Model ProviderA new LLM or embedding model provider
ChannelA new messaging platform integration
Document ParserSupport for a new file format
ToolA new built-in tool available to agents
StorageA new file storage backend
EmbeddingA new embedding model provider

Installing Plugins

Plugins are Go packages that register themselves with OpenAgent at startup. Installing a plugin requires rebuilding the application.

  1. Add the plugin package to go.mod:
go get github.com/example/openagent-plugin-myprovider
  1. Import the plugin in main.go to trigger its init() registration:
import _ "github.com/example/openagent-plugin-myprovider"
  1. Rebuild and restart:
go build -o openagent && ./openagent
  1. Create a custom Dockerfile that extends the base image:
FROM openagent/openagent:latest AS base

# Add your plugin
COPY plugin-myprovider.so /app/plugins/

# Or build from source with the plugin included
FROM golang:1.21 AS builder
WORKDIR /app
COPY . .
RUN go get github.com/example/openagent-plugin-myprovider
RUN go build -o openagent main.go
  1. Rebuild your custom image and restart.

Building a Plugin

Plugins implement one of OpenAgent's provider interfaces. Here's an example model provider plugin:

Model Provider Plugin

package myprovider

import (
    "github.com/the-open-agent/openagent/model"
)

func init() {
    model.RegisterProvider("my-provider", &MyProvider{})
}

type MyProvider struct{}

func (p *MyProvider) GetCompletion(ctx context.Context, req *model.CompletionRequest) (*model.CompletionResponse, error) {
    // Call your model API here
    resp, err := callMyAPI(req.Messages, req.Model, req.Temperature)
    if err != nil {
        return nil, err
    }
    return &model.CompletionResponse{
        Content: resp.Text,
        Usage:   model.Usage{InputTokens: resp.InTokens, OutputTokens: resp.OutTokens},
    }, nil
}

func (p *MyProvider) ListModels() []string {
    return []string{"my-model-v1", "my-model-v2"}
}

Channel Plugin

package mychannel

import (
    "github.com/the-open-agent/openagent/channels"
)

func init() {
    channels.Register("my-channel", &MyChannel{})
}

type MyChannel struct {
    token string
}

func (c *MyChannel) Configure(config map[string]string) error {
    c.token = config["token"]
    return nil
}

func (c *MyChannel) SendMessage(ctx context.Context, chatID string, msg *channels.Message) error {
    return sendToMyPlatform(c.token, chatID, msg.Text)
}

func (c *MyChannel) StartReceiving(ctx context.Context, handler channels.MessageHandler) error {
    // Set up webhook or polling to receive messages
    return listenForWebhooks(ctx, c.token, handler)
}

Plugin Configuration

After installing and registering a plugin, configure it in the dashboard under Settings → Providers (for model providers) or Channels → Add Channel (for channel plugins). The plugin's registered name appears in the provider/channel type dropdown.

Official Plugin Ideas

The following are good candidates for community plugins:

Plugin SDK Reference

Interfaces to implement

InterfacePackageDescription
ModelProvidermodelLLM completion
EmbeddingProviderembeddingText embeddings
ChannelchannelsMessaging integration
DocumentParsertxtFile format parser
StorageProviderstorageFile storage backend

Registration functions

FunctionDescription
model.RegisterProvider(name, provider)Register an LLM provider
embedding.RegisterProvider(name, provider)Register an embedding provider
channels.Register(name, channel)Register a channel
txt.RegisterParser(ext, parser)Register a document parser
storage.RegisterProvider(name, provider)Register a storage backend

All registration functions are idempotent and safe to call from init(). They panic if a name is registered twice, so use unique plugin names.

On this page