Skip to main content

bus

Rust AI Agent SDK Event Bus Module for PraisonAI Agents. Provides a publish-subscribe event system for agent communication.

Features

  • Type-safe event publishing and subscription
  • Async event handlers
  • Multi-agent event isolation
  • Event filtering and routing

Example

use praisonai::{EventBus, Event, EventType};

let bus = EventBus::new();
bus.subscribe(EventType::AgentStart, |event| {
println!("Agent started: {:?}", event);
});
bus.publish(Event::agent_start("my_agent"));

Import

use praisonai::bus::*;

Classes

Event

An event in the event bus.

EventBus

Event bus for publish-subscribe messaging.

EventType

Types of events that can be published.

Functions

get_event_bus()

Get the global event bus

publish()

Publish an event to the global bus

subscribe()

Subscribe to events on the global bus

subscribe_all()

Subscribe to all events on the global bus