Your first agent.
Five short steps: install the facade crate, define an agent, give it beliefs and a goal, let it talk to other agents, and run it under the runtime.
Install
shell
cargo add rustyaiCreate an agent
main.rs
use rustyai::prelude::*;#[tokio::main]async fn main() { // Create and run your first agent let agent = AgentBuilder::new("researcher").build();}Give it beliefs
Beliefs are what the agent currently holds to be true, each with a certainty score that can be revised as new evidence arrives.
beliefs.rs
let agent = AgentBuilder::new("researcher") .with_belief("rust_is_fast") .with_belief_certainty("index_is_stale", 0.6) .build();Define goals
goals.rs
let agent = AgentBuilder::new("researcher") .with_belief("rust_is_fast") .with_goal("find_solution") .build();Send messages
messaging.rs
let msg = AclMessage::new(Performative::Request) .to("agent://indexer") .content("reindex shard 7");ctx.send(msg).await?;Run it inside the runtime
main.rs
#[tokio::main]async fn main() -> Result<()> { Runtime::builder() .supervisor(RestartPolicy::exponential_backoff()) .spawn(agent) .run() .await}