UI — TUI / REPL

Shared async REPL for Klea chat interfaces.

File: klea_utils/ui/tui/repl.py

Copyright 2026 Ankur Sinha Author: Ankur Sinha <sanjay DOT ankur AT gmail DOT com>

async klea_utils.ui.tui.repl.run_repl(url: str, title: str, single_query: str = '', app_prefix: str = 'klea', app_name: str = 'klea-tui') None[source]

Run an interactive or single-query chat REPL.

Connects to the API server’s SSE /query/stream endpoint and displays progress labels and the final answer.

In interactive mode each query is sent as the user types it; the REPL does not batch queries.

Parameters:
  • url – Base URL of the API server (e.g. http://127.0.0.1:8005)

  • title – Application title displayed on start

  • single_query – If set, run one query and exit instead of REPL loop

  • app_prefix – Prefix for user/assistant labels (e.g. "klea")

  • app_name – Log identity for this frontend, used as the log file name so each process keeps its own logs (e.g. "klea-rag-tui")