Video Tutorial: Multiple Agents and Characters
This guide builds on concepts from Customize an Agent
Step 1: Add Hemingway
Add Hemingway to your project
You already have Shakespeare insrc/character.ts
from the previous guide. Now let’s add another agent to our project so they can interact. We’ll create a fresh character file for Hemingway using the CLI:
Terminal
hemingway.json
. You’ll now have:
src/character.ts
- Shakespeare (TypeScript format)hemingway.json
- Hemingway (JSON format)
The CLI clones JSON character templates by default. If you prefer TypeScript characters, you can manually clone your
character.ts
file from your IDE. They work exactly the same, it’s just a matter of preference.Customize Hemingway’s personality
Openhemingway.json
and update it to customize Hemingway’s personality:
hemingway.json
topics
, style
, messageExamples
, etc.) to match Hemingway as you see fit.
Step 2: Configure Discord and voice
Add Discord plugin to Hemingway
Addplugin-discord
to Hemingway so he can join Shakespeare in our Discord server:
hemingway.json
Configure agent-specific keys
But wait! We have our Discord environment variables defined in.env
, but we need unique ones for each agent. Hemingway and Shakespeare need their own Discord bot tokens. How do we have agent-specific keys?
For that, we use secrets
under settings
in each character file. This allows each agent to have their own Discord bot identity:
For Hemingway (hemingway.json
):
hemingway.json
src/character.ts
):
src/character.ts
Each agent needs its own Discord application and bot token. Follow the Discord setup steps from the previous guide for each agent you create.
Enable voice mode
Let’s enable voice capabilities for our agents in Discord: For Hemingway (hemingway.json
):
hemingway.json
src/character.ts
):
src/character.ts
Add ElevenLabs voice provider
Now let’s addplugin-elevenlabs
to provide high-quality voice synthesis for our agents:
Add ElevenLabs plugin:
hemingway.json
src/character.ts
Configure voices for each agent
Now let’s add the ElevenLabs secrets so each agent has their own distinct voice: For Hemingway (hemingway.json
):
hemingway.json
src/character.ts
):
src/character.ts
Get your ElevenLabs API key from elevenlabs.io and explore different voice IDs to find the perfect match for each agent’s personality.
Step 3: Configure multi-agent project
Add newly created agent to your project
Update yoursrc/index.ts
to include both agents so they start automatically:
src/index.ts
Launch both agents simultaneously
Now when you start your project, both agents launch automatically:Terminal
Alternative: CLI agent commandYou can also manipulate agents via the CLI once a server is running. See the CLI Agent Command Reference for complete details.
Join them in Discord voice chat
Now go to the voice channel’s chatroom and invite both agents to join the voice channel:
