Architecting Enterprise Multi-Agent Systems: My Journey at the Switch Hackathon

The promise of autonomous AI agents is only as good as the orchestration framework uniting them. During the Switch Hackathon (Track 03: Best Core Contribution) by SandboxAQ and WeMakeDevs, I set out to tackle real-world distributed systems and multi-pod operational challenges in Switch.

Here is a breakdown of the 4 core architecture contributions I designed, implemented, and submitted.

1. Scheduled Messages for Autonomous Agent Rooms (#771)

Pull Request: #1154

The Challenge

Teams using Switch need automated workflows—such as recurring standups, automated code triage, and cron health reports delivered directly into agent collaboration rooms. In a multi-pod Kubernetes environment, multiple worker processes polling the database risk triggering duplicate messages or locking tables.

Key Architectural Solutions:

  • Claim-Then-Dispatch Pattern: Using Postgres SELECT FOR UPDATE SKIP LOCKED inside a short-lived transaction that advances ext_run_at before external message dispatches.
  • Tenant Row-Level Security (RLS): Wrapping queries within tenant-isolated scopes so enterprise tenancy invariants remain impenetrable.
  • Clock Drift Mitigation: Anchored due date calculations to Postgres unc.now() rather than pod-local clocks.

2. Low-Latency Turn Cancellation for Real-Time Agents (#800)

Pull Request: #1164

The Challenge

When users send a message or queue a prompt while an agent is busy, mistakes happen. Previously, once a message entered the activity stream, there was no deterministic way to stop an agent from executing queued turns.

Key Architectural Solutions:

  • Implemented !cancel @agent control commands across the agent bridge and session host.
  • Built zero-downtime rolling deployment tolerance: catching legacy 422 schema rejections during pod upgrades and gracefully falling back to 'interrupted'.
  • Validated with 80+ unit and integration tests across @switch-console/shared and @sandboxaq/switch-agent-runtime.

3. Enterprise Collaboration Adapter: Mattermost Bridge (#793)

Pull Request: #1055

  • Added native Mattermost integration into Switch\'s collaboration bridge suite.
  • Bi-directional webhook and bot event handling with interactive approval cards.

4. Safe Tool I/O Approval Controls (#803)

Pull Request: #1658

  • Fine-grained permission interceptors allowing human operators to inspect and approve bash/script tool executions before they touch host environments.

Conclusion

Participating in the Switch Hackathon was an incredible journey in production-grade AI agent orchestration. A huge thank you to SandboxAQ, Petr, and the entire community!

HowISwitch #AI #OpenSource #DevTools