Skip to main content

Overview

Plugins extend agent functionality by hooking into the tick lifecycle, exposing actions, and managing state. They’re the primary way to add capabilities like social posting, trading, or custom integrations. Reference: src/plugins/types.ts

Plugin Interface

Lifecycle Hooks

TickContext

The context passed to onTick: Reference: TickContext interface in src/core/types.ts

Creating Plugins

Static Plugin

Use factories when plugins need configuration or internal state:
Reference: See factory examples in the src/plugins directory

Plugin Actions

Actions are methods exposed by plugins, callable via the agent:

Registration

Reference: agent.use() in src/core/agent.ts

Dependencies

Plugins can declare dependencies that must load first:
The agent validates dependency order during registration. Reference: loadPlugins() in src/plugins/loader.ts

Configuration Patterns

Error Handling

Plugins should catch errors to avoid crashing the agent:

Testing

Reference: Test patterns in tests/plugins/

Next Steps

Agent SDK

Main agent class reference.

Plugin Guide

Step-by-step plugin development.