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– TheMailboxused 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: DoltGraphImplementations§
Source§impl CHORUSAgent
impl CHORUSAgent
Sourcepub(crate) async fn init(
id: &str,
base_path: &Path,
) -> Result<Self, Box<dyn Error>>
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.
Sourcepub(crate) async fn run_loop(&self)
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.