pub struct Runtime { /* private fields */ }Expand description
The Agency Runtime - main entry point for running agents
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new() -> AgencyResult<Self>
pub fn new() -> AgencyResult<Self>
Create a new runtime with default configuration
Sourcepub fn with_config(config: RuntimeConfig) -> AgencyResult<Self>
pub fn with_config(config: RuntimeConfig) -> AgencyResult<Self>
Create a new runtime with custom configuration
Sourcepub fn in_memory() -> AgencyResult<Self>
pub fn in_memory() -> AgencyResult<Self>
Create an in-memory runtime (for testing)
Sourcepub fn register_agent(&mut self, agent: Agent)
pub fn register_agent(&mut self, agent: Agent)
Register an agent
Sourcepub fn list_agents(&self) -> Vec<&str>
pub fn list_agents(&self) -> Vec<&str>
List registered agents
Sourcepub fn tools(&self) -> &ToolRegistry
pub fn tools(&self) -> &ToolRegistry
Get the tool registry
Sourcepub fn sessions(&self) -> &SessionManager
pub fn sessions(&self) -> &SessionManager
Get the session manager
Sourcepub async fn run(
&self,
agent_name: &str,
message: &str,
options: Option<RunOptions>,
) -> AgencyResult<ExecutionResult>
pub async fn run( &self, agent_name: &str, message: &str, options: Option<RunOptions>, ) -> AgencyResult<ExecutionResult>
Run an agent with a message
Sourcepub async fn run_stream(
&self,
agent_name: &str,
message: &str,
options: Option<RunOptions>,
) -> AgencyResult<(ExecutionResult, Receiver<AgencyEvent>)>
pub async fn run_stream( &self, agent_name: &str, message: &str, options: Option<RunOptions>, ) -> AgencyResult<(ExecutionResult, Receiver<AgencyEvent>)>
Run an agent with streaming events
Sourcepub async fn run_pipeline(
&self,
pipeline: &Pipeline,
input: &str,
options: Option<RunOptions>,
) -> AgencyResult<OrchestratorResult>
pub async fn run_pipeline( &self, pipeline: &Pipeline, input: &str, options: Option<RunOptions>, ) -> AgencyResult<OrchestratorResult>
Run a pipeline
Sourcepub async fn run_swarm(
&self,
swarm: &Swarm,
input: &str,
options: Option<RunOptions>,
) -> AgencyResult<OrchestratorResult>
pub async fn run_swarm( &self, swarm: &Swarm, input: &str, options: Option<RunOptions>, ) -> AgencyResult<OrchestratorResult>
Run a swarm
Sourcepub fn create_session(
&self,
agent_name: &str,
user_id: Option<String>,
) -> AgencyResult<Session>
pub fn create_session( &self, agent_name: &str, user_id: Option<String>, ) -> AgencyResult<Session>
Create a new session for an agent
Sourcepub fn get_session(&self, session_id: &str) -> AgencyResult<Option<Session>>
pub fn get_session(&self, session_id: &str) -> AgencyResult<Option<Session>>
Get a session by ID
Sourcepub fn list_sessions(
&self,
agent_name: &str,
limit: Option<u32>,
) -> AgencyResult<Vec<Session>>
pub fn list_sessions( &self, agent_name: &str, limit: Option<u32>, ) -> AgencyResult<Vec<Session>>
List sessions for an agent
Sourcepub fn delete_session(&self, session_id: &str) -> AgencyResult<bool>
pub fn delete_session(&self, session_id: &str) -> AgencyResult<bool>
Delete a session
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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
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>
Converts
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>
Converts
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