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

推荐订阅源

MyScale Blog
MyScale Blog
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
V
Visual Studio Blog
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
L
LangChain Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
P
Proofpoint News Feed
博客园_首页
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - neul-labs/ormai: Give your AI agents database ac...
dipankarsark · 2026-06-18 · via Hacker News: Show HN

PyPI Version npm version Python Versions MIT License CI

Give your AI agents database access without the risk.

OrmAI wraps your existing ORM models in a policy-enforced runtime. Your agents get typed tools for querying and writing data — while you keep control over what they can see and do. No raw SQL. No prompt injection into your database. Just safe, auditable, tenant-scoped database tools.

Available for Python and TypeScript/Node.js.


Why OrmAI?

Building AI agents that interact with your database? You have probably thought about:

  • "What if the agent reads sensitive data?" → Field-level policies hide or mask PII automatically.
  • "What if it runs wild queries?" → Query budgets and row limits prevent runaway costs.
  • "How do I audit what it did?" → Every operation is logged with full context.
  • "What about multi-tenant isolation?" → Tenant scoping is built-in, not bolted on.
  • "Which ORM do we use?" → Works with SQLAlchemy, Prisma, Drizzle, TypeORM, Tortoise, Django, SQLModel, and Peewee.

OrmAI solves these at the ORM layer — not the prompt layer.


Pick Your Stack

Python TypeScript / Node.js
Package pip install ormai npm install @ormai/core
ORMs SQLAlchemy, Tortoise, Django, SQLModel, Peewee Prisma, Drizzle, TypeORM
Integrations OpenAI, LangChain, LlamaIndex, MCP, FastAPI Vercel AI SDK, LangChain.js, OpenAI, Anthropic, LlamaIndex.ts, Mastra, MCP
Quickstart ormai.quickstart @ormai/utils
Docs Python Guide TS Guide

Python Quick Start

# With your ORM of choice
pip install ormai[sqlalchemy]
# or
pip install ormai[prisma]
from ormai.quickstart import mount_sqlalchemy
from ormai.utils import DEFAULT_DEV

# Your existing SQLAlchemy models + session
toolset = mount_sqlalchemy(
    engine=engine,
    session_factory=Session,
    policy=DEFAULT_DEV
)

# Done. Your agent now has: db.query, db.get, db.aggregate, db.describe_schema

TypeScript Quick Start

# Core (required)
npm install @ormai/core

# Choose your ORM adapter
npm install @ormai/prisma
import { PrismaClient } from '@prisma/client';
import { PrismaAdapter } from '@ormai/prisma';
import { PolicyBuilder, createContext } from '@ormai/core';
import { createGenericTools } from '@ormai/tools';

const prisma = new PrismaClient();
const adapter = new PrismaAdapter({ prisma });
const schema = await adapter.introspect();

const policy = new PolicyBuilder('prod')
  .registerModels(['Customer', 'Order'])
  .tenantScope('tenantId')
  .denyFields('*password*')
  .maskFields('*email*')
  .build();

const tools = createGenericTools({ adapter, policy, schema });

const ctx = createContext({
  tenantId: 'tenant-123',
  userId: 'user-456',
  db: prisma,
  roles: ['admin'],
});

// Your agent now has safe database tools
const result = await tools[0].execute({
  model: 'Order',
  where: [{ field: 'status', op: 'eq', value: 'pending' }],
  take: 10,
}, ctx);

What You Get Out of the Box

Feature What It Does
Read-safe tools db.query, db.get, db.aggregate, db.describe_schema — no raw SQL
Write-safe tools db.create, db.update, db.delete, db.bulk_update — gated by policy
Field-level policies Hide passwords, mask emails, deny sensitive columns automatically
Tenant scoping .tenantScope('tenant_id') auto-filters every query per user
Query budgets Max rows, max includes depth, statement timeouts per model
Audit logging Every call logged with principal, tenant, trace ID, input, output
Human approval gates Require reason or approval for writes on sensitive models
Schema introspection Auto-discovers models, fields, relations, primary keys
Multi-framework LangChain, OpenAI, Vercel AI SDK, LlamaIndex, Mastra, FastAPI, MCP

Architecture

┌─────────────────────────────────────────────────────────────┐
│                        Your Agent                           │
└──────────────────────────┬──────────────────────────────────┘
                           │ calls tools
┌──────────────────────────▼──────────────────────────────────┐
│                    OrmAI Runtime                            │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐│
│  │   Policy    │  │   Audit     │  │    Tenant Scope     ││
│  │  Enforcer   │  │   Logger    │  │      Filter         ││
│  └─────────────┘  └─────────────┘  └─────────────────────┘│
└──────────────────────────┬──────────────────────────────────┘
                           │ parameterized queries only
┌──────────────────────────▼──────────────────────────────────┐
│          Your ORM (SQLAlchemy / Prisma / Drizzle / ...)   │
└─────────────────────────────────────────────────────────────┘

OrmAI sits between your agent and your ORM. It compiles agent requests into type-safe ORM queries, enforces policies, logs everything, and returns structured results. Your database never sees raw SQL from the agent.


Documentation

docs.neullabs.com/ormai — Full guides, API reference, and examples.


Installation

Python

pip install ormai[sqlalchemy]
pip install ormai[tortoise]
pip install ormai[peewee]
pip install ormai[django]
pip install ormai[sqlmodel]

# Or all adapters
pip install ormai[all]

TypeScript / Node.js

# Core (required)
npm install @ormai/core

# ORM adapters
npm install @ormai/prisma
npm install @ormai/drizzle
npm install @ormai/typeorm

# Optional packages
npm install @ormai/tools     # Generic database tools
npm install @ormai/store     # Audit logging
npm install @ormai/mcp       # MCP server
npm install @ormai/integrations  # Framework adapters
npm install @ormai/utils     # PolicyBuilder and helpers

Policy Configuration

Python

from ormai.utils import PolicyBuilder, DEFAULT_PROD

policy = (
    PolicyBuilder(DEFAULT_PROD)
    .register_models([Customer, Order])
    .deny_fields("*password*", "*secret*", "*token*")
    .mask_fields(["email", "phone"])
    .tenant_scope("tenant_id")
    .enable_writes(models=["Order"], require_reason=True)
    .build()
)

TypeScript

import { PolicyBuilder } from '@ormai/core';

const policy = new PolicyBuilder('prod')
  .registerModels(['Customer', 'Order', 'Product'])
  .tenantScope('tenantId')
  .denyFields('*password*')
  .maskFields('*email*')
  .allowRelations('Order', ['customer', 'items'])
  .enableWrites(['Order'], {
    allowCreate: true,
    allowUpdate: true,
    allowDelete: false,
    maxAffectedRows: 10,
  })
  .defaultBudgetConfig({
    maxRows: 100,
    maxIncludesDepth: 2,
    statementTimeoutMs: 5000,
  })
  .build();

Presets: DEFAULT_DEV (permissive), DEFAULT_INTERNAL (moderate), DEFAULT_PROD (strict)


Agent Framework Integrations

Framework Python Package TypeScript Package
OpenAI ormai @ormai/integrations
LangChain ormai @ormai/integrations
Vercel AI SDK @ormai/integrations
LlamaIndex ormai @ormai/integrations
Mastra @ormai/integrations
Anthropic @ormai/integrations
FastAPI ormai
MCP ormai @ormai/mcp

Supported ORMs

ORM Python TypeScript
SQLAlchemy
Prisma
Drizzle
TypeORM
SQLModel
Django ORM
Tortoise ORM
Peewee

Benchmark: OrmAI vs Text-to-SQL

We benchmarked against the Spider dataset — 1034 natural language queries:

Metric OrmAI Text-to-SQL
SQL Injection possible No Yes
Unsafe ops executed 0 23
Full audit trail Yes No
# Try it yourself
pip install ormai[benchmark]
python examples/spider_demo.py run --limit 20

Examples

More examples at docs.neullabs.com/ormai/examples.


Contributing

git clone https://github.com/neul-labs/ormai.git
cd ormai

# Python
uv sync --dev
uv run pytest

# TypeScript
cd ormai-ts
npm install
npm run build
npm run test

See contributing guide for development setup and guidelines.