Package 'rho.agent'

Title: Rho Async Agent Core
Description: Implements the asynchronous multi-turn agent loop over the Rho AI protocol, including ordered lifecycle events, steering and follow-up queues, cancellation, and typed scheduling of concurrent tool calls.
Authors: Sounkou Mahamane Toure [aut, cre]
Maintainer: Sounkou Mahamane Toure <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1.9001
Built: 2026-07-21 23:01:58 UTC
Source: https://github.com/RGenomicsETL/Rho

Help Index


Agent state machine, policy, scheduling, and lifecycle events

Description

rho_prompt() and rho_continue() return tasks. The agent consumes typed assistant events, schedules tool tasks, preserves source-order results, and emits typed lifecycle events. Steering and follow-up queues have separate, typed draining policies.

Details

Policy and scheduling decisions are S7 generics. Packages can specialize context transformation, before/after-tool behavior, next-turn preparation, assistant event reduction, queue draining, and tool batch execution without replacing the core loop.


Session journal, context, and compaction contracts

Description

A SessionJournal is the consumer-defined structural interface for committed session compare-and-append and snapshots. rho_memory_session_journal() is the process-local implementation. rho_agent() receives a journal explicitly; rho_sync_session() asynchronously projects an existing snapshot into an idle agent. Assistant streaming state remains in RhoAssistantTurn and only its terminal message is committed.

Details

The journal is append-only. Compare-and-append rejects a stale committed position before mutation. Message entries retain the complete interaction, reset entries begin a new active context without erasing history, and rho_build_agent_context() projects through the latest compaction entry and any explicit exclusions.

rho_compact() prepares a stable cut point, runs an asynchronous compactor, appends a semantic checkpoint, and invokes before/after policy methods. Automatic threshold compaction and one bounded provider-input recovery use the same protocol. Applications can supply another RhoCompactor class or specialize the public generics without replacing the agent loop.