Ahnlich CLI
The CLI lets you talk to Ahnlich by typing commands in your terminal — no code required. You type a short instruction, press Enter, and the server answers right away. It's the fastest way to try Ahnlich and see how it behaves.
Under the hood it speaks a small, readable command language (a
Domain-Specific Language, or DSL) like PING, CREATESTORE books, and
GETSIMN 3 …. Each command goes straight to the Ahnlich DB or Ahnlich AI
server and the response comes back in the same window.
Think of the CLI as your playground for exploring Ahnlich:
- Test queries quickly without setting up an SDK project
- Experiment with similarity search and vector operations interactively
- Prototype pipelines for embedding, storage, and retrieval
- Debug servers locally before moving to production
Your first commands
Start an interactive session against the DB server and try a few commands:
ahnlich-cli ahnlich --agent db --host 127.0.0.1 --port 1369> PING
< PONG
> CREATESTORE books DIMENSION 3
< OK
> LISTSTORES
< books (0 entries)
--agent dbtalks to Ahnlich DB (port1369); use--agent aifor the AI proxy (port1370).- Type
PINGfirst — if you getPONG, you're connected.
When not to use the CLI: it's built for exploring and debugging, not for production apps. For real integrations use the client libraries (Python, Node.js, Go, Rust), which give you richer APIs and proper error handling.
Non-Interactive Mode
The CLI supports a non-interactive mode via the --no-interactive flag, which is ideal for:
- Docker health checks - Verify server availability in container orchestration
- CI/CD pipelines - Automate testing and deployment workflows
- Shell scripts - Integrate Ahnlich commands into automation scripts
- Monitoring systems - Programmatically check server health and status
Usage
In non-interactive mode, the CLI reads commands from stdin and exits immediately after processing:
# Single command via echoecho 'PING' | ahnlich-cli ahnlich --agent db --host 127.0.0.1 --port 1369 --no-interactive # Multiple commands via heredocahnlich-cli ahnlich --agent db --host 127.0.0.1 --port 1369 --no-interactive <<EOFPINGINFOSERVERLISTSTORESEOF # Commands from a filecat commands.txt | ahnlich-cli ahnlich --agent ai --host 127.0.0.1 --port 1370 --no-interactiveDocker Health Check Example
services:
ahnlich_db:
image: ghcr.io/deven96/ahnlich-db:latest
command: "ahnlich-db run --host 0.0.0.0"
ports:
- "1369:1369"
healthcheck:
test: ["CMD-SHELL", "echo 'PING' | ahnlich-cli ahnlich --agent db --host 127.0.0.1 --port 1369 --no-interactive"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
ahnlich_ai:
image: ghcr.io/deven96/ahnlich-ai:latest
command: "ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0"
ports:
- "1370:1370"
depends_on:
ahnlich_db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "echo 'PING' | ahnlich-cli ahnlich --agent ai --host 127.0.0.1 --port 1370 --no-interactive"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
Exit Codes
- 0: All commands executed successfully
- Non-zero: Error occurred (connection failure, invalid command, etc.)
This makes it easy to integrate with shell scripts and monitoring tools that rely on exit codes for success/failure detection.