Goal
Set up Mithril with multiple Gemini models as a multi-agent backend, then connect Junie to it. Junie sees "one model" but behind it you have specialized Gemini agents working together.
Step 1: Install Mithril
Install
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/GiacomoSaccaggi/mithril/main/install.sh | bash
# Or Docker
docker pull ghcr.io/giacomosaccaggi/mithril:latest
Step 2: Get a Gemini API Key
Set API key
# Get your key from https://aistudio.google.com/apikey
mithril config set gemini "AIzaSy..."
Step 3: Create a Multi-Agent Fellowship
.mithril/fellowship.yaml
# Create .mithril/fellowship.yaml in your project:
name: "gemini-multi"
description: "Multi-agent Gemini team"
controller:
provider: local
model: qwen-1.5b # Free local router
agents:
- name: coder
provider: gemini
model: gemini-2.5-flash
role: "Fast coder — implements features quickly"
when: "coding tasks, implementations, bug fixes"
can_call: [reviewer]
tools: ["*"]
- name: reviewer
provider: gemini
model: gemini-2.5-pro
role: "Senior reviewer — catches bugs and architecture issues"
when: "code review, complex logic analysis"
can_call: []
tools: ["read_psi", "grep_files", "git_diff"]
- name: researcher
provider: gemini
model: gemini-2.5-flash
role: "Researcher — searches web and documentation"
when: "questions about APIs, libraries, documentation"
can_call: []
tools: ["web_search", "fetch_page"]
Step 4: Start Mithril
Start the engine
mithril serve
# Output:
# Server http://localhost:16180
# Fellowship: gemini-multi (coder, reviewer, researcher)
Step 5: Connect Junie
In your JetBrains IDE with Junie:
- Open Settings → Junie → AI Provider
- Select Ollama as the provider type
- Set URL:
http://localhost:16180 - Click "Refresh Models" — you'll see
gemini-multi:latest - Select it as your model
- Done! Junie now uses your multi-agent Gemini team
What Happens When You Ask Junie Something
- Junie sends your request to
http://localhost:16180/api/chat - Mithril's GGUF classifier reads it (~100ms, free)
- Routes to the right agent:
- "Fix this bug" → coder (Gemini Flash)
- "Review this PR" → reviewer (Gemini Pro)
- "How does this API work?" → researcher (Gemini Flash + web)
- Agent can use tools (read files, search web, etc.)
- Agent can delegate: coder writes code → hands to reviewer → reviewer approves
- Response streams back to Junie
Docker Alternative (for teams)
Docker for teams
# docker-compose.yml already included in repo
# Just set your Gemini key:
echo "MITHRIL_KEY_GEMINI=AIzaSy..." > .env
docker compose up -d
# → http://localhost:16180 ready for all team members