> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# bus • Rust AI Agent SDK

> Event Bus Module for PraisonAI Agents.

# bus

<Badge color="orange">Rust AI Agent SDK</Badge>

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

```ignore theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
use praisonai::bus::*;
```

## Classes

<CardGroup cols={2}>
  <Card title="Event" icon="brackets-curly" href="../classes/Event">
    An event in the event bus.
  </Card>

  <Card title="EventBus" icon="brackets-curly" href="../classes/EventBus">
    Event bus for publish-subscribe messaging.
  </Card>

  <Card title="EventType" icon="brackets-curly" href="../classes/EventType">
    Types of events that can be published.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="get_event_bus()" icon="function" href="../functions/get_event_bus">
    Get the global event bus
  </Card>

  <Card title="publish()" icon="function" href="../functions/publish">
    Publish an event to the global bus
  </Card>

  <Card title="subscribe()" icon="function" href="../functions/subscribe">
    Subscribe to events on the global bus
  </Card>

  <Card title="subscribe_all()" icon="function" href="../functions/subscribe_all">
    Subscribe to all events on the global bus
  </Card>
</CardGroup>
