Apps & Software

Switch: A Unified Harness for Decision‑Model Agents

· GlobeWire Daily Editorial Desk · Source: github.com

2 min read

Key takeawaysSwitch is a lightweight framework that lets developers wrap any decision‑model—such as Jev or llama.cpp—into a reusable harness. The core idea is to expose a domain‑specific state machine to the model, turning the state into a set of typed questions. The model then selects one answer from a finite list, and Switch translates that choice into a tool call…
Switch: A Unified Harness for Decision‑Model Agents

Image: GitHub · Photo source · Resized and letterboxed to 16:9; no AI generation

Switch is a lightweight framework that lets developers wrap any decision‑model—such as Jev or llama.cpp—into a reusable harness. The core idea is to expose a domain‑specific state machine to the model, turning the state into a set of typed questions. The model then selects one answer from a finite list, and Switch translates that choice into a tool call that advances the state.

How It Works

  • Domain: The user defines a domain (e.g., chess, rubric judging, support‑ticket routing). The domain supplies:
  • *State*: a JSON snapshot of the task.
  • *Question function*: generates the next question(s) the model must answer.
  • *Transition function*: computes the next state from the model’s answers.
  • *View function* (optional): formats the state into a token‑budgeted prompt.
  • Case: A single instance of a domain task, stored in a folder.
  • Run Loop: Switch repeatedly:
  1. Calls the view function to produce the prompt.
  2. Sends the prompt to the decision model.
  3. Receives a probability‑annotated answer.
  4. Applies the transition function to obtain the next state.
  5. Stops when no questions remain or a safety limit is hit.

Practical Uses

  • Rubric Judge: Instead of feeding an entire PDF into the model, Switch navigates the document, pulling only relevant pages and images. This reduces context waste and speeds up grading.
  • Chess Engine: The framework can play against random moves, Stockfish, or itself, demonstrating how a decision model can be guided by a simple move‑selection interface.
  • WikiRace: A domain that races from one Wikipedia article to another by following links, showcasing Switch’s flexibility.

Integration

Switch requires Node.js 22.18+. Install via npm: ```bash npm install @osolmaz/switch ``` The repository contains examples and a viewer package that can replay runs step‑by‑step in the browser.

Future Outlook

While Jev is currently weak at chess and rubric judging, the framework allows fine‑tuning of open decision models on narrow domains. A domain‑specific model can achieve comparable performance to a general chat model at a fraction of the cost.

Verification

To verify an announcement, clone the repo, run `pnpm install`, and execute `pnpm run example`. The output will show a trace file that can be replayed without invoking the model, confirming the harness logic.

Key Takeaways

  • Switch abstracts the decision‑model API into a clean, domain‑centric interface.
  • It reduces context overhead by fetching only necessary data.
  • The framework is extensible to any finite‑choice task.
  • Fine‑tuning on a narrow domain can yield cost‑effective, high‑performance agents.
Share this article

About the author

GlobeWire Daily Editorial Desk — AI-assisted news based on attributed published sources.

More to read