Files
Javier Martinez cd8ca2214a feat: resumable chat worker + tool worker + async tokenizer (#2298)
* fix: avoid to block the loop

* fix: blocks in expansion

* fix: remove maximum concurrent users

...

* fix: multiplexer

* fix: readers

* fix: more fixes

...

* fix: impl

* feat: tool scheduler

* feat: add adaptative

* feat: add chat worker

* fix: max

* feat: add chat/tools workers

* fix: mypy

* feat: add generic scheduler

* fix: get result

* feat: do serializable the tool executor

* fix: tools

* fix: config

* fix: config

* fix: args

* fix: config

* fix: serializer

* Revert "fix: blocks in expansion"

This reverts commit a2110f94a8.

* fix: unify all logic

* feat: add ingestion scheduler

* fix: settings

* fix: config

* feat: add arq worker to chat

* fix: arq worker

* fix: add nest

* fix: mypy

* fix: await

* fix: script stress

* fix: tokenizer

* fix: chat scheduler

* fix: mypy

* fix: add async tokenizer

* fix: improve condense

* fix: tool scheduler

* feat: add initial real async chat worker

* fix: mypy

* fix: do resumable local executor

...

...

...

fix: revert usleess changes

fix: remove parent chat job

fix: refactor

fix: loop

ref: rename models

fix: chat engine

fix: mypy

...

...

...

fix: fix deps

* fix: tests

* fix: tests

* ...

* fix: stream

* fix: config

* fix: scheduler

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Handle PGPT_WORKER_MODE=celery in health check worker status

* fix: cancel

* fix: arch

* fix: test ingestion

* fix: deserialization of chat messages

* fix: broken results

* fix: mypy

* fix: test

* fix: config

* fix: remove arq tool worker

* fix: output cls

* fix: preserve early resumable tool callbacks

* fix: preserve async tool result order

* refactor: address worker PR review comments

* fix: mypy

* test: colocate ARQ chat enqueue coverage

* fix: remove redis from tests

* test: isolate chat mocks and cancellation timing

* fix: tests

(cherry picked from commit 218b599c66)

# Conflicts:
#	tests/server/chat/anthropic/test_anthropic_client.py
#	tests/server/chat/anthropic/test_langchain_anthropic.py
#	tests/server/chat/test_chat_knowledge_revamp.py
#	tests/server/chat/test_chat_routes.py
#	tests/server/chat/test_chat_routes_skills_integration.py

* fix: tests

(cherry picked from commit fc5ec0f72a)

* fix: ruff

* fix: test

* fix: worker config

(cherry picked from commit 1371c275a1)

* fix: principal

* test: remove flaky chat cancellation assertion

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-07-15 12:12:45 +02:00

161 lines
4.0 KiB
Plaintext

---
title: "CLI"
description: "Manage the server, workers, and connected apps with the private-gpt CLI."
---
The `private-gpt` CLI covers the full service lifecycle: starting the HTTP server, launching background workers, and running connected apps like Claude Code.
```
private-gpt <command> [flags]
Commands:
serve Start the HTTP server
worker Start a background worker process
run Launch a connected app (claude-code, openclaw, custom)
help Show help for any command
```
---
## serve
Starts the uvicorn HTTP server.
```bash
private-gpt serve [flags]
```
| Flag | Default | Description |
|---|---|---|
| `--host` | `0.0.0.0` | Bind address |
| `--port` | from settings | HTTP port |
| `--reload` | off | Enable auto-reload for development |
| `--log-level` | `info` | `debug` \| `info` \| `warn` \| `error` |
| `--pid-file` | — | Write PID to file (for systemd / launchd) |
**Examples:**
<Tabs>
<Tab title="macOS / Linux">
```bash
# Start with defaults
private-gpt serve
# Development mode with auto-reload
private-gpt serve --reload --log-level debug
# Production with PID file for process supervision
private-gpt serve --pid-file /var/run/private-gpt.pid
```
</Tab>
<Tab title="Windows (PowerShell)">
```powershell
# Start with defaults
private-gpt serve
# Development mode with auto-reload
private-gpt serve --reload --log-level debug
# Production with PID file for process supervision
private-gpt serve --pid-file C:\ProgramData\private-gpt\private-gpt.pid
```
</Tab>
</Tabs>
**PID file behavior:** if `--pid-file` is given and the file already exists with a live process, the command exits with code 1 and prints the existing PID. On `SIGTERM` the PID file is removed.
---
## worker
Starts the Celery worker stack. All behaviour is controlled through environment variables — no CLI flags.
```bash
private-gpt worker
```
`PGPT_WORKER_MODE` is required and selects one registered worker runtime:
| `PGPT_WORKER_MODE` | What starts |
|---|---|
| `arq` | ARQ worker |
| `celery` | Celery worker |
| `flower` | Flower UI only |
**Examples:**
<Tabs>
<Tab title="macOS / Linux">
```bash
PGPT_WORKER_MODE=celery private-gpt worker
# Custom concurrency and queues
PGPT_CELERY_QUEUES=ingest,chat PGPT_CELERY_CONCURRENCY=4 private-gpt worker
```
</Tab>
<Tab title="Windows (PowerShell)">
```powershell
$env:PGPT_WORKER_MODE = "celery"
private-gpt worker
# Custom concurrency and queues
$env:PGPT_CELERY_QUEUES = "ingest,chat"
$env:PGPT_CELERY_CONCURRENCY = "4"
private-gpt worker
```
</Tab>
<Tab title="Windows (CMD)">
```cmd
set PGPT_WORKER_MODE=celery
private-gpt worker
:: Custom concurrency and queues
set PGPT_CELERY_QUEUES=ingest,chat
set PGPT_CELERY_CONCURRENCY=4
private-gpt worker
```
</Tab>
</Tabs>
---
## run
Launches a connected app as a managed child process, automatically injecting the server connection details.
See the [Integrations](/integrations/claude-code) section for app-specific setup guides.
```bash
private-gpt run <app> [flags] [-- <app-args>]
```
| Flag | Default | Description |
|---|---|---|
| `--attach / --no-attach` | auto (TTY detected) | Attach stdin/stdout |
| `--detach` | off | Run in background, print run ID |
| `--session <id>` | — | Resume a previous app session |
| `--model <id>` | `llm.default_model` | Model name (forwarded via env) |
| `--auto-approve` | off | Skip confirmations (CI mode) |
| `--no-server` | off | Skip server detection and auto-start |
**Server auto-start:** before launching the app, `private-gpt run` checks `/health`. If the server is not reachable it starts one automatically and waits up to 60 s. Pass `--no-server` to skip this — useful when the server is managed externally (systemd, Docker).
---
## help
Show help for any command:
```bash
private-gpt help
private-gpt help serve
private-gpt serve --help
```
Unknown commands print a suggestion:
```
$ private-gpt srve
Unknown command: 'srve'. Did you mean: 'serve'?
```