Add MkDocs Material documentation site with 40 pages and auto-generated API reference

Sets up a complete documentation website with 7 navigable sections (Home, Getting
Started, User Guide, Architecture, API Reference, Deployment, Development), light/dark
mode, search, code copy, and Mermaid diagram support. API reference pages use
mkdocstrings to auto-generate docs from source docstrings. GitHub Actions workflow
deploys to GitHub Pages on push to main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jon Saad-Falcon
2026-02-21 06:09:36 +00:00
co-authored by Claude Opus 4.6
parent 990d7d8a79
commit f75afefcfb
45 changed files with 10822 additions and 0 deletions
+561
View File
@@ -0,0 +1,561 @@
---
title: Configuration
description: Complete reference for OpenJarvis configuration
---
# Configuration
OpenJarvis uses a TOML configuration file to control engine selection, model routing, memory backends, agent behavior, and more. This page is the complete reference for every configuration option.
## Config File Location
The configuration file lives at:
```
~/.openjarvis/config.toml
```
OpenJarvis creates the `~/.openjarvis/` directory and populates it with a default config when you run `jarvis init`.
## Generating Configuration
### First-Time Setup
```bash
jarvis init
```
This command:
1. Runs hardware auto-detection (GPU vendor/model/VRAM, CPU brand/cores, RAM)
2. Selects the recommended engine based on your hardware
3. Writes `~/.openjarvis/config.toml` with sensible defaults
### Regenerating Configuration
To overwrite an existing config:
```bash
jarvis init --force
```
!!! warning
`--force` overwrites your existing config file. Back up your config first if you have custom settings.
## Configuration Sections
The config file is organized into seven TOML sections. Every field has a default value, so you only need to specify the values you want to change.
---
### `[engine]` -- Inference Engine
Controls which inference engine is used and where each engine is listening.
```toml
[engine]
default = "ollama"
ollama_host = "http://localhost:11434"
vllm_host = "http://localhost:8000"
llamacpp_host = "http://localhost:8080"
llamacpp_path = ""
sglang_host = "http://localhost:30000"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `default` | string | Auto-detected | Default engine backend. One of: `ollama`, `vllm`, `llamacpp`, `sglang`, `cloud`. Set automatically by `jarvis init` based on hardware detection. |
| `ollama_host` | string | `http://localhost:11434` | Base URL for the Ollama API server. |
| `vllm_host` | string | `http://localhost:8000` | Base URL for the vLLM OpenAI-compatible server. |
| `llamacpp_host` | string | `http://localhost:8080` | Base URL for the llama.cpp HTTP server (`llama-server`). |
| `llamacpp_path` | string | `""` | Path to the llama.cpp binary, if not on `$PATH`. |
| `sglang_host` | string | `http://localhost:30000` | Base URL for the SGLang server. |
!!! tip "Engine fallback"
If the configured default engine is unreachable, OpenJarvis automatically probes all registered engines and falls back to any healthy one.
---
### `[intelligence]` -- Model Routing
Controls which model is selected by default and which model to fall back to.
```toml
[intelligence]
default_model = ""
fallback_model = ""
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `default_model` | string | `""` (empty) | Preferred model identifier (e.g., `qwen3:8b`). When empty, the router policy selects the model dynamically. |
| `fallback_model` | string | `""` (empty) | Model to use if the default is unavailable. |
When both fields are empty, OpenJarvis uses the configured router policy (see `[learning]`) to select a model from those available on the active engine.
---
### `[learning]` -- Router Policy
Controls how the learning system selects models for incoming queries.
```toml
[learning]
default_policy = "heuristic"
reward_weights = ""
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `default_policy` | string | `"heuristic"` | Router policy to use for model selection. Available: `heuristic`, `learned` (trace-driven), `grpo` (reinforcement learning stub). |
| `reward_weights` | string | `""` | Comma-separated key=value pairs for the reward function. Example: `"latency=0.4,cost=0.3,quality=0.3"`. |
**Router policies:**
| Policy | Description |
|--------|-------------|
| `heuristic` | Rule-based selection using 6 priority rules. Considers model availability, parameter count, context length, and query characteristics. Default. |
| `learned` | Trace-driven policy that learns from past interaction outcomes stored in the trace system. |
| `grpo` | Group Relative Policy Optimization stub for future RL-based routing. |
You can also override the router policy per-query via the CLI:
```bash
jarvis ask --router heuristic "Hello"
```
---
### `[memory]` -- Memory Backend
Controls the persistent memory system: which backend to use, how documents are chunked, and how context injection works.
```toml
[memory]
default_backend = "sqlite"
db_path = "~/.openjarvis/memory.db"
context_injection = true
context_top_k = 5
context_min_score = 0.1
context_max_tokens = 2048
chunk_size = 512
chunk_overlap = 64
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `default_backend` | string | `"sqlite"` | Memory backend to use. Available: `sqlite` (FTS5), `faiss`, `colbert`, `bm25`, `hybrid`. |
| `db_path` | string | `~/.openjarvis/memory.db` | Path to the SQLite memory database. Used by the `sqlite` backend. |
| `context_injection` | bool | `true` | Whether to automatically inject relevant memory context into queries. |
| `context_top_k` | int | `5` | Number of top memory results to inject as context. |
| `context_min_score` | float | `0.1` | Minimum relevance score for a memory result to be included in context. |
| `context_max_tokens` | int | `2048` | Maximum number of tokens to use for injected context. |
| `chunk_size` | int | `512` | Size of document chunks (in tokens) when indexing documents. |
| `chunk_overlap` | int | `64` | Overlap between adjacent chunks (in tokens) when indexing. |
**Memory backends:**
| Backend | Extra Required | Description |
|---------|---------------|-------------|
| `sqlite` | None | SQLite with FTS5 full-text search. Zero dependencies. Default. |
| `faiss` | `memory-faiss` | Facebook AI Similarity Search with sentence-transformer embeddings. |
| `colbert` | `memory-colbert` | ColBERTv2 late-interaction retrieval. Requires PyTorch. |
| `bm25` | `memory-bm25` | BM25 sparse retrieval via `rank-bm25`. |
| `hybrid` | Depends on sub-backends | Reciprocal Rank Fusion combining multiple backends. |
!!! note "Context injection"
When `context_injection` is enabled and documents have been indexed, every query automatically searches memory for relevant chunks and prepends them as system context. This gives the model access to your indexed knowledge base without any extra steps. Disable with `--no-context` on the CLI or `context=False` in the SDK.
---
### `[agent]` -- Agent Defaults
Controls the default agent behavior for queries.
```toml
[agent]
default_agent = "simple"
max_turns = 10
default_tools = ""
temperature = 0.7
max_tokens = 1024
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `default_agent` | string | `"simple"` | Default agent to use. Available: `simple`, `orchestrator`, `custom`, `openclaw`. |
| `max_turns` | int | `10` | Maximum number of tool-calling turns for the orchestrator agent before it must produce a final answer. |
| `default_tools` | string | `""` | Comma-separated list of tools to enable by default (e.g., `"calculator,think"`). |
| `temperature` | float | `0.7` | Default sampling temperature for generation. |
| `max_tokens` | int | `1024` | Default maximum tokens for generation. |
---
### `[server]` -- API Server
Controls the OpenAI-compatible API server started by `jarvis serve`.
```toml
[server]
host = "0.0.0.0"
port = 8000
agent = "orchestrator"
model = ""
workers = 1
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `host` | string | `"0.0.0.0"` | Bind address for the server. Use `"127.0.0.1"` to restrict to localhost. |
| `port` | int | `8000` | Port number for the server. |
| `agent` | string | `"orchestrator"` | Agent to use for non-streaming chat completion requests. |
| `model` | string | `""` | Default model for the server. When empty, uses `intelligence.default_model` or the first available model. |
| `workers` | int | `1` | Number of uvicorn worker processes. |
CLI options override config values:
```bash
jarvis serve --host 127.0.0.1 --port 9000 --model qwen3:8b --agent simple
```
---
### `[telemetry]` -- Telemetry Persistence
Controls whether inference telemetry is recorded and where it is stored.
```toml
[telemetry]
enabled = true
db_path = "~/.openjarvis/telemetry.db"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `enabled` | bool | `true` | Whether to record telemetry for each inference call. Records timing, token counts, model, engine, and cost. |
| `db_path` | string | `~/.openjarvis/telemetry.db` | Path to the SQLite telemetry database. |
!!! info "Telemetry is local-only"
All telemetry data is stored locally in a SQLite database. No data is ever sent to external services.
---
## Hardware Auto-Detection
When you run `jarvis init`, OpenJarvis probes your system to detect available hardware. The detection runs in this order:
### GPU Detection
1. **NVIDIA GPU** -- Checks for `nvidia-smi` on `$PATH`. If found, queries GPU name, VRAM (in MB), and GPU count via:
```
nvidia-smi --query-gpu=name,memory.total,count --format=csv,noheader,nounits
```
2. **AMD GPU** -- Checks for `rocm-smi` on `$PATH`. If found, queries the product name via:
```
rocm-smi --showproductname
```
3. **Apple Silicon** -- On macOS only. Runs `system_profiler SPDisplaysDataType` and looks for "Apple" in the chipset model line.
If none of these detect a GPU, the system is treated as CPU-only.
### CPU and RAM Detection
- **CPU brand**: Reads from `sysctl -n machdep.cpu.brand_string` on macOS, or parses `model name` from `/proc/cpuinfo` on Linux.
- **CPU count**: Uses Python's `os.cpu_count()`.
- **RAM**: Reads from `sysctl -n hw.memsize` on macOS, or parses `MemTotal` from `/proc/meminfo` on Linux.
### Detected Hardware Dataclass
The detection result is stored as a `HardwareInfo` dataclass:
```python
@dataclass
class HardwareInfo:
platform: str # "linux", "darwin", "windows"
cpu_brand: str # e.g., "AMD EPYC 7763"
cpu_count: int # e.g., 128
ram_gb: float # e.g., 512.0
gpu: GpuInfo | None
@dataclass
class GpuInfo:
vendor: str # "nvidia", "amd", "apple"
name: str # e.g., "NVIDIA A100-SXM4-80GB"
vram_gb: float # e.g., 80.0
compute_capability: str # (NVIDIA only)
count: int # e.g., 8
```
---
## Engine Recommendation Logic
Based on the detected hardware, `recommend_engine()` selects the optimal default engine:
```mermaid
graph TD
A[detect_hardware] --> B{GPU detected?}
B -->|No| C[llamacpp]
B -->|Yes| D{GPU vendor?}
D -->|Apple| E[ollama]
D -->|NVIDIA| F{Datacenter GPU?}
D -->|AMD| G[vllm]
F -->|Yes: A100, H100, H200, L40, A10, A30| H[vllm]
F -->|No: consumer GPU| I[ollama]
```
| Hardware | Recommended Engine | Reason |
|----------|--------------------|--------|
| No GPU | `llamacpp` | Efficient CPU inference with GGUF quantized models |
| Apple Silicon | `ollama` | Native Metal acceleration, easy model management |
| NVIDIA consumer GPU (RTX 3090, 4090, etc.) | `ollama` | Simple setup, good performance for single-user |
| NVIDIA datacenter GPU (A100, H100, H200, L40, A10, A30) | `vllm` | High-throughput batched serving, continuous batching |
| AMD GPU | `vllm` | ROCm support via vLLM |
---
## Example Configurations
### Apple Silicon Mac
```toml
# ~/.openjarvis/config.toml
# Apple Silicon MacBook Pro (M3 Max, 128 GB unified memory)
[engine]
default = "ollama"
ollama_host = "http://localhost:11434"
[intelligence]
default_model = "qwen3:8b"
fallback_model = "llama3.2:3b"
[memory]
default_backend = "sqlite"
context_injection = true
context_top_k = 5
[agent]
default_agent = "simple"
max_turns = 10
[server]
host = "127.0.0.1"
port = 8000
agent = "orchestrator"
[learning]
default_policy = "heuristic"
[telemetry]
enabled = true
```
### NVIDIA Datacenter (Multi-GPU)
```toml
# ~/.openjarvis/config.toml
# 8x NVIDIA A100 80GB server
[engine]
default = "vllm"
vllm_host = "http://localhost:8000"
ollama_host = "http://localhost:11434"
[intelligence]
default_model = "Qwen/Qwen2.5-72B-Instruct"
fallback_model = "Qwen/Qwen2.5-7B-Instruct"
[memory]
default_backend = "faiss"
context_injection = true
context_top_k = 10
context_min_score = 0.05
context_max_tokens = 4096
chunk_size = 1024
chunk_overlap = 128
[agent]
default_agent = "orchestrator"
max_turns = 15
default_tools = "calculator,think,retrieval"
temperature = 0.5
max_tokens = 4096
[server]
host = "0.0.0.0"
port = 8000
agent = "orchestrator"
model = "Qwen/Qwen2.5-72B-Instruct"
workers = 1
[learning]
default_policy = "heuristic"
[telemetry]
enabled = true
```
### CPU-Only (No GPU)
```toml
# ~/.openjarvis/config.toml
# CPU-only machine
[engine]
default = "llamacpp"
llamacpp_host = "http://localhost:8080"
[intelligence]
default_model = ""
fallback_model = ""
[memory]
default_backend = "sqlite"
context_injection = true
context_top_k = 3
context_max_tokens = 1024
chunk_size = 256
chunk_overlap = 32
[agent]
default_agent = "simple"
max_turns = 5
temperature = 0.7
max_tokens = 512
[server]
host = "127.0.0.1"
port = 8000
[learning]
default_policy = "heuristic"
[telemetry]
enabled = true
```
### Cloud-Only (No Local Engine)
```toml
# ~/.openjarvis/config.toml
# Using cloud APIs only (OpenAI, Anthropic)
# Set OPENAI_API_KEY and/or ANTHROPIC_API_KEY environment variables
[engine]
default = "cloud"
[intelligence]
default_model = "gpt-4o"
fallback_model = "claude-sonnet-4-20250514"
[memory]
default_backend = "sqlite"
context_injection = true
[agent]
default_agent = "orchestrator"
default_tools = "calculator,think"
[telemetry]
enabled = true
```
### Hybrid (Local + Cloud Fallback)
```toml
# ~/.openjarvis/config.toml
# Local Ollama as primary, cloud as fallback
[engine]
default = "ollama"
ollama_host = "http://localhost:11434"
[intelligence]
default_model = "qwen3:8b"
fallback_model = "gpt-4o-mini"
[memory]
default_backend = "sqlite"
context_injection = true
[agent]
default_agent = "orchestrator"
max_turns = 10
default_tools = "calculator,think"
[learning]
default_policy = "heuristic"
[telemetry]
enabled = true
```
---
## Programmatic Configuration
You can also configure OpenJarvis entirely from Python without a TOML file:
```python
from openjarvis import Jarvis
from openjarvis.core.config import (
AgentConfig,
EngineConfig,
IntelligenceConfig,
JarvisConfig,
MemoryConfig,
)
config = JarvisConfig(
engine=EngineConfig(
default="ollama",
ollama_host="http://my-server:11434",
),
intelligence=IntelligenceConfig(
default_model="qwen3:8b",
),
memory=MemoryConfig(
default_backend="sqlite",
context_injection=True,
context_top_k=10,
),
agent=AgentConfig(
default_agent="orchestrator",
max_turns=15,
),
)
j = Jarvis(config=config)
response = j.ask("Hello")
j.close()
```
Or load from a custom path:
```python
j = Jarvis(config_path="/path/to/my-config.toml")
```
---
## Environment Variables
OpenJarvis respects the following environment variables:
| Variable | Description |
|----------|-------------|
| `OPENAI_API_KEY` | API key for OpenAI cloud inference. Required for the `cloud` engine with OpenAI models. |
| `ANTHROPIC_API_KEY` | API key for Anthropic cloud inference. Required for the `cloud` engine with Claude models. |
| `GOOGLE_API_KEY` | API key for Google Gemini inference. Required for the `google` engine. |
| `TAVILY_API_KEY` | API key for the Tavily web search tool. Required for the `web_search` tool. |
## Next Steps
- [Quick Start](quickstart.md) -- Run your first query
- [CLI Reference](../user-guide/cli.md) -- Full reference for all CLI commands
- [Architecture Overview](../architecture/overview.md) -- Understand how the pieces fit together
+251
View File
@@ -0,0 +1,251 @@
---
title: Installation
description: Install OpenJarvis and set up an inference backend
---
# Installation
This guide covers installing OpenJarvis, its optional extras, and setting up an inference backend.
## Requirements
| Requirement | Version | Notes |
|-------------|---------|-------|
| Python | 3.10+ | Required |
| Inference backend | Any | At least one of Ollama, vLLM, llama.cpp, SGLang, or a cloud API |
| Node.js | 22+ | Only required for OpenClaw agent infrastructure |
## Installing OpenJarvis
=== "uv (recommended)"
```bash
uv pip install openjarvis
```
=== "pip"
```bash
pip install openjarvis
```
=== "From source"
```bash
git clone https://github.com/jonsaadfalcon/OpenJarvis.git
cd OpenJarvis
uv sync
```
For development with all dev tools:
```bash
uv sync --extra dev
```
## Optional Extras
OpenJarvis uses optional extras to keep the base installation lightweight. Install only what you need.
### Inference Backends
| Extra | Install Command | Dependencies | Description |
|-------|----------------|--------------|-------------|
| `inference-ollama` | `pip install 'openjarvis[inference-ollama]'` | None (HTTP-based) | Ollama backend. Communicates via HTTP API. |
| `inference-vllm` | `pip install 'openjarvis[inference-vllm]'` | None (HTTP-based) | vLLM backend. Communicates via OpenAI-compatible API. |
| `inference-llamacpp` | `pip install 'openjarvis[inference-llamacpp]'` | None (HTTP-based) | llama.cpp server backend. |
| `inference-cloud` | `pip install 'openjarvis[inference-cloud]'` | `openai>=1.30`, `anthropic>=0.30` | Cloud inference via OpenAI and Anthropic APIs. |
| `inference-google` | `pip install 'openjarvis[inference-google]'` | `google-genai>=1.0` | Google Gemini API backend. |
!!! note "Ollama, vLLM, and llama.cpp are HTTP-based"
The `inference-ollama`, `inference-vllm`, and `inference-llamacpp` extras have no additional Python dependencies. OpenJarvis communicates with these engines over HTTP using the `httpx` library that is already a core dependency. You still need the actual engine software running on your machine or network.
### Memory Backends
| Extra | Install Command | Dependencies | Description |
|-------|----------------|--------------|-------------|
| `memory-faiss` | `pip install 'openjarvis[memory-faiss]'` | `faiss-cpu>=1.7`, `sentence-transformers>=2.2`, `numpy>=1.24` | FAISS vector store with sentence-transformer embeddings. |
| `memory-colbert` | `pip install 'openjarvis[memory-colbert]'` | `colbert-ai>=0.2`, `torch>=2.0` | ColBERTv2 late-interaction retrieval. |
| `memory-bm25` | `pip install 'openjarvis[memory-bm25]'` | `rank-bm25>=0.2.2` | BM25 sparse retrieval backend. |
| `memory-pdf` | `pip install 'openjarvis[memory-pdf]'` | `pdfplumber>=0.10` | PDF document ingestion support. |
!!! tip "SQLite memory is always available"
The default SQLite/FTS5 memory backend requires no additional dependencies. It is always available and suitable for most use cases.
### Tools
| Extra | Install Command | Dependencies | Description |
|-------|----------------|--------------|-------------|
| `tools-search` | `pip install 'openjarvis[tools-search]'` | `tavily-python>=0.3` | Web search tool via the Tavily API. |
### Server
| Extra | Install Command | Dependencies | Description |
|-------|----------------|--------------|-------------|
| `server` | `pip install 'openjarvis[server]'` | `fastapi>=0.110`, `uvicorn>=0.30`, `pydantic>=2.0` | OpenAI-compatible API server (`jarvis serve`). |
### Other Extras
| Extra | Install Command | Dependencies | Description |
|-------|----------------|--------------|-------------|
| `agents` | `pip install 'openjarvis[agents]'` | None | Agent infrastructure (included in base). |
| `learning` | `pip install 'openjarvis[learning]'` | None | Learning/router policy system (included in base). |
| `openclaw` | `pip install 'openjarvis[openclaw]'` | None | OpenClaw agent transport layer. Requires Node.js 22+ at runtime. |
| `docs` | `pip install 'openjarvis[docs]'` | `mkdocs>=1.6`, `mkdocs-material>=9.5`, `mkdocstrings[python]>=0.25` | Documentation build tools. |
| `dev` | `pip install 'openjarvis[dev]'` | `pytest>=8`, `pytest-asyncio>=0.24`, `pytest-cov>=5`, `respx>=0.22`, `ruff>=0.4` | Development and testing tools. |
### Installing Multiple Extras
Combine extras with commas:
```bash
pip install 'openjarvis[server,memory-faiss,inference-cloud]'
```
Or with `uv`:
```bash
uv pip install 'openjarvis[server,memory-faiss,inference-cloud]'
```
## Verifying Installation
After installation, verify that the CLI is available:
```bash
jarvis --version
```
Expected output:
```
jarvis, version 1.0.0
```
View all available commands:
```bash
jarvis --help
```
Expected output:
```
Usage: jarvis [OPTIONS] COMMAND [ARGS]...
OpenJarvis -- modular AI assistant backend
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
ask Ask Jarvis a question.
bench Run inference benchmarks.
init Detect hardware and generate ~/.openjarvis/config.toml.
memory Manage the memory store.
model Manage language models.
serve Start the OpenAI-compatible API server.
telemetry Query and manage inference telemetry data.
```
## Setting Up an Inference Backend
OpenJarvis requires at least one inference backend to generate responses. Choose the backend that best matches your hardware.
### Ollama (Recommended for most users)
Ollama is the easiest way to get started. It handles model downloading and serving automatically.
1. Install Ollama from [ollama.com](https://ollama.com)
2. Start the server:
```bash
ollama serve
```
3. Pull a model:
```bash
ollama pull qwen3:8b
```
Or pull directly via the Jarvis CLI:
```bash
jarvis model pull qwen3:8b
```
4. Verify the engine is detected:
```bash
jarvis model list
```
!!! tip "Best for: Apple Silicon Macs, consumer NVIDIA GPUs, CPU-only systems"
### vLLM (High-throughput serving)
vLLM provides high-throughput serving optimized for datacenter GPUs.
1. Install vLLM following the [official guide](https://docs.vllm.ai)
2. Start the server:
```bash
vllm serve Qwen/Qwen2.5-7B-Instruct
```
3. OpenJarvis will auto-detect it at `http://localhost:8000`
!!! tip "Best for: NVIDIA datacenter GPUs (A100, H100, L40), AMD GPUs"
### llama.cpp (Lightweight, CPU-friendly)
llama.cpp provides efficient CPU and GPU inference with GGUF quantized models.
1. Build llama.cpp from [github.com/ggerganov/llama.cpp](https://github.com/ggerganov/llama.cpp)
2. Start the server:
```bash
llama-server -m /path/to/model.gguf --port 8080
```
3. OpenJarvis will auto-detect it at `http://localhost:8080`
!!! tip "Best for: CPU-only machines, constrained environments, GGUF models"
### SGLang
SGLang provides structured generation and high-performance serving.
1. Install SGLang following the [official guide](https://github.com/sgl-project/sglang)
2. Start the server:
```bash
python -m sglang.launch_server --model Qwen/Qwen2.5-7B-Instruct --port 30000
```
3. OpenJarvis will auto-detect it at `http://localhost:30000`
### Cloud APIs (OpenAI, Anthropic, Google)
For cloud-based inference, install the cloud extras and set your API keys:
```bash
pip install 'openjarvis[inference-cloud,inference-google]'
```
Set environment variables:
```bash
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GOOGLE_API_KEY="..."
```
OpenJarvis will automatically detect available cloud providers.
## Next Steps
- [Quick Start](quickstart.md) — Run your first query
- [Configuration](configuration.md) — Customize engine hosts, model routing, memory, and more
+444
View File
@@ -0,0 +1,444 @@
---
title: Quick Start
description: Get up and running with OpenJarvis in minutes
---
# Quick Start
This guide walks through the core workflows of OpenJarvis: asking questions, using agents with tools, managing memory, running benchmarks, and starting the API server.
!!! info "Prerequisites"
Make sure you have [installed OpenJarvis](installation.md) and have at least one inference backend running (e.g., `ollama serve`).
## Initialize Configuration
Start by detecting your hardware and generating a configuration file:
```bash
jarvis init
```
This runs hardware auto-detection (GPU vendor, VRAM, CPU, RAM) and writes a config file to `~/.openjarvis/config.toml` with sensible defaults for your system. It also selects the recommended inference engine.
```
Detecting hardware...
Platform : linux
CPU : AMD EPYC 7763 (128 cores)
RAM : 512.0 GB
GPU : NVIDIA A100 (80.0 GB VRAM, x8)
Config written successfully.
```
To overwrite an existing config:
```bash
jarvis init --force
```
See [Configuration](configuration.md) for the full config reference.
## Your First Question
### Via CLI
The simplest way to interact with OpenJarvis is the `ask` command:
```bash
jarvis ask "What is the capital of France?"
```
OpenJarvis will auto-detect a running engine, select a model using the configured router policy, and return the response.
#### CLI Options
| Option | Description | Example |
|--------|-------------|---------|
| `-m`, `--model` | Override model selection | `jarvis ask -m qwen3:8b "Hello"` |
| `-e`, `--engine` | Force a specific engine | `jarvis ask -e ollama "Hello"` |
| `-t`, `--temperature` | Sampling temperature (default: 0.7) | `jarvis ask -t 0.2 "Hello"` |
| `--max-tokens` | Max tokens to generate (default: 1024) | `jarvis ask --max-tokens 2048 "Hello"` |
| `--json` | Output raw JSON result | `jarvis ask --json "Hello"` |
| `--no-stream` | Disable streaming | `jarvis ask --no-stream "Hello"` |
| `--no-context` | Disable memory context injection | `jarvis ask --no-context "Hello"` |
| `-a`, `--agent` | Use an agent | `jarvis ask -a orchestrator "Hello"` |
| `--tools` | Comma-separated tools | `jarvis ask --tools calculator,think "2+2"` |
| `--router` | Router policy for model selection | `jarvis ask --router heuristic "Hello"` |
### Via Python SDK
The `Jarvis` class provides a high-level Python interface:
```python
from openjarvis import Jarvis
j = Jarvis()
response = j.ask("What is the capital of France?")
print(response)
j.close()
```
For detailed results including token usage and model info:
```python
result = j.ask_full("What is the capital of France?")
print(result["content"]) # The response text
print(result["model"]) # Model that handled the query
print(result["engine"]) # Engine that ran inference
print(result["usage"]) # Token usage statistics
```
#### SDK Constructor Options
```python
# Use default config (auto-detected hardware, ~/.openjarvis/config.toml)
j = Jarvis()
# Override the model
j = Jarvis(model="qwen3:8b")
# Override the engine
j = Jarvis(engine_key="ollama")
# Use a custom config file
j = Jarvis(config_path="/path/to/config.toml")
```
!!! warning "Always call `close()`"
The `Jarvis` instance holds references to telemetry stores and memory backends. Call `j.close()` when you are done to release resources.
## Using Agents with Tools
Agents add multi-turn reasoning and tool-calling capabilities. The `orchestrator` agent runs a tool-calling loop, invoking tools as needed to answer the query.
### Available Agents
| Agent | Description |
|-------|-------------|
| `simple` | Single-turn, no tools. Sends the query directly to the model. |
| `orchestrator` | Multi-turn tool-calling loop. Invokes tools iteratively until it has an answer. |
| `custom` | Template for user-defined agent logic. |
| `openclaw` | HTTP/subprocess transport to external OpenClaw agent processes. |
### Available Built-in Tools
| Tool | Description |
|------|-------------|
| `calculator` | Safe mathematical expression evaluation (ast-based). |
| `think` | Reasoning scratchpad for chain-of-thought. |
| `retrieval` | Search the memory store for relevant context. |
| `llm` | Make sub-queries to another model. |
| `file_read` | Read files with path validation. |
| `web_search` | Web search via the Tavily API (requires `tools-search` extra). |
### CLI Example
```bash
jarvis ask --agent orchestrator --tools calculator,think "What is 137 * 42?"
```
### SDK Example
```python
from openjarvis import Jarvis
j = Jarvis()
result = j.ask_full(
"What is the square root of 144?",
agent="orchestrator",
tools=["calculator", "think"],
)
print(result["content"])
print(result["tool_results"]) # List of tool invocations and results
print(result["turns"]) # Number of agent turns
j.close()
```
## Memory: Indexing and Search
The memory system lets you index documents and inject relevant context into queries automatically.
### Index Documents
Index a file or directory. OpenJarvis chunks the content and stores it in the configured memory backend (SQLite/FTS5 by default).
=== "CLI"
```bash
# Index a directory
jarvis memory index ./docs/
# Index a single file with custom chunk size
jarvis memory index ./paper.txt --chunk-size 256 --chunk-overlap 32
```
=== "Python SDK"
```python
from openjarvis import Jarvis
j = Jarvis()
result = j.memory.index("./docs/", chunk_size=512, chunk_overlap=64)
print(f"Indexed {result['chunks']} chunks")
j.close()
```
### Search Memory
Query the memory store to find relevant chunks:
=== "CLI"
```bash
jarvis memory search "configuration options"
jarvis memory search -k 10 "how to deploy"
```
=== "Python SDK"
```python
results = j.memory.search("configuration options", top_k=5)
for r in results:
print(f"[{r['score']:.4f}] {r['source']}: {r['content'][:100]}")
```
### Check Memory Statistics
=== "CLI"
```bash
jarvis memory stats
```
=== "Python SDK"
```python
stats = j.memory.stats()
print(f"Backend: {stats['backend']}, Documents: {stats.get('count', 'N/A')}")
```
### Automatic Context Injection
When you have indexed documents, OpenJarvis automatically injects relevant context into your queries. The memory system searches for chunks matching your query and prepends them as system context before sending to the model.
To disable this behavior:
=== "CLI"
```bash
jarvis ask --no-context "Hello"
```
=== "Python SDK"
```python
response = j.ask("Hello", context=False)
```
Context injection is controlled by the `[memory]` config section. See [Configuration](configuration.md) for details on `context_injection`, `context_top_k`, `context_min_score`, and `context_max_tokens`.
## Model Management
### List Available Models
See all models available on running engines:
```bash
jarvis model list
```
This produces a table showing each model, its engine, parameter count, context length, and VRAM requirements.
### Get Model Details
```bash
jarvis model info qwen3:8b
```
### Pull a Model (Ollama)
```bash
jarvis model pull qwen3:8b
```
### SDK Model Listing
```python
from openjarvis import Jarvis
j = Jarvis()
models = j.list_models()
engines = j.list_engines()
print(f"Models: {models}")
print(f"Engines: {engines}")
j.close()
```
## Running Benchmarks
The benchmarking framework measures inference latency and throughput against your engine.
=== "All benchmarks"
```bash
jarvis bench run
```
=== "Specific benchmark"
```bash
jarvis bench run -b latency
jarvis bench run -b throughput
```
=== "Custom options"
```bash
# 20 samples, JSON output
jarvis bench run -n 20 --json
# Specific model and engine, write to file
jarvis bench run -m qwen3:8b -e ollama -o results.jsonl
```
Example output:
```
Running 2 benchmark(s) on ollama/qwen3:8b (10 samples)...
latency (10 samples, 0 errors)
mean_ms: 245.3200
p50_ms: 238.1000
p95_ms: 312.4500
min_ms: 201.2000
max_ms: 345.6000
throughput (10 samples, 0 errors)
tokens_per_second: 42.1500
total_tokens: 4215
total_seconds: 100.0000
```
## Starting the API Server
OpenJarvis provides an OpenAI-compatible API server for integration with existing tools and frontends.
!!! note "Requires the `server` extra"
```bash
pip install 'openjarvis[server]'
```
### Start the Server
```bash
jarvis serve --port 8000
```
With custom options:
```bash
jarvis serve --host 0.0.0.0 --port 8000 --engine ollama --model qwen3:8b --agent orchestrator
```
### API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/v1/chat/completions` | `POST` | Chat completions (streaming and non-streaming) |
| `/v1/models` | `GET` | List available models |
| `/health` | `GET` | Health check |
### Use with Any OpenAI-Compatible Client
Once the server is running, point any OpenAI-compatible client at it:
```python
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")
response = client.chat.completions.create(
model="qwen3:8b",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```
Or with `curl`:
```bash
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3:8b",
"messages": [{"role": "user", "content": "Hello!"}]
}'
```
## Telemetry
OpenJarvis records telemetry for every inference call (timing, tokens, cost). View aggregated statistics:
```bash
jarvis telemetry stats
```
Export telemetry data:
```bash
jarvis telemetry export --format json
jarvis telemetry export --format csv -o telemetry.csv
```
Clear all telemetry records:
```bash
jarvis telemetry clear --yes
```
## Complete Working Example
Here is a complete end-to-end session combining multiple features:
```python
from openjarvis import Jarvis
# Initialize with defaults (auto-detect hardware and engine)
j = Jarvis()
# 1. Index some documentation
index_result = j.memory.index("./docs/", chunk_size=512)
print(f"Indexed {index_result['chunks']} chunks from {index_result['path']}")
# 2. Search memory
results = j.memory.search("how to configure engines")
for r in results:
print(f" [{r['score']:.3f}] {r['source']}")
# 3. Ask a question (memory context is injected automatically)
answer = j.ask("How do I configure the Ollama engine host?")
print(f"\nAnswer: {answer}")
# 4. Use an agent with tools
calc_result = j.ask_full(
"Calculate the compound interest on $10,000 at 5% for 10 years",
agent="orchestrator",
tools=["calculator", "think"],
)
print(f"\nCalculation: {calc_result['content']}")
print(f"Tools used: {[t['tool_name'] for t in calc_result['tool_results']]}")
print(f"Agent turns: {calc_result['turns']}")
# 5. List available models
models = j.list_models()
print(f"\nAvailable models: {models}")
# 6. Clean up
j.close()
```
## Next Steps
- [Configuration](configuration.md) — Fine-tune engine hosts, model routing, memory settings, and more
- [CLI Reference](../user-guide/cli.md) — Full reference for all CLI commands and options
- [Python SDK](../user-guide/python-sdk.md) — Detailed SDK documentation
- [Architecture Overview](../architecture/overview.md) — Understand the four-pillar design