Development
Prerequisites
- Rust 1.77.2+ — install via rustup (opens in a new tab)
- Git — for cloning and version control
Building
# Clone the repogit clone https://github.com/janhq/jan-agent.gitcd jan-agent# Build all cratescargo build# Build only the CLI (faster iteration)cargo build -p jan-cli# Release buildcargo build --release -p jan-cli
Project structure
jan-agent/├── Cargo.toml # Workspace root├── crates/│ ├── jan-cli/ # CLI binary│ │ └── src/│ │ ├── main.rs # Command routing and handlers│ │ └── agent_tui.rs # Terminal UI for agent mode│ ├── jan-agent-core/ # ReAct agent loop│ │ └── src/│ │ ├── lib.rs│ │ ├── agent.rs # Agent loop implementation│ │ ├── dispatcher.rs # Tool dispatch│ │ ├── tools/ # Built-in tool implementations│ │ └── vision.rs # Screen capture / vision│ ├── jan-agent-sandbox/ # WASM sandbox│ │ └── src/│ ├── jan-llamacpp/ # LlamaCPP plugin│ │ └── src/│ │ ├── lib.rs│ │ ├── args.rs # CLI arg builder (37-field config)│ │ ├── backend.rs # Backend management│ │ ├── commands.rs # Load/unload/status commands│ │ ├── process.rs # llama-server process lifecycle│ │ └── state.rs # Shared state types│ ├── jan-data/ # Data layer│ │ └── src/│ │ ├── config.rs # Data folder resolution│ │ ├── models.rs # Model discovery│ │ ├── threads.rs # Thread/message CRUD│ │ ├── binary.rs # Binary discovery│ │ └── hf.rs # HuggingFace integration│ └── jan-utils/ # Shared utilities│ └── src/└── docs/ # This documentation site
Running checks
# Type-check without buildingcargo check# Run testscargo test# Check a specific cratecargo check -p jan-agent-core
Working with Jan Desktop
Jan Agent is designed to eventually be loadable as a dynamic library extension (.dylib/.so/.dll) in Jan Desktop. During development, both repositories share the same data folder, so models and backends installed via either interface are available to both.
If you're also working on the Jan Desktop repo, make sure you're not running conflicting model servers on the same port (default 6767).
Docs site
The documentation site uses Nextra (opens in a new tab) (Next.js + MDX), matching the same technology and styling as the Jan Desktop docs for easy cross-referencing.
cd docsyarn installyarn dev
The dev server runs at http://localhost:3000.
Adding a new docs page
- Create a new
.mdxfile indocs/src/pages/docs/ - Add an entry in the corresponding
_meta.json - Use the same frontmatter format as existing pages