use yoagent::agent::Agent;
use yoagent::provider::ModelConfig;
use yoagent::*;
#[tokio::main]
async fn main() {
let mut agent = Agent::from_config(ModelConfig::anthropic("claude-sonnet-5", "Sonnet 5"))
.with_system_prompt("You are a helpful assistant. Be concise.");
println!("Sending prompt...");
let mut rx = agent
.prompt("What is Rust's ownership model in 2 sentences?")
.await;
while let Some(event) = rx.recv().await {
match event {
AgentEvent::MessageUpdate {
delta: StreamDelta::Text { delta },
..
} => {
print!("{}", delta);
}
AgentEvent::AgentEnd { .. } => {
println!("\n\n--- Done ---");
}
_ => {}
}
}
}