Skip to content

1.4.0 — promptise run

Choose a tag to compare

@cryxnet cryxnet released this 17 Oct 21:13
· 52 commits to main since this release

Added

  • promptise run runs your project, like npm start -- a project is described by promptise.toml (or [tool.promptise] in pyproject.toml), found from the current directory upwards, the way package.json describes a Node project. promptise run runs the manifest's main file as a normal, complete Python program (__name__ == "__main__", sys.argv, exit codes as with python main.py), and with --devtools, --tui, --prod observability or in the agent modes, every agent the program builds is instrumented automatically, with no changes to your code (a plain promptise run adds nothing to the agents). A .py file, file.py:factory or package.module:factory can be named instead; without a manifest, promptise run some_file.py uses the defaults. See docs/core/projects.md.
  • The project manifest -- name, version, description, main, agent (an agent factory, async def create_agent(ctx: RunContext)), python_path, and the tables [scripts], [env], [dev], [prod], [serve] and [pricing]. Unknown keys are errors that name the dotted path, so typos are caught. RunContext (promptise.run) tells a factory the project, root, mode, flags and the --model override.
  • Modes -- script (the program), chat (an interactive chat with the factory's agent: streaming, tool calls inline, /help /stats /tools /reset /exit), once (-i TEXT or -i - for stdin, --json for the answer and stats as JSON) and serve. --mode auto picks one from the target and the main file.
  • Scripts -- [scripts] holds named commands, like npm scripts: promptise run dev. A script runs through the shell from the project root; extra arguments are appended, promptise run options are passed on to scripts that are promptise commands, the running Python's bin directory comes first on PATH, and promptise run --list lists them.
  • Environment -- -e K=V sets a variable for one run; --env-file files and then [env] files (default .env) are loaded in order and never override a variable that is already set; [env] vars sets defaults; every missing [env] required variable is reported at once (exit 2). PROMPTISE_NO_DOTENV=1 turns file loading off.
  • --devtools / -d -- a live trace of every agent on stderr (each LLM turn with model, latency, tokens and estimated cost, each tool call with arguments and result, errors and agent events) and a summary per agent, model and tool when the run ends. Costs come from the manifest's [pricing] table (USD per 1M tokens, globs allowed); there is no built-in price list. [dev] report / --report PATH writes a JSON run report.
  • --tui / -t / -tui -- a full terminal UI with Console/Chat, Trace, Tools, Metrics, Events, Approvals, Agents, MCP, Logs and Run tabs. Digits switch tabs, esc leaves the input, r restarts the program, s stops it, a / d approve or deny a pending tool call (for agents with a QueueApprovalHandler), q quits, ? shows help. The program runs in a child process, so nothing it prints draws over the UI; in script mode the console input goes to its stdin.
  • --watch / -w -- restarts the program when a project file changes ([dev] watch, [dev] ignore), like nodemon.
  • --prod and --check -- JSON log lines on stderr (stdout stays the program's output), run events and, with [prod] observe, every timeline event as JSON log lines, and a graceful SIGTERM (a script shuts down as on Ctrl+C and exits with 143; the HTTP API drains, giving in-flight requests [prod] shutdown_timeout seconds, and exits with 0). Every run checks the manifest, the environment and the entry first and lists every problem (exit 2); --check also compiles the script or imports the factory, then exits 0 or 2.
  • --serve -- an HTTP API for the agent factory: GET /healthz, GET /readyz, GET /v1/info, POST /v1/invoke ({input, session_id?} → {output, duration_ms, usage, request_id}), POST /v1/stream (Server-Sent Events). Bearer auth on /v1/* from [serve] auth_token_env (default PROMPTISE_SERVE_TOKEN), required on a non-loopback host; without a token, loopback-only Host and no cross-site Origin; 429 beyond [serve] max_concurrency; 503 while draining after SIGTERM; errors never include the exception, only an error_id that is logged.
  • promptise init --project [DIR] [--name NAME] [--model MODEL] [--force] -- creates a project: promptise.toml (with dev, ui, start, serve and check scripts and the model provider's API key in [env] required), agent.py (a create_agent factory with one local tool), main.py (a normal script that also runs with python main.py), .env.example, README.md, and .env / .promptise/ / __pycache__/ added to .gitignore. It refuses to overwrite files without --force, listing every conflict. Also available as promptise.run.scaffold.scaffold_project().
  • Example project -- examples/run/support_bot/: a support agent with three local tools that works with promptise run, --devtools, --tui and --serve.

Changed

  • promptise run without --model-id now runs a project. The inline REPL (promptise run --model-id ... [--stdio/--http/--instructions/--trace/--raw]) is unchanged.