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§
Source§impl InMemoryRunner
impl InMemoryRunner
Sourcepub fn new(agent: Arc<dyn TextAgent>, app_name: impl Into<String>) -> Self
pub fn new(agent: Arc<dyn TextAgent>, app_name: impl Into<String>) -> Self
Create a new runner with in-memory defaults for all services.
Sourcepub fn session_service(self, svc: Arc<dyn SessionService>) -> Self
pub fn session_service(self, svc: Arc<dyn SessionService>) -> Self
Override the session service.
Sourcepub fn memory_service(self, svc: Arc<dyn MemoryService>) -> Self
pub fn memory_service(self, svc: Arc<dyn MemoryService>) -> Self
Override the memory service.
Sourcepub fn artifact_service(self, svc: Arc<dyn ArtifactService>) -> Self
pub fn artifact_service(self, svc: Arc<dyn ArtifactService>) -> Self
Override the artifact service.
Sourcepub 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
Sourcepub 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).
Sourcepub 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 UnsafeUnpin 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