一键导入
orm-default
ORM client for the default API — typed CRUD, vector + hybrid search, and relation walking for the 91 generated tables.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
ORM client for the default API — typed CRUD, vector + hybrid search, and relation walking for the 91 generated tables.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
CLI tool (agentic-db) for the default API — provides CRUD commands for 95 tables and 3 custom operations
ORM client for the default API — provides typed CRUD operations for 95 tables and 3 custom operations
CLI tool (agentic-db) for the default API — typed CRUD, unified search, and context/config commands for the 91 generated tables.
Install and deploy the agentic-db PostgreSQL module using pgpm. Use when asked to 'install agentic-db', 'deploy the database', 'set up agentic-db', 'create a workspace', or when bootstrapping a new project that depends on agentic-db.
| name | orm-default |
| description | ORM client for the default API — typed CRUD, vector + hybrid search, and relation walking for the 91 generated tables. |
@agentic-db/sdk exports a createClient factory that returns a Prisma-like
ORM with one model per generated table. Every call returns a QueryBuilder
— call .execute() to get a { ok, data, errors } discriminated union or
.unwrap() to throw on failure. A select object is always required.
The authoritative model list lives in
sdk/sdk/src/generated/orm/models/
and is re-exported from createClient(...). Categories:
contact, company, deal, event, venue, tag, trip,
place, note, touchpoint, interaction, plus their junctions
(contactCompany, contactEvent, contactNote, companyMemory,
dealContact, eventVenue, taskContact, …)agent, agentPrompt, agentLog, agentCollaborator,
skill, skillTool, toolDefinition, toolExecution, rule,
autonomyRecord, autonomyRecordLink, runtimeState,
runtimeStateDependency, runtimeSchedule, runtimeLog, runtimeMetric,
runtimeEvent, runtimeConfig, runtimeArtifactmemory, conversation, message, threadParticipant,
project, goal, habit, expense, task, calendar, calendarEventemail, emailThread, emailAttachment, emailNote,
emailRecipient, rawContact, rawContactEmail, rawContactPhone,
rawContactUrl, providerSyncStatecontactsChunk, notesChunk, image,
contactImage, companyImage, eventImage, venueImageactivityLog, contactLink, companyLink, eventLink,
venueLinkimport { createClient } from '@agentic-db/sdk';
const db = createClient({
endpoint: process.env.AGENTIC_DB_GRAPHQL_URL!, // http://agentic.localhost:3000/graphql
headers: { Authorization: `Bearer ${process.env.AGENTIC_DB_TOKEN!}` },
});
// Read
await db.contact
.findMany({
first: 10,
select: { id: true, firstName: true, lastName: true },
})
.execute();
await db.contact
.findOne({ id: contactId, select: { id: true, firstName: true } })
.execute();
await db.contact
.findFirst({
where: { email: { equalTo: 'alice@example.com' } },
select: { id: true, firstName: true },
})
.execute();
// Create
const { data } = await db.contact
.create({
data: { firstName: 'Alice', lastName: 'Smith', headline: 'Engineer' },
select: { id: true, firstName: true },
})
.execute();
// Update (takes `where: { id }`)
await db.contact
.update({
where: { id: contactId },
data: { headline: 'Staff Engineer' },
select: { id: true, headline: true },
})
.execute();
// Delete (takes `where: { id }`)
await db.contact.delete({ where: { id: contactId } }).execute();
Every embedding-backed table exposes where.vectorEmbedding and
where.fullTextSearch. Combine them with or for a hybrid query:
const hits = await db.memory
.findMany({
where: {
or: [
{
vectorEmbedding: {
vector: queryEmbedding, // number[768]
metric: 'COSINE', // 'COSINE' | 'L2' | 'INNER_PRODUCT'
distance: 2.0,
},
},
{ fullTextSearch: 'postgres distributed systems' },
],
},
first: 10,
select: { id: true, title: true, searchScore: true },
})
.execute();
Junction tables have composite PKs (e.g. { contactId, companyId }). Use
their model to link / unlink, and walk the relation through the parent:
// Link
await db.contactCompany
.create({
data: { contactId: contact.id, companyId: company.id },
select: { contactId: true, companyId: true },
})
.execute();
// Walk
const withCompanies = await db.contact
.findOne({
id: contact.id,
select: {
id: true,
firstName: true,
companies: { select: { id: true, name: true } },
},
})
.execute();
The integration test suite in
packages/integration-tests/__tests__/orm.test.ts
pins every pattern above against a real Postgres with pgvector, pg_trgm,
and the metaschema loaded — plus CRUD coverage for memory, conversation,
message, skill, toolDefinition, rule, project, expense, goal,
habit, autonomyRecord, and toolExecution. Use it as the reference when
the docs and the generated client disagree.