Get the Qlaw reasoning engine running locally in a few minutes.
Prerequisites
- Python 3.10 or newer.
uv for dependency management.
- Node.js and
pnpm for the tldraw web frontend.
- An OpenAI-compatible Chat Completions endpoint and API key.
1. Install
Nothing auto-loads .env. Run any LM-hitting command with uv run --env-file .env.
Fleet Reasoner uses one model across all tiers: deepseek-v4-flash by default, addressed as openai/<model> through the OpenAI-compatible endpoint. Any OpenAI-compatible model id works via OPENAI_MODEL.
2. Verify without an API key
Stub-LM tests exercise every signature, Refine loop, and ReActV2 submission without needing credentials:
tests/helpers.py provides StubLM and field_response(...). Every output field must be present in a stubbed response, including reasoning (ChainOfThought adds it).
3. Serve the engine
The FastAPI service exposes:
POST /seed — prompt → graph with ROOT plus the first decomposition layer.
POST /engine — one reasoning step: (graph, active_node_id, action) → expanded graph.
POST /chat/stream — SSE: status and tool events, then a done event with the answer and post-chat graph.
GET /config — the active model id (no credentials) for the web client.
4. Run the web frontend
web/src/state/graphStore.ts (zustand) holds the canonical GraphState, and web/src/canvas/sync.ts is the only writer of qlaw shapes and arrows. Set VITE_API_BASE in web/.env.local if the API port differs from http://localhost:8000.
5. Compile and evaluate
The compile pipeline turns the zero-shot engine into optimized artifacts under artifacts/:
For bounded GEPA prompt optimization of the core lenses (default strategy --strategy omni — explore all engines on a small slice, continue from the validation winner), use the wrapper:
The wrapper installs the unreleased gepa OA API at run time (DSPy pins gepa 0.1.1). The gepa engine’s proposals and evaluation both use the .env model by default. Pass --codex-model to switch to the native Codex agent proposer.
Next steps
Last modified on September 7, 2026