Repository navigation
Architecture overview
This page comes from
site/content/architecture/overview.mdin the repository and is regenerated on every merge tomain. To correct it, edit that file; changes made here are overwritten.
Cartogen AI is a single Python package that QGIS loads as a plugin. It has no server and no build step. A request goes from the dock panel to an agent that talks to a model provider and calls tools; the tools use PyQGIS and Processing against your open project, and the results come back to the chat.
| Layer | Where | What it does |
|---|---|---|
| UI | core/ui/ |
The dock panel, settings, memory, layer-sensitivity, account and help dialogs. Runs on the GUI thread. Logic that can be tested without Qt (chat formatting, colour derivation, icons as SVG strings) is kept Qt-free on purpose. |
| Agent core | core/agent/ |
CartogenAi in agent_orchestrator.py is the tool-calling loop. It composes a tool dispatcher, a usage tracker and a history manager, and consults the task matcher, tool router and guards. See The agent loop. |
| Tools | core/agent/tools/ |
294 tools, one module per domain, registered with @register_tool. See Tools and routing. |
| Providers | infrastructure/providers/ |
One client per model provider behind a common interface. See Providers and networking. |
| Services and models |
core/services/, core/models/, core/validators/, core/representation/
|
Prompt refiner, tool router, response guard; confidence, sensitivity, egress-gate and plan-gate models; schema and P-code validators; the map representation planner. |
Cross-cutting: core/logger.py (structured, metadata-only logging), core/exceptions.py, core/net.py (HTTP through QGIS), infrastructure/auth.py (credentials), infrastructure/settings_keys.py (every QgsSettings key under cartogen_ai/).
-
No server. Everything runs in your QGIS process, except an optional isolated subprocess for model-written scripts.
service/in the repository is an unfinished prototype for a hosted gateway and is not part of the plugin or its tests. - No tier-gating. One GPL v2 codebase; there is no licence-check logic.
- No model hosting. Requests go straight from your machine to the provider you configured, with your key. The "Cartogen API" provider is a stub.
-
Every module degrades without QGIS. Each module that touches
qgis.corehas its ownQGIS_AVAILABLEguard, so the unit tests run on a plain Python install. Real QGIS behaviour is covered by a separate live test job. See Testing and CI. - The model is untrusted input. Its tool calls can carry attacker-influenced arguments (prompt injection, a hallucination, a malicious provider), so the dangerous capabilities are gated in code, not in the prompt. See Security overview.
- Say what was and was not done. Replies are cross-checked against the tool calls that actually ran; a guard stop always reports what finished. See Guards.
- Metadata-only logging. Logs never contain prompts, replies, tool arguments, results or coordinates.
- The agent loop: one request, round by round.
- Threads, tasks and Stop: what runs where, and why QGIS stays responsive.
- Repository layout: the same structure as a file tree.
Cartogen AI 1.18.5 · generated from the repository at commit 26536e9f75 on 2026-11-12 · this wiki is rebuilt on every merge to main; edits made in the browser are overwritten, so correct the source files instead.
Get started
How it works
- Architecture overview
- The agent loop
- Threads, tasks and Stop
- Tools and routing
- Providers and networking
- Memory, state and results
- Guards and honesty checks
- The dock and dialogs
- Processing provider
Tools and data
- Tool reference
- AI Imagery Feature Extraction
- Data Analysis & Prediction
- Database & Workflows
- Export & Reporting
- Humanitarian Data (HDX / OSM / geoBoundaries)
- Humanitarian Logistics
- Monitoring & Scheduling
- Print Layouts
- Project Management
- Raster
- Reporting & Document Analysis
- Satellite Imagery & Vision
- Styling & Labeling
- System, Search & Scripting
- Task & Memory Management
- Vector & Geoprocessing
- More tools, by module
- Task register
- External data sources
Humanitarian GIS
Security and privacy
Develop
Project