Rustsmith is an AI-powered tool that generates Rust projects using a system of specialized agents. It streamlines Rust development by breaking down project creation into modular tasks and automatically handling compilation and error correction.
Rustsmith takes a project idea from the user and divides the development work among AI agents, each focused on a specific task: It uses small language models which are less than 10b parameters. Our multi agent architecture enhances the Rust coding ability of these small agents which were earlier possible by Large language models.
If you are here From the lilypad Hackathon, you can watch the Demo Video here. (https://www.loom.com/share/3ab3271cc054487dbfab066de96a603e?sid=bcc1fd98-8d34-4ae6-913a-9ba2d4675773)
- Analyzes the project idea
- Breaks it down into manageable subtasks for
Struct Agent
,Type Agent
, andUtility Agent
- Currently I am using
llama3.1:8b
through Anura Inferece API.
- Creates appropriate
struct
definitions - Handles all stuffs related to
struct
. - Currently I am using
phi4:14b
through Anura Inference API.
- Defines types,
enums
, andtraits
- Currently I am using
deepseek-r1:7b
through Anura Inference API.
- Implements functions, methods, and utility code
- Currently I am using
qwen2.5-coder:7b
through Anura Inference API.
- Assembles all the Sub-Agents responses to make the project
- Fixes compilation errors sent by the rust compiler.
- Currently I am using
llama3.1:8b
through Anura Inference API.
The system compiles the generated Rust code and automatically attempts to resolve any compilation issues.
git clone https://github.com/ItshMoh/RustSmith.git
cd RustSmith
pip install -r requirements.txt
Visit rust-lang.org/tools/install for platform-specific instructions.
cp .env.example .env
# Edit .env with your API keys and MongoDB connection details
Refer to the MongoDB installation guide if needed.
Setup the MongoDB and make a database name rustsmith
and a collection name user_contexts
.
NOTE
You can name the database and collection you want but you have to change it where the above were placed in the code.
Run the main script:
# Setup the user_id in the main.py file
python main.py
Follow the prompts:
- Enter your project idea (e.g.,
"write a command-line todo app in rust"
)
Rustsmith will:
- Generate the project structure and code
- Compile the Rust project using Cargo
- Fix any compilation errors
- Save the completed project in the
output/
directory
- You input a project idea.
- The Master Agent divides the work into subtasks.
- 3 Specialized agents generate corresponding code.
- The Smith Agent assembles the full project.
- The project is compiled using Cargo.
- Compilation errors (if any) are automatically fixed.
- Context and results are stored in MongoDB.
Rustsmith/
│
├── main.py # Entry point
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
│
├── agents/ # AI agent implementations
│ ├── master_agent.py
│ ├── struct_agent.py
│ ├── type_agent.py
│ ├── utility_agent.py
│ └── smith_agent.py
│
├── database/ # Database operations
│ └── mongodb.py
│
├── utils/ # Utility functions
│ ├── parser.py
│ ├── compiler.py
│ └── file_manager.py
│
└── output/ # Generated projects
After running Rustsmith with a calculator project idea, you'll find a directory like:
output/
├── Cargo.toml # Project configuration
├── src/
│ ├── lib.rs # Library code with structs and types
└── main.rs # Main executable with
- Python 3.8+
- Rust and Cargo
- MongoDB
- Anura API Key get it from Here (https://anura.lilypad.tech/)
We will be extending Rustsmith by:
- Adding new agents for other Rust development aspects
- Supporting different LLM providers
- Enhancing error correction mechanisms
- Publishing it is a library.
This project is licensed under the MIT License.