use corrosive_agents::prelude::*;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<()> {
let _ = dotenvy::dotenv();
let agent = Agent::builder()
.name("research-agent")
.version("0.1.0")
.description("A concise research assistant")
.system_prompt("You are a concise research assistant. Answer in at most three sentences.")
.model(models::NEMOTRON_3_NANO_30B)
.capability(Capability::new("chat", "Conversational Q&A"))
.capability(
Capability::new("summarize", "Summarizes text")
.with_config(json!({ "max_words": 100 })),
)
.skill(FnSkill::new(
"shout",
"Uppercases the input text",
|input| async move {
let text = input["text"].as_str().unwrap_or_default();
Ok(json!({ "text": text.to_uppercase() }))
},
))
.llm(NvidiaClient::from_env()?)
.generate_identity() .build()?;
println!("agent : {} v{}", agent.name(), agent.version());
println!("public key : {}", agent.public_key().unwrap_or_default());
println!("verified : {:?}", agent.verify().is_ok());
let shouted = agent
.execute_skill("shout", json!({ "text": "hello nemotron" }))
.await?;
println!("skill out : {shouted}");
let reply = agent
.chat("demo", "In one sentence, what is NVIDIA Nemotron?")
.await?;
println!("\nassistant : {reply}");
let follow_up = agent.chat("demo", "Name one model in that family.").await?;
println!("assistant : {follow_up}");
Ok(())
}