Skip to content

feat: Agent Event Subscriptions — lightweight pub/sub for inter-agent pipelines (#169) - #191

Merged
vybe merged 2 commits into
mainfrom
feature/169-agent-event-subscriptions
Mar 26, 2026
Merged

vybe merged 2 commits into
mainfrom
feature/169-agent-event-subscriptions

Conversation

@vybe

@vybe vybe commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds lightweight SQLite-backed event pub/sub for inter-agent pipelines
  • Agents emit named events via emit_event MCP tool, subscribers receive async tasks with {{payload.field}} template interpolation
  • Permission-gated via existing agent_permissions system

Changes

Backend (Python):

  • db/event_subscriptions.py — New EventSubscriptionOperations class (CRUD, matching, event persistence)
  • routers/event_subscriptions.py — 9 new API endpoints (subscription CRUD, event emission, event history)
  • db/schema.py — 2 new tables (agent_event_subscriptions, agent_events) + 5 indexes
  • db_models.py — 6 new Pydantic models
  • database.py — 10 delegation methods + model re-exports
  • main.py — Router registration, WebSocket injection
  • routers/agents.py — Cleanup subscriptions on agent delete

MCP Server (TypeScript):

  • tools/events.ts — 4 new MCP tools: emit_event, subscribe_to_event, list_event_subscriptions, delete_event_subscription
  • client.ts — 4 new API client methods
  • server.ts — Tool registration

Documentation:

  • Feature flow: docs/memory/feature-flows/agent-event-subscriptions.md
  • Architecture, changelog, requirements updated

Test plan

  • 44 tests in tests/test_event_subscriptions.py — all passing
  • Authentication guards (6 tests)
  • Event emission with payloads, validation, namespacing (9 tests)
  • Event emission for specific agents (2 tests)
  • Event history listing and filtering (6 tests)
  • Subscription CRUD — create, read, update, delete, duplicates (13 tests)
  • Subscription direction filtering (4 tests)
  • Event trigger matching and disabled subscription skip (3 tests)
  • Permission gating — self-subscription always allowed (1 test)
  • TypeScript compilation clean

Closes #169

🤖 Generated with Claude Code

vybe and others added 2 commits March 26, 2026 11:43
… pipelines (#169)

Adds a SQLite-backed event pub/sub system where agents emit named events
and other agents subscribe to receive async tasks when matching events fire.
Uses existing agent_permissions for access control.

New MCP tools: emit_event, subscribe_to_event, list_event_subscriptions,
delete_event_subscription

New API endpoints: subscription CRUD, event emission, event history

44 tests, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Resolve conflicts in changelog.md and feature-flows.md — keep both sides.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vybe
vybe merged commit 4e7d161 into main Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent Event Subscriptions: lightweight pub/sub for inter-agent pipelines

1 participant