Struct CHORUSAgent

Source
pub struct CHORUSAgent {
    pub(crate) id: String,
    pub(crate) mailbox: Mailbox,
    pub(crate) graph: DoltGraph,
}
Expand description

Represents a running CHORUS agent.

§Fields

  • id – Logical identifier for the agent (e.g., “agent-001”).
  • mailbox – The Mailbox used for inter‑agent communication.
  • graph – Persistence layer (DoltGraph) where task logs are stored.

§Rationale

Agents are isolated units of work. By keeping a dedicated mailbox and a graph per agent we guarantee that each agent can be started, stopped, and reasoned about independently while still contributing to the global CHORUS state.

Fields§

§id: String§mailbox: Mailbox§graph: DoltGraph

Implementations§

Source§

impl CHORUSAgent

Source

pub(crate) async fn init( id: &str, base_path: &Path, ) -> Result<Self, Box<dyn Error>>

Initializes a new CHORUSAgent.

This creates the filesystem layout under base_path, opens or creates the SQLite mailbox, and initialises a DoltGraph for state persistence. It also ensures that a task_log table exists for recording incoming messages.

§Parameters
  • id – Identifier for the agent instance.
  • base_path – Directory where the agent stores its data.

Returns an instance ready to run its event loop.

Source

pub(crate) async fn run_loop(&self)

Main event loop of the agent.

It repeatedly polls the mailbox for pending messages addressed to this agent, logs each message into the task_log table, commits the graph, and acknowledges the message. The loop sleeps for a configurable interval to avoid busy‑waiting.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.