Video Tutorial: Plugin Power: Add Superpowers to Your Agents
What We’ll Build
This guide shows how to build a fal.ai plugin that lets your agent generate 6-second, 768p videos from text prompts using the MiniMax Hailuo-02 model. For architectural concepts, see Plugin Architecture. You’ll learn:- Actions (what the agent can DO)
- Progressive development (start simple, organize as you grow)
- Local plugin testing (character.plugins array method)
- Plugin testing (component and E2E tests)
Step 1: Quick Start
Create Project and Plugin
Create a project with a plugin inside using CLI commands:1
Create project
Terminal
- Database: PgLite (perfect for local development)
- Model: OpenAI
Terminal
2
Create plugin inside project
Terminal
3
Add plugin to character
In
my-eliza-project/src/character.ts
, add the local path to Eliza’s plugins array:src/character.ts
Connect and Test
1
Build plugin and test connection
The plugin needs to be built first to create the Verify it’s loaded:
dist/
folder that ElizaOS loads from:Terminal
- Check the console logs for
Successfully loaded plugin 'plugin-fal-ai'
- Visit
http://localhost:3000
→ click your agent → Plugins tab
Step 2: Development
Research the API
Let’s research what we want to build by exploring fal.ai for a good text-to-video model. MiniMax Hailuo-02 Text to Video looks pretty good.- Navigate to the JavaScript/Typescript section of the docs to see how to call the API:
- Install:
bun add @fal-ai/client
- Import:
import { fal } from "@fal-ai/client"
- Use:
fal.subscribe("model-endpoint", { input: {...} })
- Returns:
{ data, requestId }
- Install:
Edit Default Plugin Template
1
Add fal.ai dependency
Terminal
2
Study the template structure
Open
plugin-fal-ai/src/plugin.ts
to see the sample code patterns for plugins:quickAction
- example Action (what agent can DO)quickProvider
- example Provider (gives agent CONTEXT)StarterService
- example Service (manages state/connections)- Plugin events, routes, models - other comprehensive patterns
3
Create your text-to-video action using plugin patterns
Copy the plugin file and rename it to create your action:Now let’s edit the example plugin into our generateVideo action:Add the fal.ai import (from the fal.ai docs):Update the action identity for video generation:Replace validation with API key check:Replace hello world logic with video generation:Update examples for video conversations:
Terminal
src/actions/generateVideo.ts
4
Update index.ts to use your action
Finally, update
src/index.ts
to use our new plugin:src/index.ts
You can reference
plugin.ts
as well as other plugins from the Plugin Registry to see other plugin component examples (providers, services, etc.) as you expand your plugin.Add Configuration
1
Get your fal.ai API key
Get an API key from fal.ai and copy/paste it into your .env:
.env
Step 3: Testing
Test Plugin Functionality
Verify your plugin works as expected:1
Test the updated plugin
First rebuild your plugin to effect our changes, then start from project root:
Terminal
2
Test video generation
Try your new action by chatting with Eliza in the GUI (
http://localhost:3000
):"Create video: dolphins jumping in ocean"
"Make video: cat playing piano"
"Generate video: sunset over mountains"
Plugin Component Tests
Plugins come default with component and E2E tests. Let’s add custom component tests:1
Add a component test
Update
plugin-fal-ai/src/__tests__/plugin.test.ts
:src/__tests__/plugin.test.ts
2
Run component tests
Terminal
Plugin E2E Tests
Let’s also add a custom E2E test:1
Add an E2E test
Update
src/__tests__/e2e/plugin-fal-ai.e2e.ts
:src/__tests__/e2e/plugin-fal-ai.e2e.ts
2
Run E2E tests
Terminal
Step 4: Possible Next Steps
Congratulations! You now have a working video generation plugin. Here are some ways you can improve it:Enhance Your Action
- Add more similes - Handle requests like “animate this”, “video of”, “show me a clip of”
- Better examples - Add more conversation examples so Eliza learns different chat patterns
- Error handling - Handle rate limits, invalid prompts, or API timeouts
Add Plugin Components
- Providers - Give your agent context about recent videos or video history
- Evaluators - Track analytics, log successful generations, or rate video quality
- Services - Add queueing for multiple video requests or caching for common prompts