{"uid":"cap_DKDL1giMwuY8siGUSLViJ","slug":"json-schema-guard-for-agent-output-8fbbc69c","name":"JSON Schema Guard for Agent Output","description":"Checks an agent's JSON output against a JSON Schema (draft 2020-12 keywords: type, properties, required, additionalProperties, items, enum, const, length, pattern, minimum/maximum, item counts). Returns valid yes/no, each error with its path and the value with disallowed fields removed. $ref, allOf/anyOf/oneOf, if/then and format return an error instead of passing silently.","url":"https://api.fadeandco.workers.dev/api/agent-intel/agent-json-schema-guard?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"value":{"description":"The JSON value to check (any JSON)"},"schema":{"type":"object","description":"The JSON Schema"}}},"responseSchema":{"type":"json","example":{"note":"Subset of JSON Schema 2020-12. Unsupported keywords are rejected, not ignored.","valid":true,"errors":[],"source":"https://json-schema.org/draft/2020-12","checkedAt":"2026-10-23T09:35:20.029Z","sanitized":{"age":36,"name":"Ada"},"removedFields":["/extra"]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_T5rytUKYkr7BWonI9BNUD","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Validates a JSON value against a JSON Schema (draft 2020-12 subset) and returns a valid/invalid result, error details with paths, and a sanitized copy with disallowed fields removed.","exampleAgentPrompt":"Check this JSON object against my schema and tell me whether it's valid, what errors exist and where, and give me a cleaned copy with any extra fields removed.","exampleUseCases":[{"title":"Validate LLM output before tool call","prompt":"Before I pass this agent-generated JSON to the payment API, validate it against this schema and tell me if anything's missing or has the wrong type — and strip out any extra fields that aren't allowed."},{"title":"Enforce required fields in structured form","prompt":"I have a JSON response from my AI assistant and a schema that requires 'name', 'age', and 'email' with specific types. Can you check whether the JSON is valid, show me exactly which fields fail and why, and return a sanitized version?"},{"title":"Catch unsupported schema keywords in agent pipeline","prompt":"My agent is producing JSON and I want to make sure the schema I'm using doesn't accidentally rely on unsupported keywords like $ref or anyOf — can you run this value and schema through the guard and flag any issues?"}],"resultDescription":"Returns a JSON object with: a 'valid' boolean, an 'errors' array where each entry includes the path and nature of the violation, a 'sanitized' copy of the input with disallowed fields removed, a 'removedFields' list of paths that were stripped, a 'checkedAt' ISO timestamp, and a note that unsupported keywords are rejected rather than silently ignored.","failureModes":["Schema uses unsupported keywords ($ref, allOf, anyOf, oneOf, if/then, format) — returns an error rather than passing silently","Input 'schema' field is not a valid object — will fail to parse","Input 'value' is missing — validation cannot proceed","Malformed JSON in request body — returns parse error","Schema constraints conflict in ways the subset validator cannot handle"],"whenToPreferThis":"Use this endpoint when you need to validate AI agent or LLM-generated JSON against a schema before passing it downstream, especially when you also need a sanitized output with disallowed fields stripped. Prefer this over client-side validation when you want a deterministic, server-side check with explicit error paths and automatic field removal. It is particularly well-suited for agentic pipelines where output structure must be enforced and unsupported schema keywords should surface as explicit failures rather than silent passes.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T00:34:23.553Z","isFirstParty":false,"canonicalSlug":"json-schema-guard-for-agent-output-8fbbc69c"}