basic_chat/basic_chat.rs
1//! # Example: Basic Chat
2//!
3//! This example demonstrates the simplest way to use the Helios Engine: a basic chat
4//! with an agent. The agent maintains a conversation history and can respond to
5//! multiple turns of conversation.
6
7use helios_engine::{Agent, Config};
8
9#[tokio::main]
10async fn main() -> helios_engine::Result<()> {
11 // Load configuration from `config.toml`.
12 let config = Config::from_file("config.toml")?;
13
14 // Create a simple agent named "BasicAgent".
15 let mut agent = Agent::builder("BasicAgent")
16 .config(config)
17 .system_prompt("You are a helpful assistant.")
18 .build()
19 .await?;
20
21 // --- Send a message to the agent ---
22 let response = agent.chat("Hello! How are you?").await?;
23 println!("Agent: {}", response);
24
25 // --- Continue the conversation ---
26 let response = agent.chat("What can you help me with?").await?;
27 println!("Agent: {}", response);
28
29 Ok(())
30}