Architecture guide

Which layer should your product use?

Use this page to separate model access from product-facing agent work with sessions, files, artifacts, and traces.

Short answer

Use a model router when your product needs model access, provider choice, or fallback. Use HarnessRouter when an end user expects completed work that your product must stream, recover, preview, download, continue, or revise.

  • Model routers solve model access and routing.
  • HarnessRouter handles the product-facing agent run: status, sessions, files, artifacts, and control-plane Trace.
  • A product can use both layers, but they answer different user needs.

Match the layer to the user job

Product UI
Collects the user's task, shows run status, and lets the user review the result.
HarnessRouter
Runs the product task through the configured agent and returns a result your app can handle.
Agent harness
Executes the task in a specialized agent environment such as Codex, Claude Code, or Hermes. Pi is reserved until the harness catalog marks it available.
Model router
Selects or accesses models, providers, fallback paths, or gateway controls.

Decide by the output your UI needs

QuestionModel router / LLM gatewayHarnessRouter
InputPrompt, message, model name, provider preference, or inference request.Product task that should become completed work inside your app.
OutputModel response, JSON, tool-call data, media, embedding, or stream.Harness run result your product can inspect, render, accept, save, or ship.
Best forProvider access, fallback, cost control, and model choice.Agent-backed product features without building the harness backend.

Use both when the product needs both layers

  • Keep OpenRouter, TokenRouter, or another model router at the model access layer.
  • Use HarnessRouter for user-facing work requests that need a harness run.
  • Keep the UI language focused on the user's task, not the infrastructure stack.

FAQ

Is HarnessRouter an OpenRouter alternative?
No. OpenRouter focuses on model access and routing. HarnessRouter focuses on product tasks that need agent harnesses, sessions, files, artifacts, and traces.
Is HarnessRouter a TokenRouter alternative?
No. TokenRouter-style products belong near the model gateway layer. HarnessRouter belongs where product workflows become agent runs.
Can a product use both?
Yes. A product can use a model router underneath while HarnessRouter routes the user-facing agent task.

Run your first agent task.

One API for agent tasks, sessions, streaming, files, and artifacts across Codex, Claude Code, and Hermes.

Start building free