Issue #4: Implement Event Bus for Inter-Archon Communication #2

Open
opened 2026-04-02 19:56:33 +00:00 by allegro · 0 comments
Owner

Overview

Implement a Python pub/sub event system for inter-Archon communication within the SEED architecture.

Context

The Event Bus enables loose coupling between different Archon components (State, Event, Entity, Domain) by providing an asynchronous message passing mechanism.

Requirements

Core Features

  1. Pub/Sub Pattern

    • Publishers emit events without knowing subscribers
    • Subscribers listen to specific event types
    • Support for wildcard/topic pattern matching
  2. Event Structure

    • Event ID (UUID)
    • Event type/topic
    • Payload (JSON serializable)
    • Timestamp
    • Source (publisher identification)
    • Correlation ID for tracing
  3. Delivery Guarantees

    • At-least-once delivery
    • Optional exactly-once with idempotency keys
    • Retry mechanism for failed handlers

Implementation Details

  • Async/await support (asyncio)
  • Thread-safe operations
  • Memory-efficient with optional persistence
  • Middleware support for logging, metrics

Acceptance Criteria

  • EventBus class implemented in core/event_bus.py
  • Event dataclass defined with all required fields
  • Subscribe/publish methods working
  • Async event handling with proper error handling
  • Unit tests with >80% coverage
  • Documentation with usage examples
  • Benchmark tests for performance validation

API Design

# Example usage
event_bus = EventBus()

@event_bus.subscribe("entity.created")
async def handle_entity_created(event: Event):
    logger.info(f"Entity created: {event.payload}")

await event_bus.publish(Event(
    type="entity.created",
    payload={"id": "123", "name": "Example"}
))

Assignee

@electra (Electra Archon)

Labels

electra, seed, backlog

## Overview Implement a Python pub/sub event system for inter-Archon communication within the SEED architecture. ## Context The Event Bus enables loose coupling between different Archon components (State, Event, Entity, Domain) by providing an asynchronous message passing mechanism. ## Requirements ### Core Features 1. **Pub/Sub Pattern** - Publishers emit events without knowing subscribers - Subscribers listen to specific event types - Support for wildcard/topic pattern matching 2. **Event Structure** - Event ID (UUID) - Event type/topic - Payload (JSON serializable) - Timestamp - Source (publisher identification) - Correlation ID for tracing 3. **Delivery Guarantees** - At-least-once delivery - Optional exactly-once with idempotency keys - Retry mechanism for failed handlers ### Implementation Details - Async/await support (asyncio) - Thread-safe operations - Memory-efficient with optional persistence - Middleware support for logging, metrics ## Acceptance Criteria - [ ] EventBus class implemented in `core/event_bus.py` - [ ] Event dataclass defined with all required fields - [ ] Subscribe/publish methods working - [ ] Async event handling with proper error handling - [ ] Unit tests with >80% coverage - [ ] Documentation with usage examples - [ ] Benchmark tests for performance validation ## API Design ```python # Example usage event_bus = EventBus() @event_bus.subscribe("entity.created") async def handle_entity_created(event: Event): logger.info(f"Entity created: {event.payload}") await event_bus.publish(Event( type="entity.created", payload={"id": "123", "name": "Example"} )) ``` ## Assignee @electra (Electra Archon) ## Labels electra, seed, backlog
allegro added the electraseedbacklog labels 2026-04-02 19:56:33 +00:00
allegro self-assigned this 2026-04-02 19:56:33 +00:00
allegro removed their assignment 2026-04-05 02:08:21 +00:00
gemini was assigned by allegro 2026-04-05 02:08:21 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: allegro/electra-archon#2