mofa new command scaffolds a new agent project with all necessary files and dependencies.
Usage
Arguments
<NAME>
Required. The name of the project to create.
- Used as the project directory name
- Used as the Rust crate name (converted to snake_case)
- Must be a valid directory name
Options
-t, --template <TEMPLATE>
Project template to use.
- Type: String
- Default:
basic
| Template | Description |
|---|---|
basic | Simple LLM agent with OpenAI integration |
llm | Advanced LLM agent with full API examples |
axum / http | HTTP service with REST API endpoints |
python / py | Python project with UniFFI bindings |
-o, --output <DIRECTORY>
Output directory for the project.
- Type: Path
- Default: Current directory
<DIRECTORY>/<NAME>.
Templates
Basic Template
A minimal LLM agent with essential dependencies.- OpenAI provider integration
- Basic LLMAgentBuilder usage
- Environment variable configuration
LLM Template
Advanced LLM agent with comprehensive examples.- Full LLMAgentBuilder API demonstration
- Single-turn Q&A (
askmethod) - Multi-turn conversation (
chatmethod) - Configurable temperature and token limits
- Detailed inline documentation
Axum / HTTP Template
Production-ready HTTP service with REST API.- Axum web framework integration
- REST API endpoints:
POST /api/chat- Single-turn chatPOST /api/chat/session- Multi-turn session chatGET /api/sessions- List sessionsDELETE /api/sessions/{id}- Delete sessionGET /api/health- Health check
- In-memory session storage
- CORS support
- Structured logging with tracing
- Production-ready error handling
Python Template
Python project with UniFFI bindings.- UniFFI Python bindings support
- Fallback to OpenAI Python SDK
- YAML configuration
- Environment variable substitution
- Simple Q&A and multi-turn chat
Examples
Create basic agent
Create HTTP service in specific directory
Create Python project
Generated Project Structure
Rust Projects (basic, llm, axum)
Python Projects
Environment Variables
All generated projects include.env.example with required variables:
Rust Projects
Axum Projects (additional)
Python Projects
Post-Creation Steps
1. Navigate to project
2. Configure environment
3. Build and run
4. Customize agent behavior
Edit the generated code to customize:- System prompts
- Temperature and token limits
- Model selection
- Tool integrations
- Custom logic
Error Handling
Project already exists
Invalid project name
Template not found
basic template.
Tips
See Also
- Installation - Install MoFA CLI
- Quickstart - Get started quickly
- Agent Management - Manage running agents
- Configuration - Configure MoFA settings