Example: Rust CLI Tool¶
Build a Rust command-line tool using Perspt’s agent mode.
Task Description¶
We will ask the agent to create a CLI tool that converts CSV files to JSON.
Running the Agent¶
export GEMINI_API_KEY="your-key"
perspt agent --yes -w /tmp/csv2json \
--architect-model gemini-pro-latest \
--actuator-model gemini-3.1-flash-lite-preview \
"Create a Rust CLI tool called csv2json that:
1. Reads a CSV file from a path argument
2. Converts each row to a JSON object
3. Outputs JSON array to stdout or a file (--output flag)
4. Handles errors gracefully with anyhow
5. Uses clap for argument parsing
6. Includes unit tests and integration tests"
Expected Output¶
/tmp/csv2json/
+-- Cargo.toml
+-- src/
| +-- main.rs # Entry point, clap args
| +-- lib.rs # Core conversion logic
| +-- converter.rs # CSV -> JSON conversion
+-- tests/
+-- integration.rs # Integration tests
Verification¶
The agent uses the rust plugin:
LSP:
rust-analyzerfor V_synTests:
cargo testfor V_logInit:
cargo initfor V_boot
cd /tmp/csv2json
cargo test
cargo run -- --help
Key Observations¶
The
rustplugin selectsrust-analyzeras the LSP servercargo initbootstraps the project structure (V_boot)cargo testruns both unit and integration tests (V_log)Ownership closure assigns each source file to exactly one node
See Also¶
Agent Mode Tutorial — Agent mode tutorial
Example: Python ETL Pipeline — Python project example