Struct InMemoryRunner
pub struct InMemoryRunner { /* private fields */ }Expand description
Runs TextAgents with full service wiring (session, memory, artifacts, plugins).
Auto-wires in-memory service implementations by default; override with builder methods for custom persistence.
Implementations§
§impl InMemoryRunner
impl InMemoryRunner
pub fn new(
agent: Arc<dyn TextAgent>,
app_name: impl Into<String>,
) -> InMemoryRunner
pub fn new( agent: Arc<dyn TextAgent>, app_name: impl Into<String>, ) -> InMemoryRunner
Create a new runner with in-memory defaults for all services.
pub fn session_service(self, svc: Arc<dyn SessionService>) -> InMemoryRunner
pub fn session_service(self, svc: Arc<dyn SessionService>) -> InMemoryRunner
Override the session service.
pub fn memory_service(self, svc: Arc<dyn MemoryService>) -> InMemoryRunner
pub fn memory_service(self, svc: Arc<dyn MemoryService>) -> InMemoryRunner
Override the memory service.
pub fn artifact_service(self, svc: Arc<dyn ArtifactService>) -> InMemoryRunner
pub fn artifact_service(self, svc: Arc<dyn ArtifactService>) -> InMemoryRunner
Override the artifact service.
pub fn plugin(self, p: impl Plugin + 'static) -> InMemoryRunner
pub fn plugin(self, p: impl Plugin + 'static) -> InMemoryRunner
Add a plugin.
pub async fn run(
&self,
prompt: &str,
user_id: &str,
session_id: Option<&SessionId>,
) -> Result<String, AgentError>
pub async fn run( &self, prompt: &str, user_id: &str, session_id: Option<&SessionId>, ) -> Result<String, AgentError>
Run with session management. Creates or resumes a session.
- Creates a new session or loads an existing one
- Sets
"input"in state fromprompt - Runs the agent
- Persists the result as an event in the session
- Returns the agent’s text output
pub async fn run_ephemeral(&self, prompt: &str) -> Result<String, AgentError>
pub async fn run_ephemeral(&self, prompt: &str) -> Result<String, AgentError>
Run without persistence (one-shot, ephemeral).
pub fn session_service_ref(&self) -> &dyn SessionService
pub fn session_service_ref(&self) -> &dyn SessionService
Access the session service.
Auto Trait Implementations§
impl Freeze for InMemoryRunner
impl !RefUnwindSafe for InMemoryRunner
impl Send for InMemoryRunner
impl Sync for InMemoryRunner
impl Unpin for InMemoryRunner
impl !UnwindSafe for InMemoryRunner
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
Mutably borrows from an owned value. Read more