Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Run a server

Start a long-lived Telys server on a Unix socket or an access-token-protected TCP port, from the CLI or from Python, with durability and supervision options.

A Telys server is one process that owns a store directory and answers client requests over a socket. Start it with telys serve or the equivalent serve() function from telys.server. Either call blocks: it runs in the foreground until stopped, which is what you want under a process manager.

Prerequisites

  • Telys installed and the runtime verified: telys runtime verify. See Verify your install.

  • A store directory. It is created if absent; pass an existing one to serve collections you already have.

Start on a Unix socket (trusted, local)

Use a Unix domain socket when every client runs on the same host. The socket file is created with 0600 permissions and treated as trusted, so no token is needed.

1

Run the server

telys serve --path ./memory --socket /tmp/telys.sock
2

Confirm it is listening

The process holds the foreground and the socket file appears:

ls -l /tmp/telys.sock
srw------- 1 you staff 0 Jul 14 14:20 /tmp/telys.sock

The leading s and the rw------- mode confirm a Unix socket you own with 0600 permissions.

Start on a TCP port (token required)

To reach the server from another host, listen on TCP. TCP requires an access token — the server refuses anonymous connections. Generate a strong token, pass it once, and bind to a private interface.

export TELYS_ACCESS_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
telys serve \
  --path ./memory \
  --host 0.0.0.0 --port 9099 \
  --access-token "$TELYS_ACCESS_TOKEN"

--access-token reads $TELYS_ACCESS_TOKEN when the flag is omitted, keeping the secret out of shell history and the process list.

Useful flags

Pass either --socket or both --host and --port; supplying neither exits with code 2. The rest are optional.

Flag
Purpose

--path PATH

Store directory the server owns (required).

--socket SOCKET

Listen on a Unix socket at this path.

--host HOST --port PORT

Listen on TCP (both required together).

--access-token TOKEN

Bearer token for TCP; falls back to $TELYS_ACCESS_TOKEN. Required for TCP.

--license LICENSE

License token; falls back to $TELYS_LICENSE.

--require-license

Verify a products.telys license offline on boot; refuse to start otherwise.

--save-interval SECONDS

Periodically persist open collections (default 0.0 = off).

--supervise

Restart the worker automatically if it exits.

Durability with --save-interval

Collections persist when a client calls save(). Set --save-interval to also flush open collections on a timer, bounding how much recent work a crash could lose:

Auto-restart with --supervise

--supervise restarts the worker if it crashes. It complements an external process manager but does not replace one; see Deployment notes.

Require a license on boot

With --require-license, the server verifies a products.telys version-2 license entirely offline before accepting a single connection. See Offline licenses & verification.

Start from Python

serve() is the same server behind the CLI. It blocks, so run it as your process entry point. Pass a Unix socket_path, or host and port as keyword arguments.

The full signature is serve(path, socket_path=None, *, host=None, port=None, license_token=None, require_license=False, access_token=None, embedder_factory=None, save_interval_s=0.0). On boot the server best-effort pre-registers AlgentaBigramEmbedder as "bigram"; pass an embedder_factory to expose other embedders to remote create_collection calls by name.

Expected result

A running server prints nothing on success and holds the foreground:

  • Unix socket: the socket file exists at your --socket path with mode srw------- (0600).

  • TCP: the port is open on your chosen host, e.g. nc -z 127.0.0.1 9099 returns success.

From a second terminal, a client handshake and ping() confirm end to end:

An empty collections() list is expected for a fresh store — only saved collections appear. Stop the server with Ctrl-C.

Next steps

Last updated

Was this helpful?