Skip to main content

SchemaRouter

Schema-aware planning and execution for LLM tool ecosystems.

English · 한국어 · Docs · Latest release

CI Docs PyPI MIT

SchemaRouter sits between an agent and its tools. It turns a natural-language request plus a registered capability catalog into a small, typed execution plan, then validates that plan again at runtime before anything executes.

Query
  -> Tool
  -> Endpoint
  -> Parameters
  -> Response fields
  -> Policy / evidence
  -> Schema validation
  -> Execute

It is not another general agent framework. LangChain, LangGraph, LlamaIndex, or your own orchestrator can stay above it; OpenAPI, MCP, OPTIMADE, Python callables, and adapter plugins stay below it.

Agent / graph / application orchestrator
                 |
           SchemaRouter
     typed planning + validation
                 |
        capability sources
 OpenAPI / MCP / OPTIMADE / Python

Optional decision backends (Laya / Ollama / Jev) plug into SchemaRouter's bounded selection step.
They do not become agents, do not run tool loops, and do not receive execution authority.

Current stable release: 0.6.0 · pip install schemarouter · pre-1.0

Why SchemaRouter

Tool selection alone is not enough once an agent has many capabilities. SchemaRouter makes the execution boundary explicit:

  • choose a declared tool and endpoint;
  • accept only declared parameters and output fields;
  • validate inputs and raw outputs with JSON Schema;
  • reject stale schema fingerprints and stale invoker bindings;
  • keep mutation/destructive authority local and fail closed;
  • separate credentials from model-visible arguments;
  • bound retries, elapsed time, remote calls, and response size;
  • surface OpenAPI compatibility gaps instead of silently guessing.

Quickstart

from pydantic import BaseModel
from schemarouter import PlanRequest, SchemaRouter, schema_tool


class Weather(BaseModel):
    city: str
    temperature: float


@schema_tool(read_only=True)
def current_weather(city: str) -> Weather:
    return Weather(city=city, temperature=20.5)


router = SchemaRouter()
router.add_callable(current_weather)

result = router.invoke(
    PlanRequest(query="city temperature", arguments={"city": "Seoul"})
)

print(result[0].data)

Connect capabilities

Source Use when Entry point
Python capability is local and typed router.add_callable(...)
OpenAPI HTTP API publishes a machine-readable contract SchemaRouter.from_url(..., kind="openapi")
MCP tools are exposed through MCP SchemaRouter.from_url(..., kind="mcp")
OPTIMADE materials data is exposed through OPTIMADE SchemaRouter.from_url(..., kind="optimade")
Human-readable docs no machine-readable schema exists inspect → proposal → explicit approval

Framework bridges are available for LangChain, LangGraph, and LlamaIndex. OpenTelemetry provides optional telemetry export. Jev / TypeSafe, Laya, and Ollama are optional decision backends, not agent frameworks. Existing GPT, Gemini, Claude, or other hosted model clients can also be injected through the provider-neutral ModelQueryAnalyzer or CallableDecisionBackend contracts. None of these paths bypass SchemaRouter's policy, schema validation, or execution boundary.

What 0.6 adds

0.6 adds optional local/model-assisted decision backends, operational inspection/dashboard surfaces, and a broader fail-closed OpenAPI subset:

  • local Laya decisions with CPU/CUDA/MPS device controls and benchmark metadata;
  • provider-neutral reuse of existing GPT, Gemini, Claude, or other hosted clients;
  • live/persistent inspection plus a self-contained read-only HTML dashboard;
  • response oneOf/anyOf field discovery and static same-origin $id/$anchor resolution;
  • typed JSON root request bodies, OpenAPI 3.0 nullable normalization, and default parameter-style serialization.

See the 0.6.0 release notes for details.

Inspect what SchemaRouter built

Persisted registries and run traces can be inspected without executing tools:

schemarouter inspect registry --db ./registry.sqlite3
schemarouter inspect tool materials --db ./registry.sqlite3
schemarouter inspect traces --db ./traces.sqlite3
schemarouter inspect trace <RUN_ID> --db ./traces.sqlite3
schemarouter dashboard \
  --registry ./registry.sqlite3 \
  --traces ./traces.sqlite3 \
  --output ./artifacts/schemarouter-dashboard.html

Add --json to inspection commands for automation. The dashboard is a self-contained read-only HTML export built from the same inspection contracts. The registry view exposes tool/endpoint topology, method/path, mutation classification, parameter/output-field counts, and schema fingerprints; trace views expose persisted run/event history.

Operational inspection guide

Documentation

Start with the manual rather than this README:

Development

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

ruff check .
pytest -q -m "not mcp_integration"

The protected CI surface also covers Python 3.10–3.14, Windows, minimum dependencies, package artifacts, Pyright, coverage, documentation, and optional integration suites.

Scope

SchemaRouter intentionally does not implement another chat abstraction, model-provider layer, memory system, checkpoint store, or graph runtime.

Natural-language request → typed tool execution plan → validated execution.

Research and license

SchemaRouter originated from SchemaRouter: Field-Aware Tool Routing for Efficient Heterogeneous Agentic RAG.

MIT © 2026 Yong-eun Cho

Release files for schemarouter 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for schemarouter 0.6.0
File Size Uploaded
schemarouter-0.6.0.tar.gz 252.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for schemarouter 0.6.0
File Interpreter ABI Platform
schemarouter-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 357.5 kB

Release files / schemarouter-0.6.0.tar.gz

Download URL schemarouter-0.6.0.tar.gz
Size 252.3 kB
Tags Source
SHA-256 checksum
How to use checksums
01c21193344ed14fda8c86113e76c6d210ee41d8a6e2b7cf4fc104cdf8194719
BLAKE2b-256 checksum
How to use checksums
8341017377a636be247a92068f41dda5b6610344a29a6f22d33989fb2bb3c855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / schemarouter-0.6.0-py3-none-any.whl

Download URL schemarouter-0.6.0-py3-none-any.whl
Size 105.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18e4311998210643c7505ab18136e6c5bde3a3ead503a8bc774a3d3bd6c08359
BLAKE2b-256 checksum
How to use checksums
959c3e9c4d0d5e3580f656b7091cccab8a7a09882844d29a2e1fa4ecbd6af3a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.0

2 release files

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page