pub struct RotaryAgentBridge { /* private fields */ }Expand description
Bridge that wraps an rx4::Agent and provides a simplified interface for
apollo’s outer shell to use.
The bridge handles:
- Creating and configuring the rx4::Agent (provider, tools, system prompt)
- Translating messages between apollo and rx4 types
- Running prompts through rx4’s agent loop
Unthinkclaw’s unique features (channels, swarm, cron, heartbeat, autonomous
mode, plugins) remain in the outer shell and call run_prompt() on this
bridge to execute agent turns.
Implementations§
Source§impl RotaryAgentBridge
impl RotaryAgentBridge
Sourcepub fn new(config: RotaryBridgeConfig) -> Self
pub fn new(config: RotaryBridgeConfig) -> Self
Build a new bridge from the given configuration.
Sourcepub fn agent(&self) -> &Agent
pub fn agent(&self) -> &Agent
Get a reference to the inner rx4::Agent (for advanced configuration).
Sourcepub fn clear_messages(&mut self)
pub fn clear_messages(&mut self)
Clear the conversation history.
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of messages in the conversation.
Sourcepub fn set_system_prompt(&mut self, prompt: &str)
pub fn set_system_prompt(&mut self, prompt: &str)
Set the system prompt.
Sourcepub fn set_workspace_root(&mut self, path: &Path)
pub fn set_workspace_root(&mut self, path: &Path)
Set the workspace root.
Sourcepub fn subscribe(&mut self, callback: impl Fn(&Event) + Send + Sync + 'static)
pub fn subscribe(&mut self, callback: impl Fn(&Event) + Send + Sync + 'static)
Add a subscriber to receive agent events (tool calls, deltas, etc.).
Sourcepub async fn run_prompt(&mut self, prompt: &str) -> Result<String>
pub async fn run_prompt(&mut self, prompt: &str) -> Result<String>
Run a single user prompt through the rx4 agent loop.
This delegates the core agent loop (LLM calls, tool execution, turn cycling) to rx4::Agent. The caller (apollo’s channel/swarm/cron shell) is responsible for:
- Receiving the user message from a channel
- Calling this method with the prompt text
- Sending the final response back through the channel
Returns the final assistant response text.
Sourcepub async fn run_prompt_with_history(
&mut self,
prompt: &str,
history: &[ChatMessage],
) -> Result<String>
pub async fn run_prompt_with_history( &mut self, prompt: &str, history: &[ChatMessage], ) -> Result<String>
Run a prompt with pre-loaded conversation history.
The history is loaded into rx4’s message buffer before running the prompt. This is used when apollo’s memory backend provides conversation history for a chat session.
Sourcepub fn register_tools(&mut self, tools: &[Arc<dyn UnthinkclawTool>])
pub fn register_tools(&mut self, tools: &[Arc<dyn UnthinkclawTool>])
Register additional tools at runtime.
Sourcepub fn list_tools(&self) -> Vec<String>
pub fn list_tools(&self) -> Vec<String>
Get the list of registered tool names.
Auto Trait Implementations§
impl !Freeze for RotaryAgentBridge
impl !RefUnwindSafe for RotaryAgentBridge
impl !UnwindSafe for RotaryAgentBridge
impl Send for RotaryAgentBridge
impl Sync for RotaryAgentBridge
impl Unpin for RotaryAgentBridge
impl UnsafeUnpin for RotaryAgentBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more