pub struct AgentFactory;Implementations§
Source§impl AgentFactory
impl AgentFactory
Sourcepub fn create(
agent_name: &str,
system_prompt: Option<String>,
model: Option<String>,
root: Option<String>,
auto_approve: bool,
add_dirs: Vec<String>,
) -> Result<Box<dyn Agent + Send + Sync>>
pub fn create( agent_name: &str, system_prompt: Option<String>, model: Option<String>, root: Option<String>, auto_approve: bool, add_dirs: Vec<String>, ) -> Result<Box<dyn Agent + Send + Sync>>
Create and configure an agent based on the provided parameters.
This handles:
- Loading config from ~/.zag/projects/
/zag.toml - Creating the appropriate agent implementation
- Resolving model size aliases (small/medium/large)
- Merging CLI flags with config file settings
- Configuring the agent with all settings
Sourcepub async fn create_with_fallback(
provider: &str,
provider_explicit: bool,
system_prompt: Option<String>,
model: Option<String>,
root: Option<String>,
auto_approve: bool,
add_dirs: Vec<String>,
on_downgrade: &mut (dyn FnMut(&str, &str, &str) + Send),
) -> Result<(Box<dyn Agent + Send + Sync>, String)>
pub async fn create_with_fallback( provider: &str, provider_explicit: bool, system_prompt: Option<String>, model: Option<String>, root: Option<String>, auto_approve: bool, add_dirs: Vec<String>, on_downgrade: &mut (dyn FnMut(&str, &str, &str) + Send), ) -> Result<(Box<dyn Agent + Send + Sync>, String)>
Create an agent, downgrading through the tier list if the requested provider’s binary is missing or its startup probe fails.
If provider_explicit is true, this is equivalent to create() — no
fallback is attempted and the first failure is returned. If it is
false, this walks the fallback_sequence(provider) and logs each
downgrade via on_downgrade(from, to, reason) before trying the next
candidate.
Returns the constructed agent plus the provider name that actually
succeeded, which may differ from provider.
Auto Trait Implementations§
impl Freeze for AgentFactory
impl RefUnwindSafe for AgentFactory
impl Send for AgentFactory
impl Sync for AgentFactory
impl Unpin for AgentFactory
impl UnsafeUnpin for AgentFactory
impl UnwindSafe for AgentFactory
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