Installation & Setup¶
This page walks through installing AGRO from scratch, what each component does, and common issues you might hit along the way.
AGRO is designed to be local‑first but not “everything in one binary.” There’s a Python backend, a React/TypeScript web UI, optional monitoring stack, and (if you want it) MCP / LSP‑style integrations.
You don’t have to run all of it. For a single‑repo, “just answer questions about this codebase” setup, you can keep things minimal.
1. Prerequisites¶
You’ll need:
- Python 3.10+ (CPython)
pipandvenv(or your preferred environment manager)- Git
- Node.js 18+ (only if you want to build the web UI yourself)
- Docker (optional, but recommended if you want monitoring / Qdrant in containers)
AGRO is just Python + FastAPI + a React frontend. There’s no custom C++ runtime or opaque binary.
2. Clone the repository¶
The repo root is what the backend treats as REPO_ROOT internally (via common.paths.repo_root()), and a lot of paths are computed relative to it.
3. Create a virtual environment¶
You can use whatever you like here; I’ll show venv:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install --upgrade pip
4. Install Python dependencies¶
From the repo root:
This pulls in:
- FastAPI / Uvicorn for the HTTP API
- Qdrant client for vector search
- Pydantic for configuration models
- pygls / lsprotocol / cattrs / attrs / packaging, etc. (used for the editor / LSP‑style pieces and some internal tooling)
You don’t have to think about those libraries directly; they’re just how the server wires things together.
5. Example environment configuration¶
AGRO expects two main configuration surfaces:
agro_config.json– tunable RAG behavior, models, retrieval knobs.env– secrets and infrastructure overrides
The backend loads .env first, before any os.environ access (server/services/config_registry.py calls load_dotenv(override=True) at import time). Then it loads and validates agro_config.json via Pydantic (AgroConfigRoot).
The precedence is:
.env(highest)agro_config.json- Pydantic defaults (lowest)
Where to put .env
.env is read from the process working directory. In practice, just put it at the repo root next to agro_config.json and run the server from there.
There’s a dedicated page with a copy‑pasteable example:
At minimum, you’ll usually want:
# What repo to index by default
REPO=agro
# HTTP server
HOST=127.0.0.1
PORT=8012
# Editor / DevTools
EDITOR_ENABLED=true
EDITOR_PORT=4440
# One model provider (pick whatever you actually use)
OPENAI_API_KEY=...
# or ANTHROPIC_API_KEY=...
The backend also has a list of fields it treats as secrets when writing config back out (server/services/config_store.py → SECRET_FIELDS), so those won’t be echoed in cleartext through the API.
6. Verify agro_config.json¶
There’s a checked‑in agro_config.json at the repo root. It’s parsed into AgroConfigRoot and then exposed through the config registry.
You don’t have to understand every field up front. The important part is that it parses and validates.
To sanity‑check it without starting the whole stack:
(or run any small script that imports AgroConfigRoot; Pydantic will throw if something is badly typed).
If you want to change models or retrieval defaults, see:
7. Start the backend server¶
The FastAPI app lives in server.asgi:create_app. There’s a small legacy entrypoint in server/app.py, but everything goes through the ASGI app.
From the repo root, with your virtualenv active:
--reloadis optional but useful during development.- The app will read
.envon import, thenagro_config.json, then start serving.
Once it’s up, you should see:
- OpenAPI docs at
http://127.0.0.1:8012/docs - The raw OpenAPI JSON at
http://127.0.0.1:8012/openapi.json
More details on the HTTP surface:
8. Start the web UI¶
The React/TypeScript frontend lives under web/. The backend serves a small status API and configuration endpoints; the UI talks to those.
From web/:
By default this will start a dev server on something like http://127.0.0.1:5173.
The UI expects the backend at http://127.0.0.1:8012 unless you’ve configured it differently.
9. Index a repository¶
Once the backend and UI are running, you need to build an index for at least one repo.
You can do this from:
- The Dashboard → Indexing panels in the web UI (see components like
Dashboard/IndexDisplayPanels.tsx,Dashboard/LiveTerminalPanel.tsx) - The CLI (
cli/agro.pyandcli/commands/index.py) - The HTTP API (
/api/index/start)
Under the hood, indexing is kicked off by server/services/indexing.py:
The important bits:
- It reads
REPOfrom the config registry (.env→agro_config.json→ defaults). - It sets
REPO_ROOTandPYTHONPATHso the indexer resolves paths correctly. - If you pass
{"enrich": true}it will setENRICH_CODE_CHUNKS=trueand add extra summaries to chunks.
You can watch indexing progress via:
- The UI’s Dashboard → System Status / Live Terminal panels
- The
/api/index/statusendpoint
10. Try your first query¶
Once indexing finishes, you can:
- Open the Chat tab in the UI (
web/src/components/Chat/ChatInterface.tsx) - Or use the CLI chat (
cli/chat_cli.py, documented in CLI Chat Interface)
The RAG pipeline entrypoint on the server side is server/services/rag.py:
You don’t need to touch this to get started, but it’s useful to know where top_k and repo selection actually come from. They’re just config registry lookups.
11. Optional: Editor / DevTools¶
AGRO ships with an embedded “editor” / DevTools surface that can:
- Show live settings
- Embed in other tools
- Expose some LSP‑style behavior
The settings are read from the same config registry, with a small legacy JSON fallback:
To use it, set in .env:
Then hit whatever route your deployment exposes for the editor (this is still evolving; check the UI’s DevTools → Editor tab and the /api/editor/* endpoints).
12. Optional: Monitoring & observability¶
If you want Prometheus / Grafana / Loki wired in, there’s a docker-compose.yml and a set of UI components under web/src/components/Grafana/ and web/src/components/Infrastructure/.
The high‑level flow is:
- Bring up the infra stack with Docker Compose (Prometheus, Loki, Grafana, etc.).
- Point AGRO at those endpoints via
.env(e.g.GRAFANA_API_KEY,GRAFANA_AUTH_TOKEN, etc.). - Use the Infrastructure and Grafana subtabs in the UI to verify connectivity.
Details live in:
13. How configuration actually works (service layer)¶
You don’t have to care about this to run AGRO, but if you’re going to extend it, it helps to know how config is wired.
The central piece is server/services/config_registry.py:
Every service layer module that needs configuration calls get_config_registry() at import time and then caches values as needed. For example, server/services/keywords.py:
If you change .env or agro_config.json at runtime and want those changes to take effect without a restart, you can:
- Call the appropriate reload function (like
reload_config()above) from your own code, or - Use the configuration endpoints exposed by the API / UI (see Configuration).
14. Common installation issues¶
Warning
This is a solo‑dev project. There are rough edges. If something here doesn’t match what you see in the code, trust the code and file an issue.
Problem: ModuleNotFoundError for server.* or common.*
- Make sure you’re running commands from the repo root.
- Ensure
PYTHONPATHincludes the repo root. The indexer explicitly setsPYTHONPATH=repo_root()when it spawns; for ad‑hoc scripts you may need:
Problem: Config values not updating when I edit .env
- The registry loads
.envat import time. If the process is already running, you’ll need to restart it or explicitly trigger a reload path that calls back into the registry.
Problem: Editor / DevTools not showing up
- Check
EDITOR_ENABLEDandEDITOR_PORTin.env. - Look at
server/services/editor.pyto see where it writesout/editor/settings.jsonandout/editor/status.json.
15. Next steps¶
Once AGRO is installed and the first repo is indexed:
AGRO is indexed on itself, so once you have it running you can also just go to the Chat tab and ask it:
“How does configuration precedence work?”
or
“Where does the indexer get
REPO_ROOTfrom?”
and it will walk you through the actual code paths.