惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
J
Java Code Geeks
H
Help Net Security
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
U
Unit 42
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 叶小钗
D
Docker
量子位
P
Proofpoint News Feed
博客园_首页
T
Tailwind CSS Blog
F
Fortinet All Blogs

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Strict Schema Enforcement: The Bedrock of AI Reliability
tercel · 2026-05-01 · via DEV Community
In the early days of AI tool-calling, we relied on a wing and a prayer. We gave an LLM a docstring and hoped it would guess the right types. If the Agent sent a string instead of a UUID, or a float instead of an integer, the system would crash, returning a generic 500 error that left the Agent stuck in an infinite retry loop. This is Parameter Hallucination , and it is the single biggest obstacle to building production-grade AI systems. At apcore , we solve this by making Strict Schema Enforcement a protocol-level requirement. In this twelfth article of our series, we dive into why data contracts are the only way to build a reliable Cognitive Interface. Why JSON Schema Draft 2020-12? When we designed apcore, we didn't want to invent a new schema language. We chose JSON Schema Draft 2020-12 . Why? Because it is the "Universal Vocabulary" of the modern web. It is language-agnostic, widely supported, and incredibly expressive. By standardizing on this draft, we ensure: Cross-Language Consistency : A schema defined in your Python backend is validated with the exact same logic in your Rust microservice. Rich Polymorphism : We can use oneOf and anyOf to define complex inputs that an LLM can actually reason about. Self-Contained Definitions : With $ref resolution, apcore ensures that the LLM always receives a single, dereferenced schema, removing the need for the model to "fetch" external definitions. Mandatory Perception In apcore, a module cannot exist without an input_schema . This isn't a suggestion; it’s an enforcement in the Registry . By forcing developers to define the input contract upfront, we create a Safe Zone for the AI Agent. The Agent no longer has to "guess" if a field is required or what its regex pattern is. It "perceives" the contract directly from the module metadata. The "Strict" Mode apcore encourages the use of additionalProperties: false . This tells the LLM: "Do not hallucinate extra parameters. Only send exactly what is defined here." This small architectural choice significantly reduces token noise and increases the success rate of complex tool calls. The Execution Pipeline: Step 6 The power of strict schemas is best seen in Step 6 of the apcore Execution Pipeline: Input Validation . Before your business logic ever touches the data, the apcore Executor runs a full schema validation. If the LLM makes a mistake—sending a string instead of a number—the Executor halts execution immediately. But here is the clever part: instead of a stack trace, it returns a Structured Validation Error . { "code" : "SCHEMA_VALIDATION_ERROR" , "message" : "Input validation failed" , "details" : { "field" : "user_id" , "reason" : "not a valid UUID" }, "ai_guidance" : "The user_id must be a UUID format. Please re-check the user record and try again." } This error informs the Agent exactly what went wrong, allowing it to self-correct and retry without human intervention. Conclusion: Engineering the Contract If you want reliable AI Agents, you must stop "Prompting" your tools and start Engineering your Contracts . Strict schema enforcement is not about adding friction; it’s about providing the semantic clarity that AI needs to act autonomously and safely. Next, we’ll move from syntax to semantics: Behavioral Annotations. We’ll look at how 'readonly' and 'destructive' guide the LLM's planning process. This is Article #12 of the **apcore: Building the AI-Perceivable World * series. Reliability is a design choice.* GitHub : aiperceivable/apcore