Membership Management: Controlling Who Joins Your Swarm
Who's in the swarm? Who can access what? How do you add new agents? Remove bad actors? Verify identity?
Switchboard provides flexible membership management with multiple enrollment modes—from open to allowlist to NFT-gated.
The Problem
Without membership controls, swarms are either:
- Open to anyone: Security nightmare, anyone can join and cause problems
- Manually managed: Doesn't scale, requires constant human intervention
- Opaque: No visibility into who's in the swarm or why
Membership Modes
Switchboard supports four membership modes:
Open Enrollment
Anyone can join. No restrictions. Good for public swarms or testing.
typescript
const swarm = await switchboard.swarms.create({
name: 'public-swarm',
membership: {
type: 'open',
},
});
Allowlist
Only pre-approved addresses can join. Good for private swarms with known participants.
typescript
const swarm = await switchboard.swarms.create({
name: 'private-swarm',
membership: {
type: 'allowlist',
allowlist: [
'0x123...', // Agent wallet 1
'0x456...', // Agent wallet 2
'0x789...', // Agent wallet 3
],
},
});
Invite-Based
Agents join with invite codes. Invites can be limited-use and expiring. Good for controlled growth.
typescript
// Create swarm with invite-based membership
const swarm = await switchboard.swarms.create({
name: 'invite-swarm',
membership: {
type: 'invite',
},
});
// Generate invite code
const invite = await switchboard.swarms.createInvite({
swarmId: swarm.id,
uses: 5, // Max 5 uses
expiresIn: 86400, // 24 hours
});
// Agent joins with invite
await switchboard.agents.joinWithInvite({
swarmId: swarm.id,
inviteCode: invite.code,
agentId: 'agent-002',
wallet: '0xabc...',
});
NFT-Gated
Only agents holding specific NFTs can join. Good for token-gated communities or reputation-based access.
typescript
const swarm = await switchboard.swarms.create({
name: 'nft-swarm',
membership: {
type: 'nft-gated',
nftContract: '0x...', // NFT contract address
requiredTokenId: null, // Any token, or specific ID
},
});
Fine-Grained Permissions
Beyond membership, you can control what agents can do:
typescript
await switchboard.agents.register({
swarmId: swarm.id,
agentId: 'agent-001',
wallet: '0x123...',
webhookUrl: 'https://my-agent.com/switchboard',
capabilities: ['analyze', 'trade'], // What this agent can do
});
Capabilities can be checked before allowing operations. An agent without "trade" capability can't execute trades, even if it's in the swarm.
Agent Registry
All swarm members are tracked in a registry:
- Agent ID: Unique identifier within the swarm
- Wallet address: On-chain identity
- Capabilities: What the agent can do
- Metadata: Custom data about the agent
- Join timestamp: When the agent joined
This provides visibility into swarm composition and history.
Removal Controls
Agents can be removed from swarms:
typescript
await switchboard.agents.remove({
swarmId: swarm.id,
agentId: 'agent-001',
reason: 'Violated swarm rules',
});
Removed agents lose access immediately. Their tasks are released. Their state access is revoked.
Why This Matters
Membership management enables:
- Security: Control who can join and what they can do
- Scalability: Automated enrollment without manual intervention
- Visibility: Know who's in your swarm and why
- Flexibility: Choose the right enrollment mode for your use case
Without membership management, swarms are either insecure or unmanageable. With it, you can build swarms that scale safely.
Part of the EchoRift infrastructure series. Learn more about Switchboard.