AI agents are making expensive mistakes in production—and it's costing millions.
Remember the $4.6M unauthorized transaction? The AI agent processed refunds without proper approval. This isn't a one-off—73% of production AI failures are due to semantic errors, not code bugs. Traditional validation doesn't work with AI agents because they need to understand what actions are actually allowed, not just syntax.
That's where OntoGuard comes in.
OntoGuard is a semantic firewall that validates every AI agent action against OWL ontologies before execution. Think of it as a safety layer between your agents and your systems, ensuring every action complies with your business rules.
- ✅ Prevent Costly Errors - Catch violations before they cause $50K+ damage
- ✅ Zero Code Changes - Works with any AI agent framework
- ✅ Business Rule Enforcement - Define rules in OWL, enforce automatically
- ✅ Production Ready - 244+ tests, battle-tested validation engine
Semantic Validation Engine
- Action existence and validity checking
- Entity type compatibility validation
- Role-based permissions enforcement
- Business rule constraints (amounts, temporal, custom)
- Detailed denial explanations with suggested alternatives
Command-Line Interface (CLI)
validate- Check actions before executioninteractive- Explore ontologies interactivelyinfo- Display ontology statistics and structure- Rich, colorful terminal output
Model Context Protocol (MCP) Server
- Native MCP integration for AI agents
- Tools:
validate_action,get_allowed_actions,explain_rule,check_permissions - Configuration via YAML
- Full logging and error handling
Three production-ready example ontologies:
-
E-Commerce (
examples/ontologies/ecommerce.owl)- Users, orders, products, refunds
- Rules: "Only Admins can delete Users", "Refunds over $1000 require Manager approval"
- 19 test scenarios
-
Healthcare (
examples/ontologies/healthcare.owl)- Medical staff, patients, records, procedures
- Rules: "Only Doctors can create prescriptions", "Sensitive records require Doctor role"
- 22 test scenarios
-
Finance (
examples/ontologies/finance.owl)- Bank employees, customers, accounts, transactions
- Rules: "Transactions over $10K require manager approval", "International transfers need compliance officer"
- 23 test scenarios
Ready-to-use integration examples:
- LangChain - Use OntoGuard as a validation tool in your agent
- Microsoft AutoGen - Multi-agent coordination with semantic rules
- CrewAI - Task validation before assignment
- Custom - Works with any AI agent framework
- Comprehensive README with quick start guide
- Integration examples for all major frameworks
- MCP server usage documentation
- Contributing guidelines and code of conduct
- 244+ passing tests with 85%+ coverage
pip install ontoguardfrom ontoguard import OntologyValidator
# Load your business rules
validator = OntologyValidator("business_rules.owl")
# Validate before executing
result = validator.validate(
action="process_refund",
entity="Refund",
entity_id="refund_123",
context={"role": "Customer", "amount": 5000}
)
if result.allowed:
print("✅ Safe to proceed")
execute_refund(result.metadata)
else:
print(f"❌ Blocked: {result.reason}")
print(f"💡 Try: {result.suggested_actions}")That's it! Your agent is now protected. 🎉
- 📖 Full Documentation - Complete setup guide
- 💡 Examples - Real-world usage examples
- 🔌 MCP Integration - Connect to your AI agents
- Web-based dashboard for rule management
- Real-time validation monitoring
- Visual ontology editor
- Auto-generate ontologies from database schemas
- Self-healing schema mapping
- Automatic rule inference
- Support for multiple ontologies
- Ontology versioning
- Rule conflict resolution
Have feature requests? Open an issue or vote on existing ones!
If OntoGuard saves you from a costly mistake, give it a star! It helps others discover the project.
Want to learn how OntoGuard was built? Check out our Medium articles:
- Why AI Agents Fail in Production (And How to Fix It) (Coming soon)
- Building a Semantic Firewall for AI Agents (Coming soon)
- The $4.6M Mistake: A Case Study (Coming soon)
Have questions? Want to share your use case? Join the conversation:
First 10 teams get a free 1-hour consultation!
Deploying OntoGuard in production? I'm offering free 1-hour consultations to the first 10 teams who:
- Star the repository
- Open a discussion with your use case
- Mention "v0.1.0 consultation" in the title
We'll cover:
- Ontology design for your business rules
- Integration with your AI agent framework
- Best practices for production deployment
- Custom rule implementation
OntoGuard is free and open source forever (MIT licensed). If it saves you from a costly mistake, consider supporting development:
Your sponsorship enables:
- Full-time development on new features
- Better documentation and tutorials
- Faster bug fixes and support
- Enterprise features (SSO, audit logs, analytics)
- 244 tests passing ✅
- 85%+ code coverage 📈
- 3 example ontologies 📚
- 3 framework integrations 🔌
- MIT licensed 🔓
- Production ready 🚀
Thank you to everyone who:
- ⭐ Starred the repository
- 🐛 Reported bugs
- 💡 Suggested features
- 📝 Contributed code
- 📢 Shared the project
Together, we're building a safer future for AI in production.
- GitHub: cloudbadal007/ontoguard-ai
- Email: badal.aiworld@gmail.com
- Medium: @cloudpankaj
- License: MIT
See CHANGELOG.md for a complete list of changes in v0.1.0.
🎉 Ready to protect your AI agents? Install OntoGuard today!
pip install ontoguardMade with ❤️ for the AI community. Preventing costly mistakes, one validation at a time.