Docs
Development

Development

Prerequisites

Building


# Clone the repo
git clone https://github.com/janhq/jan-agent.git
cd jan-agent
# Build all crates
cargo build
# Build only the CLI (faster iteration)
cargo build -p jan-cli
# Release build
cargo 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 building
cargo check
# Run tests
cargo test
# Check a specific crate
cargo 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 docs
yarn install
yarn dev

The dev server runs at http://localhost:3000.

Adding a new docs page

  1. Create a new .mdx file in docs/src/pages/docs/
  2. Add an entry in the corresponding _meta.json
  3. Use the same frontmatter format as existing pages