pub struct Runtime { /* private fields */ }Expand description
Runtime is the top-level entry point for routex-rs.
It owns the tool registry, the LLM adapter, and the agent configs. It is responsible for scheduling agents, running them in the correct order, and collecting results.
Library usage:
let runtime = Runtime::from_config(“agents.yaml”)?; let result = runtime.run().await?; println!(“{}”, result.output);
Programmatic usage:
let mut runtime = Runtime::new(config); runtime.register_tool(MyTool::new()); let result = runtime.run().await?;
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Load a config file and create a Runtime. This is the primary entry point for most users.
Sourcepub fn from_config(config: Config) -> Result<Self>
pub fn from_config(config: Config) -> Result<Self>
Create a Runtime from an already-parsed Config.
Sourcepub fn register_tool(&mut self, tool: impl Tool + 'static)
pub fn register_tool(&mut self, tool: impl Tool + 'static)
Register a tool with the runtime. Must be called before run().
Sourcepub async fn run(&self) -> Result<RunResult>
pub async fn run(&self) -> Result<RunResult>
Run the crew and return when all agents complete.
It:
- Builds the dependency graph from config
- Runs agents in topological order — independent agents in parallel
- Passes results from upstream agents to downstream agents
- Returns the final output when all agents complete
Sourcepub fn list_tools(&self) -> Vec<ToolInfo>
pub fn list_tools(&self) -> Vec<ToolInfo>
List all registered tools.
Used by the CLI’s routex tools list command.