Skip to main content

Agent JSON Reliability

STATUS=BETA version 0.1.0

AI agents and software frequently emit malformed JSON: markdown fences, trailing commas, single quotes, True/False/None, and extra prose around one object.

Agent JSON Reliability is a deterministic pipeline for that failure mode:

  1. inspect — diagnose whether the text is JSON and which failures are present
  2. safe repair — apply only structural, unambiguous fixes
  3. validate — optional JSON Schema check on the result
  4. structured diagnosticsvalid_original, repaired, valid_final, schema_valid, unsafe_or_ambiguous, changes, errors

This is not a generic jsonschema wrapper. The primary value is turning malformed agent output into reliable structured data without an LLM and without inventing semantic values.

When repair would require guessing (truncated objects, missing values, competing JSON documents), the service refuses. That is correct behavior.

Primary HTTP endpoint: POST /v1/json/reliable

MCP tools (same core functions, no duplicate implementation): json_reliable / reliable_json, validate_json, repair_json, inspect_json

Before / after (safe repair)

Malformed agent output:

{
  "text": "```json\n{\"name\":\"alice\",\"age\":30,}\n```"
}

Expected result (semantically equivalent valid JSON):

  • valid_original=false
  • repaired=true
  • valid_final=true
  • unsafe_or_ambiguous=false
  • json{"name":"alice","age":30}

If a schema is supplied and satisfied: schema_valid=true.

Safe refusal (ambiguous)

Truncated input such as {"user": is JSON-intended but not deterministically repairable without inventing keys or values.

Expected:

  • HTTP 200 (documented safe response)
  • valid_final=false
  • unsafe_or_ambiguous=true or repaired=false

Do not treat a correct refusal as a product failure.

Run locally (no Hunter)

python -m pip install -r requirements.txt
python serve.py

Binds 127.0.0.1:8770 by default. Set PUBLIC_BASE_URL to an HTTPS origin only when you expose the process yourself. Do not commit a temporary tunnel hostname as the canonical URL.

HTTP examples

See examples/curl.md, examples/python.py, examples/javascript.js.

Remote examples use ${PUBLIC_BASE_URL}. Local default is http://127.0.0.1:8770.

Share URLs (optional, unverified telemetry tags):

  • /?source=github
  • /?source=mcp-registry
  • /?source=api-directory

MCP (stdio — durable)

Package transport does not depend on a temporary public URL.

{
  "mcpServers": {
    "agent-json-reliability": {
      "command": "python",
      "args": ["-m", "products.gateway.mcp_stdio"]
    }
  }
}

After you publish to PyPI (free): uvx agent-json-reliability.

Remote HTTP MCP (POST /mcp) is for a running instance. Prefer stdio/package for Official MCP Registry metadata.

Machine discovery

  • GET /.well-known/agent-services.json
  • GET /openapi.json
  • GET /llms.txt
  • GET /AGENTS.md
  • POST /mcp JSON-RPC (tools/list, tools/call)

What this package does not include

No Hunter market database, no private reports, no Windows user paths, no collectors, no wallets, no x402 payment.

Free beta: no auth, no payment.

Release files for agent-json-reliability 0.1.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 agent-json-reliability 0.1.0
File Size Uploaded
agent_json_reliability-0.1.0.tar.gz 23.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-json-reliability 0.1.0
File Interpreter ABI Platform
agent_json_reliability-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.4 kB

Release files / agent_json_reliability-0.1.0.tar.gz

Download URL agent_json_reliability-0.1.0.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f2a817fe9e79eb8a18a58f0136a5953c2087f363da358ff732dc4ee8c97856cc
BLAKE2b-256 checksum
How to use checksums
5deb3c0ad5a520dde5d531553763acc15968950af555a44554ee1b3ca775007b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.6

Release files / agent_json_reliability-0.1.0-py3-none-any.whl

Download URL agent_json_reliability-0.1.0-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf7f34c0c2bd1e74fb0bfbf563950b40510d327980c65557faf6cc6a3ad5d90d
BLAKE2b-256 checksum
How to use checksums
9a7185fbf72ec813e8cd7153aff9181d4d4dc0dd0e91699fa0665dbd3cf258c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

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