use conductor::agents::{AgentConfigSerializer, AgentDef, Strategy};
use conductor::error::{ConductorError, Result};
use conductor_macros::tool;
use schemars::JsonSchema;
use serde::Deserialize;
#[derive(Debug, Deserialize, JsonSchema)]
struct GetWeatherArgs {
city: String,
}
#[tool(description = "Get current weather for a city")]
async fn get_weather(args: GetWeatherArgs) -> Result<Value> {
Ok(serde_json::json!({ "city": args.city, "forecast": "sunny" }))
}
fn main() -> Result<()> {
let model = std::env::args().nth(1).ok_or_else(|| {
ConductorError::agent("Pass provider/model as the first argument after --")
})?;
if model.trim().is_empty() {
return Err(ConductorError::agent("Model argument cannot be empty"));
}
let researcher = AgentDef::new("researcher")?
.with_model(model)
.with_instructions("Research weather conditions using the get_weather tool.")
.with_tool(get_weather_tool());
let coordinator = AgentDef::new("coordinator")?
.with_instructions("Delegate weather questions to the researcher agent.")
.with_sub_agent(researcher)?
.with_strategy(Strategy::Sequential)?;
let json = AgentConfigSerializer::serialize(&coordinator);
println!("{}", serde_json::to_string_pretty(&json)?);
Ok(())
}