| Crates.io | agent-cli |
| lib.rs | agent-cli |
| version | 0.1.1 |
| created_at | 2025-06-03 14:40:21.369452+00 |
| updated_at | 2025-06-16 10:38:34.588159+00 |
| description | Agent AI command line |
| homepage | |
| repository | https://github.com/AI-Robotic-Labs/ai-agent-cli |
| max_upload_size | |
| id | 1699133 |
| size | 21,097 |
agent-cli is a Rust library (with an optional CLI) implementing the Agent Life Cycle framework, inspired by the sandy-mount/sandymount Wiki. It provides a modular and reusable implementation for managing intelligent, autonomous software agents through their lifecycle phases: Create, Add Skills, Configure, Run, and Shutdown.
Library Crate: Core logic in src/lib.rs for creating and managing agents through lifecycle phases.
Optional CLI: Binary in src/main.rs (if included) allows running commands like agent create my-agent.
Lifecycle Phases:
"memory", "web-access") to the agent.Testing: Comprehensive unit tests for all lifecycle phases.
rustup)Clone or create the project:
git clone https://github.com/AI-Robotic-Labs/ai-agent-cli.git
cd agent-cli
OR create a new project:
cargo new agent-cli
cd agent-cli
Ensure your Cargo.toml includes:
[package]
name = "agent-cli"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
rand = "0.8"
src/lib.rs (see Project Structure).src/main.rs for CLI functionality.cargo build
The core functionality is in src/lib.rs, which defines the AgentCLI struct and its lifecycle methods. Use it in another Rust project by adding agent-cli as a dependency in your Cargo.toml:
[dependencies]
agent-cli = { path = "/path/to/agent-cli" }
Example usage:
use agent_cli::AgentCLI;
fn main() {
let mut cli = AgentCLI::new();
cli.create("my-agent").unwrap();
cli.add_skill("memory").unwrap();
cli.configure("goal", "assist user").unwrap();
cli.run().unwrap();
cli.shutdown().unwrap();
}
If src/main.rs is included, you can run commands like:
cargo run -- create my-agent
cargo run -- skill add memory
cargo run -- skill add web-access
cargo run -- config goal "assist user"
cargo run -- run
cargo run -- shutdown
Example Output:
Created agent: my-agent (ID: agent-<random_number>)
Added skill 'memory' to agent my-agent
Added skill 'web-access' to agent my-agent
Configured goal = assist user for agent my-agent
Running agent my-agent (ID: agent-<random_number>)
Active skills: ["memory", "web-access"]
Configuration: {"goal": "assist user"}
Agent shutdown and state saved
The shutdown command saves the agent state to a JSON file (e.g., agent-<random_number>.json).
Run unit tests in src/lib.rs:
cargo test
Example Output:
running 5 tests
test tests::test_create_agent ... ok
test tests::test_add_skill ... ok
test tests::test_configure ... ok
test tests::test_run ... ok
test tests::test_shutdown ... ok
test result: ok. 5 passed; 0 failed
agent-cli/
├── Cargo.toml
└── src/
├── lib.rs # Core library with AgentCLI and lifecycle logic
└── main.rs # Optional CLI binary (add for CLI usage)
MIT License. See LICENSE for details.