pub struct PythonRuntime { /* private fields */ }Expand description
Long-lived Python REPL.
Implementations§
Source§impl PythonRuntime
impl PythonRuntime
Sourcepub async fn new() -> Result<Self, String>
pub async fn new() -> Result<Self, String>
Spawn a REPL with no context variable and no LLM helpers wired up.
Used by the agent loop for inline repl blocks the model emits in
regular conversation.
Sourcepub fn with_state_path(_path: PathBuf) -> Self
pub fn with_state_path(_path: PathBuf) -> Self
Compatibility shim — older RLM code path used to pass a state file. The state file is no longer used, but the path doubles as an extra scratch location callers can rely on for cleanup symmetry.
Sourcepub async fn spawn_with_context(context_path: &Path) -> Result<Self, String>
pub async fn spawn_with_context(context_path: &Path) -> Result<Self, String>
Spawn a REPL with context (and ctx) preloaded from a file. Used
by the RLM turn loop.
Sourcepub async fn execute(&mut self, code: &str) -> Result<ReplRound, String>
pub async fn execute(&mut self, code: &str) -> Result<ReplRound, String>
Execute a Python code block with no RPC dispatcher. Used for inline
repl blocks where llm_query() should fall back to a sentinel.
Sourcepub async fn run<D>(
&mut self,
code: &str,
bridge: Option<&D>,
) -> Result<ReplRound, String>where
D: RpcDispatcher + ?Sized,
pub async fn run<D>(
&mut self,
code: &str,
bridge: Option<&D>,
) -> Result<ReplRound, String>where
D: RpcDispatcher + ?Sized,
Execute a code block, dispatching any sub-LLM RPCs through bridge.
Returns once Python emits __RLM_DONE_<sid>__ or the round timeout
elapses (whichever happens first).
Sourcepub fn round_count(&self) -> u64
pub fn round_count(&self) -> u64
Total rounds executed.
Trait Implementations§
Source§impl Debug for PythonRuntime
impl Debug for PythonRuntime
Source§impl Drop for PythonRuntime
impl Drop for PythonRuntime
Auto Trait Implementations§
impl !RefUnwindSafe for PythonRuntime
impl !UnwindSafe for PythonRuntime
impl Freeze for PythonRuntime
impl Send for PythonRuntime
impl Sync for PythonRuntime
impl Unpin for PythonRuntime
impl UnsafeUnpin for PythonRuntime
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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