Skip to content
BrendanH18Public

About

Six small apps and a workbench that show what TypeSafe's Jev (System One) model can do

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Jev Lab

Explore typed AI decisions in a local, interactive workbench.

CI Python 3.10+ License: MIT

Jev Lab demonstrates how to build software with TypeSafe's Jev. Send a state and typed questions; receive choices, scores, and probabilities that your code can use directly. Explore eight focused demos, a homepage playground, and a Workbench for your own data.

The application uses a Python standard-library web server, the official TypeSafe SDK, and vanilla JavaScript. There is no frontend build step, database, or embedding index.

Quick start · Demos · Workbench · Contributing · Security

Jev Lab dashboard and interactive playground

Quick start

You need Python 3.10+, uv, and a TypeSafe API key for live model calls.

git clone https://github.com/BrendanH18/jev-lab.git
cd jev-lab
uv sync --locked
uv run --locked server.py
  1. Open http://127.0.0.1:8321 in your browser.
  2. Select Connect API key. Keep the key in memory for this session or save it to the local, gitignored .env file.
  3. Try the homepage playground, then explore Autopilot or build a request in Workbench.

The interface starts without a key; model-backed features require one and make paid API calls. Stop the server with Ctrl+C.

Install with pip instead of uv

Create and activate a virtual environment, then install the application's runtime dependency:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install "typesafe-sdk>=0.7.5"
python server.py

On Windows, activate with .venv\Scripts\Activate.ps1 in PowerShell. The pip installation uses the latest compatible SDK; uv uses the versions committed in uv.lock.

Explore the demos

The business demos share a fictional coffee roaster, Harbor Coffee Co., with orders, vendors, invoices, a calendar, and an inbox. Actions change local simulation state: they do not send email, issue real refunds, or transfer money.

Experience What to try Pattern to learn
Playground Classify a message with four questions in one call. Choice, Score, and Noul together
Shield Screen email for phishing, prompt injection, impersonation, and payment redirects; adjust weights without another model call. Atomic judgments composed with weights and rules
Dispatch Turn a command into a typed action; inspect whether it runs, needs confirmation, or needs clarification. Candidate extraction and confidence-based routing
Autopilot Process an inbox with Shield and Dispatch combined; attached photos join the same call; compare with Dispatch alone and benchmark separate versus merged requests. Composition and sender-aware policy checks
Claims Check a customer's damage photo: does it show the order, is damage visible, how bad is it, and where; then let code decide the refund. Upload your own photo or use a sample drawing. Images, Box, and code-owned policy
Reviews Triage a public review from the website, the app, or a map listing: escalate a safety report, hold spam, flag stars that disagree with the words, and route the rest to a team with a priority; move a policy slider or the stars and it re-decides without another call. Text judgments, code-owned routing, and a mismatch computed in code
Counter Step a support chat turn by turn: fixed replies, clarification, resolution, and a handoff when a customer asks, stays frustrated, or the bot repeatedly misses the point. Policy sliders replay the saved judgments without another call. Sequential judgments, streaks, and code-owned handoff
Find Search handbook lines and check whether the document contains an answer. Selection over line IDs, without embeddings
Play Play 20 Questions with Jev as referee. Hidden state and probability thresholds
Workbench Run typed questions over labeled rows, tune a gate, and keep it as a repeatable check. Evaluation and confidence-based routing

Model-backed results include the request and response in Inspect JSON, alongside latency, token usage, and estimated cost. Open in Workbench, in the same drawer, puts that exact request in the Workbench, pictures included, so you can reword a demo's questions, save them as a test, or run them over your own rows. Model judgments are live; reweighting, replanning, exports, and simulation updates run locally.

Claims, Autopilot's photo check, and the Workbench's image support use TypeSafe's images and Box features, which TypeSafe labels dreamer-ready: suitable for prototypes, with formats and accuracy that may change. Box questions need Jev 1.14 or later, which the default jev-latest alias points at since October 14, 2026. If you pinned jev-1.13.0, choose jev-latest from the key menu in the top bar. The bundled sample pictures are simple drawings, so try your own photos too.

Autopilot comparing integrated handling with Dispatch alone

More screenshots

Shield email screening and weighted verdict Dispatch command planning and policy checks Find handbook search results Workbench bulk classification

The screenshots use synthetic inputs and model responses. Live answers and timings vary with inputs, model version, and service conditions.

Build with the Workbench

  1. Triage a sample in Reviews, then choose Inspect JSON and Open in Workbench.
  2. In Bulk, choose Load labeled review rows, name the dataset, and select Save rows and labels. Select Run 4 rows to evaluate the current Build questions.
  3. In Policy, gate the topic answer and compare accuracy with the share of rows automated.
  4. Export as a module and save the thresholds with the dataset as a check.
  5. In Bulk, scroll to Datasets and select Run check · 4 calls on your saved dataset.
Workbench on a narrow screen

The Workbench guide expanded in the narrow Basic view

Use Basic for this path and Advanced to find the other Workbench tools. Try Autopilot next to see how one request combines two sets of judgments. For exact steps and the other workflows, see the Workbench guide.

Offline tools

  • Build has in-session question checkpoints. Compare edits and preview a restore before applying it.
  • Policy reports which consistency rules sent rows to review and what those rules caught. Review flags repeated inputs and conflicting human labels while keeping blind audit answers hidden.
  • Toolbox plans finite-batch and stratified audits and computes confidence intervals from counts you enter.
  • Commands in the top bar, or Ctrl/Cmd+K, opens app navigation and keyboard help. Workbench also has commands for its tabs and guide.

Question checks, dataset health findings and Bulk input notes also run locally without a model call.

Configuration

Set variables in your process environment or a project-root .env file. Nonempty environment values take precedence over .env; see .env.example.

Variable Default Purpose
TYPESAFE_API_KEY Unset Key used for live TypeSafe requests
TYPESAFE_DEFAULT_MODEL jev-latest Model name or alias; pin a version for comparisons. The key menu can switch models for the current run
TYPESAFE_BASE_URL https://api.typesafe.ai TypeSafe API root
JEV_LAB_BUDGET_USD 2.00 Estimated spend threshold per process
JEV_LAB_RPM 120 Local limit on admitted model calls per minute
PORT 8321 HTTP port on 127.0.0.1

For example, choose another port:

PORT=8322 uv run --locked server.py

Cost displays use returned input-token counts and the model price table in jev/client.py. They are estimates, not billing records. The spend guard holds an over-estimate for each call still running, then replaces it with the billed cost. A call that fails releases the hold. One call can still settle above its hold if the provider counts more tokens than the estimate; the next admission sees the corrected total. Use your provider's billing controls for a hard spending limit. See security and data handling.

Development

Run the offline suite:

uv run --locked python -m unittest discover -v tests

No API key or external API access is needed for the tests. SDK tests use an in-memory transport; HTTP tests start a temporary loopback server. CI tests the locked dependencies on Python 3.10–3.14. CI also runs JavaScript syntax and module tests (uv run --locked node --test tests/js/*.test.mjs), and checks that the committed sample pictures match their script, and browser tests (npx playwright test) drive the real pages in headless Chromium against a model stub on loopback. A separate workflow audits uv.lock for known vulnerabilities on pull requests and weekly.

The sample pictures in static/img/samples/ are drawn by a standard-library script. After changing a scene, regenerate them and commit the PNGs with the script:

python3 scripts/draw_samples.py

For optional live evaluation after changing question wording or model versions:

uv run --locked scripts/validate.py --strict --out report.json

To rerun the checks saved with Workbench datasets, which exit nonzero when a gate misses its targets:

uv run --locked scripts/check.py
uv run --locked scripts/check.py support-tickets --drift new.jsonl  # compare unlabeled rows with that dataset

To graduate an exported gate into your own CI, follow the worked example, from synthetic rows to a passing --format github or --format json check.

validate.py makes paid API calls using the configured key and prints observed results. With --strict, a missed expectation, an incomplete scenario, or Jev model drift returns a nonzero exit code. Omit the flag to use the original observation report. Review the report before sharing it.

Read CONTRIBUTING.md for setup, checks, and pull request guidance, and the architecture guide for the request flow and source map.

Troubleshooting

Symptom Next step
No key configured or a 401 response Connect a key in the app or set TYPESAFE_API_KEY. Check that the provider accepts it.
.env cannot be saved Read the dialog's explanation. .env must be gitignored, untracked, and writable.
Session-token 403 after a restart Reload the page to get the new session token.
Budget 402 or rate-limit 429 Inspect usage in the app. Wait for the rate window or restart with an appropriate budget.
Port already in use Set another PORT and open the corresponding loopback URL.
Box questions fail, or Claims shows no box Box needs Jev 1.14 or later. Choose jev-latest in the key menu, or set TYPESAFE_DEFAULT_MODEL=jev-1.14.0.
An image is rejected Use a PNG or JPEG. The browser resizes uploads to 280–1568 pixels per side; very narrow panoramas cannot fit.

For reproducible bugs and feature proposals, open an issue. Report vulnerabilities using the process in SECURITY.md.

Project and license

Jev Lab is an independent open-source demonstration maintained by Brendan Hallas. It is not affiliated with or endorsed by TypeSafe. TypeSafe and Jev belong to their respective owners. Demo policies and thresholds are examples to evaluate on your own data before adapting them to an application.

Contributions are welcome under the contribution guide and Code of Conduct. Licensed under the MIT License.

About

Six small apps and a workbench that show what TypeSafe's Jev (System One) model can do

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages