Building XENON: Bringing an Autonomous Voice & Chat SRE Teammate to Discord with Switch
Hackathon Submission: Built for the Flip the Switch Hackathon hosted by WeMakeDevs, powered by Switch AI.
1. The Bottleneck: Why AI Agents Are Trapped in Developer Terminals
Over the past year, autonomous AI coding agents (Claude Code, Cursor, OpenCode, Codex) have fundamentally upgraded our personal velocity. But in production engineering, software engineering is not a solo sport.
When a critical incident strikes, a deployment fails, or a PR is waiting on tests, your team doesn’t live in your isolated terminal window. Your team gathers in Discord, Slack, or Microsoft Teams.
Today, human engineers are forced to act as fragile, manual human bridges:
- Copy-pasting error traces from Discord into an AI terminal.
- Waiting for the agent to recommend a fix.
- Copy-pasting the markdown or patch back into Discord.
- Running the deployment manually.
We asked: What if the AI agent sat directly inside our Discord server as a full engineering peer—listening in voice channels, triaging incidents, and running privileged rollbacks upon voice authorization?
Meet XENON.
2. Introducing XENON
XENON is an open-source autonomous developer teammate powered by Switch.
Instead of living trapped in one engineer's local shell, XENON:
-
Collaborates in Discord channels and voice calls: Tag
@XENONin chat or summon him into a Discord voice channel. - Processes Real-Time Voice: Ingests voice instructions using Whisper Speech-to-Text and replies aloud via low-latency neural TTS.
- Orchestrates Real Developer Work: Connects directly to GitHub REST/GraphQL APIs and CI/CD webhooks via structured tool execution.
- Enforces Strict RBAC: Ensures only authorized repository maintainers and guild administrators can approve critical deployments or rollbacks.
3. High-Level Architecture
Here is how the end-to-end data flow operates:
┌────────────────────────────────────────┐
│ Team Discord Server │
│ [ #war-room Chat ] [ Voice Call ] │
└───────────┬────────────────────┬───────┘
│ │
▼ ▼
[ Discord Gateway ] [ Audio Stream ]
│ │
▼ ▼
[ Switch Framework ] [ Whisper STT ]
(Session Persistence) │
│ │
└─────────┬──────────┘
│
▼
[ RBAC Security Guard ]
(Owner / Role Verification)
│
▼
[ Autonomous Agent Loop ]
(MCP Developer Tools)
│
┌─────────────────┴─────────────────┐
▼ ▼
[ GitHub & CI/CD ] [ Neural Edge-TTS ]
(Direct API Actions) (Discord Voice Out)
4. Key Engineering Challenges & Solutions
A. The Bot-to-Bot Communication Trap
A common architectural antipattern is attempting to have an AI Discord bot trigger other developer bots (like deployment shippers) by typing commands into text channels.
The reality: The official Discord API standard explicitly requires bots to ignore other bots (if (message.author.bot) return;) to prevent infinite cascading loops.
The Fix: XENON bypasses bot-chat intermediaries entirely. Armed with Model Context Protocol (MCP) tool schemas, XENON interfaces directly with GitHub APIs, Docker daemons, and Vercel/CI webhooks under cryptographically verified credentials.
B. High-Fidelity Audio Without Crashing Your Budget
Relying on expensive, metered third-party TTS APIs during long hackathon debugging sessions quickly exhausts quotas. Furthermore, Discord’s built-in /tts command only reads text aloud on the local user’s operating system—it does not broadcast into voice channels.
The Fix: We built a dedicated voice pipeline combining:
- Whisper STT for low-latency voice command parsing from Discord voice streams.
-
Microsoft
edge-ttsfor zero-cost, ultra-natural neural audio generation that streams directly into the active@discordjs/voiceconnection.
C. The Switch Backbone
Switch (sandbox-quantum/switch) handles the heavy lifting of:
- Decoupling Discord's messy gateway event structures from the underlying agent loop.
- Providing seamless state and session persistence across multiple channel threads.
- Allowing our entire team to inspect XENON's reasoning steps in real-time.
5. Code Spotlight: The RBAC Security Guard
When an AI agent has the authority to run tests, inspect code, and trigger rollbacks, security cannot be an afterthought. Here is how XENON guards privileged execution paths:
typescript
// src/security/rbac.ts
import { GuildMember, PermissionsBitField } from "discord.js";
export interface SecurityContext {
userId: string;
isOwner: boolean;
hasDeployPrivilege: boolean;
}
export function verifyExecutionPrivilege(
member: GuildMember,
allowedRoleIds: string[]
): SecurityContext {
const isOwner = member.id === member.guild.ownerId;
const isAdmin = member.permissions.has(PermissionsBitField.Flags.Administrator);
const hasRole = member.roles.cache.some((role) => allowedRoleIds.includes(role.id));
const hasDeployPrivilege = isOwner || isAdmin || hasRole;
if (!hasDeployPrivilege) {
console.warn(`[SECURITY] Blocked unauthorized command attempt by ${member.user.tag} (${member.id})`);
}
return {
userId: member.id,
isOwner,
hasDeployPrivilege,
};
}
6. What’s Next for XENON
Building with Switch during this hackathon proved that AI agents are ready to move out of solitary confinement and into team chat.
Our roadmap includes:
- Multi-Platform Support: Expanding Switch routing to mirror incidents simultaneously across Discord and Slack.
- Proactive Log Streaming: Having XENON detect Sentry anomalies and automatically open a Discord war-room thread with reproduction steps before an engineer is paged.
Try it out & Contribute!
- GitHub Repo: github.com/[YOUR_USERNAME]/xenon-agent
- Powered by Switch: github.com/sandbox-quantum/switch
- Hackathon: WeMakeDevs Flip the Switch
If you found this interesting, drop a reaction or let us know in the comments how your team is connecting AI agents to chat platforms!
Top comments (0)