Skip to content

harnesslabs/arbiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,512 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arbiter

A Rust-based multi-agent framework.

Discord Twitter Visitors

Overview

Arbiter is a Rust-based, event-driven multi-agent framework that lets developers orchestrate strongly-typed, high-performance simulations and networked systems.

Arbiter provides the foundational types and traits for building actor-based systems with pluggable networking and lifecycle management. It is designed around a lightweight actor model tailored for discrete-event simulation, automated trading, and complex distributed systems.


Core Concepts

Arbiter's architecture is built around several key traits and structs that make agent development straightforward:

  • Actor: The core execution unit. Contains the agent's internal state and logic.
  • LifeCycle: A trait defining the start, stop, and snapshot behavior of an actor.
  • Handler<M>: A trait used to implement message-handling logic for specific message types.
  • Network: A generalized trait for instantiating and managing connections between parts of the system.
  • Runtime: Manages the execution context of the actors, mediating subscriptions and routing messages.

Quick Example

Here is a glimpse of how you can build a simple actor with Arbiter that handles Ping messages:

use arbiter::prelude::*;

#[derive(Debug, Clone)]
pub struct Ping;

#[derive(Debug, Clone)]
pub struct Counter {
    pub count: usize,
}

// Define the actor's lifecycle
impl LifeCycle for Counter {
    type Snapshot = usize;
    type StartMessage = ();
    type StopMessage = ();

    fn on_start(&mut self) -> Self::StartMessage {}
    fn on_stop(&mut self) -> Self::StopMessage {}
    fn snapshot(&self) -> Self::Snapshot { self.count }
}

// Implement message passing logic
impl Handler<Ping> for Counter {
    type Reply = ();

    fn handle(&mut self, _message: &Ping) -> Option<Self::Reply> {
        self.count += 1;
        println!("Counter received Ping. Total: {}", self.count);
        None
    }
}

Documentation

For an in-depth dive into Arbiter's design, extensive examples, and API specifics, please check out our MDBook Documentation.

Contributing

We welcome community contributions! Please see our Contributing Guidelines to get started.

About

Multi-agent framework for design, simulation, and auditing.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors