Reference
Self-hosted reference
What the person who runs an install can set, run and change. To install, start with Install Self-hosted.
This page was checked against the source of release 1.0.37 of the public repository,
korely-ai/korely (Apache 2.0). If it and the repository differ, the
repository is right: its .env.example
carries every setting with its comment, and its operations guide
has the long procedures (backups, upgrades, a proxy in front).
The installer
install.sh works in a folder of its own (./korely unless you pass --dir) and nowhere else on the disk. It never asks for
sudo. It checks Docker (and warns when Docker Desktop has little memory), downloads the release's
docker-compose.yml, docker-compose.image.yml, .env.example, deploy/Caddyfile, deploy/backup.sh and deploy/restore.sh (the two scripts executable, since 1.0.40) and checks each against a
sha256 the script carries, writes a .env that only you can read with two random secrets, writes ./korely
(the one command to start, stop and remove the install), makes the account, the login and the first key, and prints them once. Run again in the same folder,
it starts what is there and makes nothing new.
| Option | What it does |
|---|---|
--dir, --port | The folder (./korely), and the port the API listens on, on 127.0.0.1 (8000). |
--version, --unverified | A release other than the script's own, which needs --unverified because the script carries checksums only for its own release. See Installing a particular release. |
--build, --from-local | Build the image from the release's source, or from a checkout of yours, instead of pulling the published image. |
--project, --user | The Docker Compose project (default korely), and the dashboard login (default admin). |
--provider, --region, --model | The model provider (gemini, scaleway, mistral, openai or openrouter), the region, and the model. The key is asked on the terminal and is never a flag, so it stays out of ps and the shell history. |
--wait | How many seconds to wait for the API (300 by default). |
--save-credentials | Also write the login and the key to credentials.txt in the folder, readable by you alone. Without it they are printed once and written nowhere. |
sh install.sh --help prints the list. On a Mac without a terminal, the Korely Installer app runs the same script.
Settings in .env
The installer writes .env; the file carries only the lines it needs, and the rest are in .env.example, commented out, with the default.
Change a line, then ./korely start (or docker compose up -d) to apply it.
Database, secrets and address
| Variable | What it does |
|---|---|
POSTGRES_PASSWORD | The password of the bundled database. The database is created with it the first time it starts: changing it afterwards locks you out of your data. |
DATABASE_URL | Only to use a Postgres you already run. Under the compose file you do not set it. |
SECRET_KEY | Encrypts the provider, key and models saved from the dashboard and the secret of an OAuth client, and keys the pseudonym an erasure leaves in place of an end user's id. Keep it with your backups: under another one, the choice saved on the screen cannot be read and earlier erasures cannot be found by id. Without it, saving a key from the dashboard is refused rather than stored in clear. |
SECRET_KEY_FALLBACKS | Old values of SECRET_KEY, newest first, comma separated: read and never written with. To rotate: put the new key in SECRET_KEY, the old one here, then run manage reseal-secrets (since 1.0.27). |
DOMAIN | The domain the install is served on. Set it and Caddy gets a real certificate. Left empty you get localhost, with a certificate your machine does not trust until you tell it to. |
PUBLIC_BASE_URL | The address clients reach the install at, advertised in the OAuth and MCP metadata. Unset, it is https://DOMAIN. Set it only when a proxy of yours serves the install at another address. |
FORWARDED_ALLOW_IPS | Which proxies the API believes about the client's address and scheme. caddy by default. Behind a proxy of yours, name it. See Your own proxy in front. |
PORT, HTTPS_PORT, HTTP_PORT | The API's port on loopback (8000), and the ports Caddy takes on the host (443 and 80). A real certificate needs 443 and 80. |
ACME_CA | Where certificates are requested. Leave it alone in production. The Let's Encrypt staging address is for testing, because the real one allows five certificates a week for one name. |
COMPOSE_PROJECT_NAME, COMPOSE_FILE, KORELY_IMAGE | Written by install.sh and read by Docker Compose: the name of the install's containers and volumes, the second compose file, and the image it runs (pinned by digest). |
API_MEMORY_LIMIT | The API container's memory ceiling, 1536m by default. |
SQL_ECHO | Log every SQL statement. Off. |
REGION | The label /v1/ping reports as region: where you say the machine and the database are, eu when unset. The service cannot check it. |
KORELY_MODE | Leave it as self_hosted. hosted is the Cloud's mode, and an install without the Cloud's own package refuses it at start. |
Models and vectors
| Variable | What it does |
|---|---|
GOOGLE_API_KEY, EXTRACTION_MODEL | The writer with Gemini: the model that turns memories into facts. Optional here: the dashboard's first login asks for a provider and its key, and that choice wins over these lines until you choose Use what .env says instead in Settings. |
EXTRACTION_PROVIDER, MISTRAL_API_KEY, MISTRAL_API_BASE, MISTRAL_EXTRACTION_MODEL | The OpenAI-compatible door: exactly mistral in EXTRACTION_PROVIDER selects it, and any other value writes with Gemini. Despite the names, MISTRAL_API_BASE can be Scaleway, OpenRouter or a server of your own; set the model to a name that host serves, or every call is refused and no memory gains facts. Since 1.0.40 a call to an address that redirects is refused at the new address and the key goes to the configured host only: write the final address (an http address answered by its https now fails). |
VOCABULARY_MODEL | The model that decides the relation vocabulary, of the same provider. Unset, it is the writer's model. A Gemini name here with the OpenAI-compatible door stops the service at start. |
OPENROUTER_API_KEY | Only for manage review-subjects, off by default. See the commands. |
EMBEDDING_PROVIDER, EMBEDDING_MODEL | Where vectors are computed. local (default): on this machine, with EmbeddingGemma-300m, so no text leaves the machine to be searched. gemini: with GOOGLE_API_KEY. Decide before the first start: changing it later means building again and computing the stored vectors again (manage recompute-vectors). |
LLM_TIMEOUT_SECONDS | How long a model call may take before it is abandoned. 60. |
WRITE_ASYNC | true (default): a write answers as soon as the memory is stored (processing) and the worker mines the facts a few seconds later. false: the request mines them and answers with them. |
LLM_RATES | What a token costs here, as JSON, so the usage report can show money. Without it the report shows call counts and leaves the money blank. |
MEMORY_WINDOWS | Off by default (since 1.0.33). A vector for each window of a long memory (100 words, a new window every 50). After turning it on, manage memory-windows --apply makes the windows of the memories stored before. |
Limits, worker and sessions
| Variable | What it does |
|---|---|
RATE_LIMIT_PER_MINUTE | Requests per minute per account. 0 (default) disables it. It protects your database and your model bill from an agent stuck in a retry loop; nothing is metered or billed. |
RUN_WORKER | The background worker runs inside the API process. false and python -m korely_agent.worker run it on its own. |
DRAIN_LIMIT, BATCH_DRAIN_LIMIT, WEBHOOK_DRAIN_LIMIT, VECTOR_DRAIN_LIMIT | How much each job takes per pass: memories mined (20, every 10 s), batch jobs (5, every 30 s), webhook deliveries (20, every 15 s), vectors retried (50, every 30 s). |
DRAIN_STALE_MINUTES | How long a memory in the worker's hands may stay there before it goes back in the queue. 15. |
SESSION_HOURS | How long a dashboard login lasts. 12. |
DASHBOARD_DIR | Where the built dashboard is served from. A directory that does not exist runs the service with no screen. |
TRUST_AUTH_HEADER, WEBHOOK_ALLOW_HTTP, WEBHOOK_ALLOW_PRIVATE_URLS, FACTS_EXPORT_DIR, FACTS_EXPORT_EVERY_SECONDS | See Settings you may need in .env. The Cloud refuses the first four at start. |
What the worker trims
The worker trims its own records once an hour. 0 keeps them for ever, and anything over 36500 days is read as a century.
| Variable | Default | What it keeps |
|---|---|---|
AUDIT_RETENTION_DAYS | 400 | The audit trail: who touched which end user's data. Since 1.0.40 it also sets how long a revoked API key is kept and counted (0 keeps the trail, and every revoked key, for ever). |
LLM_USAGE_RETENTION_DAYS | 400 | The model usage: which agent spent what. |
WEBHOOK_DELIVERY_RETENTION_DAYS | 30 | A finished webhook delivery. |
READ_MARKS_RETENTION_DAYS | 90 | Which fact an agent that named itself as reader was handed (agent notices), counted from its last read. |
Finished batch jobs go after seven days. That one is not a setting, because their payloads are copies of people's memories.
The manage commands
Provisioning belongs to whoever runs the machine, so it is a command on the machine and not a route on the internet. Run a command inside the API container:
docker compose exec api python -m korely_agent.manage <command>
./korely compose exec -T api python -m korely_agent.manage <command> # in a folder made by install.sh
The commands that make or list accounts, keys and logins take --json, which prints one JSON object or list and nothing else; the text is for a person and may change its wording.
A refusal is a sentence on stderr with exit status 1.
| Command | What it does |
|---|---|
create-tenant --name N | Make an account and print its first key. --expires-in DAYS|never: the key lasts 90 days by default. |
list-tenants | List the accounts. |
issue-key --tenant ID [--name N] [--admin] [--expires-in DAYS|never] | Make another key for an account. --admin also grants administration (keys, webhooks, projects). |
list-keys --tenant ID, revoke-key --tenant ID --id ID | List an account's keys, and take one out of service. |
create-operator --tenant ID --username U [--install-admin] | Make a login for the dashboard. The password is generated and shown once; there is no default password and no way to set one. |
list-operators [--tenant ID] | List the people who can sign in. |
reset-password --username U | A new password, shown once, and every open session of that person ended. |
grant-install-admin --username U [--revoke] | Name who sets the install's model provider, key and models. See below. |
status | Counts, and whether extraction is actually running. |
reextract [--empty] [--no-errors] [--limit N] | Queue memories for another attempt: the ones extraction gave up on and the vectors that failed (turn that off with --no-errors), and with --empty those marked done that produced no fact. |
add-webhook --tenant ID --url URL [--events E], list-webhooks [--tenant ID], delete-webhook --tenant ID --id ID | Register, list and remove a webhook endpoint. --events is comma separated; * (default) is all. |
rotate-webhook-secret --tenant ID --id ID | A new signing secret for an endpoint, shown once. The old one stops working at once. See Webhooks. |
recompute-vectors [--apply] [--limit N] | Compute every stored vector again with the embedding model in force. Without --apply it only reports. |
memory-windows [--apply] [--batch N] [--limit N] | Make the windows of the memories stored before MEMORY_WINDOWS was turned on. It refuses to run while the setting is off, unless you pass --while-off. |
reclassify-relations, review-vocabulary, review-objects, review-subjects | Reviews that ask a model again. Each is a dry run unless you apply it. review-objects and review-subjects write their proposals to a file (--out), take a spending limit (--cap, in the currency of LLM_RATES), and write exactly that file with --apply FILE and no new model call. review-subjects is off by default, calls OpenRouter, and only for projects of the Global region; its --dry-run calls no model. |
erasures-export, erasures-replay, erasures-superseded | Keep the record of erasures across a restore: export them as JSON, and after a restore repeat the ones the database does not hold. deploy/restore.sh uses them. |
credentials-export, credentials-replay | The state of every key, password and webhook secret as JSON, and after a restore the changes made since the dump, ending every session. |
reseal-secrets | After a rotation of SECRET_KEY, seal again under the new key what a fallback sealed. |
manage --help lists the commands of the version you run, which can have more than this page.
Who can sign in, and who sets the models
- Operators. An operator is a login to the dashboard, tied to one account.
manage create-operatormakes one and prints a generated password once;manage reset-passwordgives a new one and ends that person's sessions. A dashboard login lastsSESSION_HOURS(12). - Keys. An API key is not a login. A key with the
adminpermission can call the/adminroutes; an ordinary key cannot. - The install admin. The model provider, its key and the models are not an account's: they are the whole install's. The first login of an install is an install admin, and so is one made with
--install-admin. Once the install holds more than one account, only an install admin, signed in to the dashboard, can change them: an admin key or another account's administrator gets403 install_admin_only.manage grant-install-adminnames or, with--revoke, unnames one. - Single sign-on. With
TRUST_AUTH_HEADERa gateway in front can sign operators in by a header. Your gateway must strip that header from incoming requests, or anyone who can reach the service can become any operator. See the settings.
Model providers
The writer is the one model call in the engine: it turns memories into facts, and it is billed to your own key. Vectors are computed on your machine by default, and the model that answers your users belongs to your agent, not to the store. The dashboard's first login offers seven providers. Each has a suggested model, which you can change.
| Provider | Region | Suggested model |
|---|---|---|
| Mistral | Europe | mistral-small-latest. Not measured by us. |
| Scaleway | Europe (Paris) | gpt-oss-120b. Our European writer: 129 of 152 on LoCoMo (6 October 2026). |
| Gemini | Global | gemini-3.1-flash-lite. Our Global writer: 129 of 152 on LoCoMo and 51 of 60 on LongMemEval. |
| OpenAI | Global | gpt-4.1-mini. Not measured by us. |
| Claude | Global | claude-haiku-4-5. Not measured by us. |
| Grok | Global | grok-4-fast-non-reasoning. Not measured by us. |
| OpenRouter | Global | openai/gpt-oss-120b:nitro. The fastest writer we measured, about 3 seconds per memory. |
install.sh --provider knows five of them by the names gemini, scaleway, mistral, openai and openrouter;
Claude and Grok are chosen on the dashboard. A project has a region, eu or global, and its memories are read by the writer of that region. A model that is not served by the host you point it at refuses every call, so no memory gains facts.
From a terminal, python3 scripts/choose_models.py writes the lines for a host you pick. With no key at all the install still stores and searches memories, and /health says extraction is not configured.
Upgrading and going back
- Read the CHANGELOG first. It says what to do before and after each upgrade.
- Back up first.
./deploy/backup.shmakes a dump and keeps the last 14, with the erasures. A folder made byinstall.shbefore 1.0.40 has neither script: the upgrade steps below bring them. - Keep
.env, and with itSECRET_KEY. Never make a new one at an upgrade. - A checkout.
git pull && docker compose up -d --build. Migrations run at boot, and if one fails the container refuses to start rather than serve on a half-built schema. - A folder made by
install.sh.install.shinstalls and starts; it does not upgrade. The operations guide has the steps: new files checked against the release's sha256, a dump, a tar of the folder you leave, then./korely start. It goes only to the newest release. Since 1.0.40 the steps read the release's list of files from the tag's owninstall.sh, and stop before anything changes when thatinstall.shlacks the sha256 of one of them. - Upgrading to 1.0.40. No new setting. Two migrations add two indexes, each built with a plain
CREATE INDEX, so writes to those two tables wait while it builds (the time on a large audit trail is not measured), and a nullable column. Reload Caddy so it reads the new Caddyfile, which no longer letsVia: 1.1 Caddyout. WithTRUST_AUTH_HEADERset, read the setting first. A setting refused at start now names the line and what it accepts, never its value, so a key pasted on the wrong line of.envdoes not reach the container's log. - Going back. Without a migration, put the files of the earlier release back. Across a migration, restore the dump you took before. See Going back to an earlier version.
The long procedures are in the repository's operations guide.
Self-hosted and the Cloud
The same engine runs both. What differs:
| Self-hosted | Cloud | |
|---|---|---|
| Where it runs | Your machine, with Docker. | Ours, at api.korely.ai and agent.korely.ai. |
| Accounts, plans and quotas | You make accounts with manage. No billing, no plan limits; RATE_LIMIT_PER_MINUTE is yours to set. | Sign-up, plans, quotas and the daily safety stop. See the API reference for the routes that exist only here. |
| Models | You choose the provider and bring its key. Vectors are computed on your machine by default. | The service's. Every account gets 403 set_by_the_service on /admin/provider and /admin/models. |
| Operating it | You: backups, upgrades, certificates, the proxy, manage. The API's own page is at /docs, and its OpenAPI document at /openapi.json. | Us. Neither of those two is served. |
| Settings the Cloud refuses | TRUST_AUTH_HEADER, FACTS_EXPORT_DIR, WEBHOOK_ALLOW_HTTP and WEBHOOK_ALLOW_PRIVATE_URLS. | It stops at start if any is set. |
| Querying files (documents) | Not in the public source. | Cloud only. |